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 variadic_wide_arguments: HashMap<VirtualReg, Aggregate>,
pub variadic_wide_results: HashMap<VirtualReg, Aggregate>,
pub pointer_width: PointerWidth,
pub int64_regs: bool,
pub value_names: HashMap<VirtualReg, String>,
}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.
variadic_wide_arguments: HashMap<VirtualReg, Aggregate>Registers that hold the address of a legalized integer pair a call passes where the callee’s declaration gives no type for it: past the named parameters of a variadic callee. The aggregate is what the callee reads there. Nothing else tells such an address from a pointer argument, so a backend without this passes the address where the value belongs.
variadic_wide_results: HashMap<VirtualReg, Aggregate>Registers a va_arg of a legalized integer pair defines. The register names a
two-word stack reservation the backend writes the value read out of the
variadic area into, not a register that comes to hold the value. A backend
without this reads one word where two are owed.
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.
value_names: HashMap<VirtualReg, String>The source name of each virtual register the frontend named, without its sigil. Debug info only; a register a pass invented is absent.
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 variadic_wide_argument(&self, arg: &Operand) -> Option<Aggregate>
pub fn variadic_wide_argument(&self, arg: &Operand) -> Option<Aggregate>
The aggregate a call argument is passed by value as when the callee’s
declaration gives no type for it, or None for an ordinary argument.
Sourcepub fn variadic_wide_result(&self, dst: &Register) -> Option<Aggregate>
pub fn variadic_wide_result(&self, dst: &Register) -> Option<Aggregate>
The aggregate a va_arg writes into the stack reservation dst names, or
None when dst is an ordinary destination register.
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