pub struct MachineFunction {
pub name: String,
pub blocks: Vec<MachineBlock>,
pub allocatable_pregs: Vec<PReg>,
pub callee_saved_pregs: Vec<PReg>,
pub frame_size: u32,
pub spill_slots: HashMap<VReg, u32>,
pub used_callee_saved: Vec<PReg>,
pub debug_source: Option<String>,
pub debug_line_start: Option<u32>,
pub current_debug_loc: Option<DebugLoc>,
/* private fields */
}Expand description
Machine-level representation of a function, ready for register allocation and code emission.
Fields§
§name: StringName of the function.
blocks: Vec<MachineBlock>Basic blocks in layout order (block 0 is the entry).
allocatable_pregs: Vec<PReg>Physical registers available for allocation (set by the target).
callee_saved_pregs: Vec<PReg>Callee-saved physical registers (set by the target).
frame_size: u32Frame size in bytes (spill slots only; set by insert_spill_reloads).
spill_slots: HashMap<VReg, u32>Map from spilled VReg → frame slot index (0-based; emitter converts to byte offset).
used_callee_saved: Vec<PReg>Callee-saved physical registers actually used by this function (populated by apply_allocation).
debug_source: Option<String>Source filename used for debug line tables.
debug_line_start: Option<u32>First source line observed from IR !dbg metadata.
current_debug_loc: Option<DebugLoc>Debug location automatically attached by MachineFunction::push.
Implementations§
Source§impl MachineFunction
impl MachineFunction
Sourcepub fn fresh_vreg(&mut self) -> VReg
pub fn fresh_vreg(&mut self) -> VReg
Allocate a fresh virtual register.
Sourcepub fn alloc_spill_slot(&mut self, vreg: VReg) -> u32
pub fn alloc_spill_slot(&mut self, vreg: VReg) -> u32
Allocate a fresh frame slot for a spilled VReg and return its index.
Slot 0 is the first 8-byte slot below the frame pointer. The emitter
converts a slot index n to a byte offset (e.g. x86: -(n+1)*8 from
RBP; AArch64: (n+2)*8 above the saved FP/LR pair).
Trait Implementations§
Source§impl Clone for MachineFunction
impl Clone for MachineFunction
Source§fn clone(&self) -> MachineFunction
fn clone(&self) -> MachineFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more