pub struct CraneliftFunction {
pub name: String,
pub sig: Signature,
pub stack_slots: Vec<(u32, u32)>,
pub global_values: Vec<(u32, String)>,
pub sig_refs: Vec<(u32, Signature)>,
pub func_refs: Vec<(u32, String, u32)>,
pub blocks: Vec<CraneliftBlock>,
/* private fields */
}Expand description
A Cranelift function definition.
Fields§
§name: StringFunction name
sig: SignatureFunction signature
stack_slots: Vec<(u32, u32)>Stack slots: (slot_id, size_bytes)
global_values: Vec<(u32, String)>Global values referenced: (gv_id, name)
sig_refs: Vec<(u32, Signature)>Signature references for indirect calls: (sig_id, signature)
func_refs: Vec<(u32, String, u32)>Function references for direct calls: (fn_ref_id, name, sig_id)
blocks: Vec<CraneliftBlock>Basic blocks (first block is the entry block)
Implementations§
Source§impl CraneliftFunction
impl CraneliftFunction
Sourcepub fn fresh_value(&mut self, ty: CraneliftType) -> CraneliftValue
pub fn fresh_value(&mut self, ty: CraneliftType) -> CraneliftValue
Allocate a fresh SSA value with the given type.
Sourcepub fn new_block_with_params(&mut self, param_types: &[CraneliftType]) -> u32
pub fn new_block_with_params(&mut self, param_types: &[CraneliftType]) -> u32
Create a new block with parameters.
Sourcepub fn block_mut(&mut self, id: u32) -> Option<&mut CraneliftBlock>
pub fn block_mut(&mut self, id: u32) -> Option<&mut CraneliftBlock>
Get a mutable reference to a block by id.
Sourcepub fn add_stack_slot(&mut self, size_bytes: u32) -> u32
pub fn add_stack_slot(&mut self, size_bytes: u32) -> u32
Add a stack slot.
Trait Implementations§
Source§impl Clone for CraneliftFunction
impl Clone for CraneliftFunction
Source§fn clone(&self) -> CraneliftFunction
fn clone(&self) -> CraneliftFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CraneliftFunction
impl Debug for CraneliftFunction
Source§impl PartialEq for CraneliftFunction
impl PartialEq for CraneliftFunction
impl StructuralPartialEq for CraneliftFunction
Auto Trait Implementations§
impl Freeze for CraneliftFunction
impl RefUnwindSafe for CraneliftFunction
impl Send for CraneliftFunction
impl Sync for CraneliftFunction
impl Unpin for CraneliftFunction
impl UnsafeUnpin for CraneliftFunction
impl UnwindSafe for CraneliftFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more