pub struct Function {
pub sig: Signature,
pub blocks: Vec<Block>,
pub entry: String,
pub stack_reservations: HashMap<VirtualReg, usize>,
pub stack_alignments: HashMap<VirtualReg, usize>,
pub pointer_width: PointerWidth,
pub int64_regs: bool,
}Expand description
LUMIR function
Fields§
§sig: SignatureFunction signature
blocks: Vec<Block>Basic blocks (ordered map for deterministic iteration)
entry: StringEntry block label
stack_reservations: HashMap<VirtualReg, usize>Extra 8-byte stack slots a virtual register needs beyond its own, for stack allocations larger than one slot. The register addresses the lowest byte of the reservation.
stack_alignments: HashMap<VirtualReg, usize>Required alignment in bytes for a virtual register’s stack slot, set by
stackalloc ... align n when n exceeds the 8-byte slot size.
pointer_width: PointerWidthWidth of data pointers on the target this function is lowered for. Sizes of pointer-typed values derive from it.
int64_regs: boolWhether integer registers on the target this function is lowered for are 64 bits. Sets the register type of an I/O intrinsic’s result, which is an i64 wherever registers are 64 bits.
Implementations§
Source§impl Function
impl Function
Sourcepub fn new(sig: Signature) -> Self
pub fn new(sig: Signature) -> Self
Create a new function with the given signature. Pointers are 64-bit until
Function::with_pointer_width says otherwise.
pub fn with_pointer_width(self, pointer_width: PointerWidth) -> Self
pub fn with_int64_regs(self, int64_regs: bool) -> Self
Sourcepub fn with_entry(self, entry: impl Into<String>) -> Self
pub fn with_entry(self, entry: impl Into<String>) -> Self
Set the entry block label
Sourcepub fn get_block_mut(&mut self, label: &str) -> Option<&mut Block>
pub fn get_block_mut(&mut self, label: &str) -> Option<&mut Block>
Get a mutable reference to a basic block by label
Sourcepub fn entry_block(&self) -> Option<&Block>
pub fn entry_block(&self) -> Option<&Block>
Get the entry block
Sourcepub fn entry_block_mut(&mut self) -> Option<&mut Block>
pub fn entry_block_mut(&mut self) -> Option<&mut Block>
Get a mutable reference to the entry block
Sourcepub fn block_labels(&self) -> Vec<&str>
pub fn block_labels(&self) -> Vec<&str>
Get all block labels
Sourcepub fn instruction_count(&self) -> usize
pub fn instruction_count(&self) -> usize
Total number of instructions across all blocks