Target-independent register allocation algorithm
pub(open) trait FunctionView {
fn value_count(Self) -> Int
fn value_class(Self, Int) -> RegClass
fn value_spill_size(Self, Int) -> Int
fn value_spill_alignment(Self, Int) -> Int
fn values_share_spill_slot(Self, Int, Int) -> Bool
fn entry_values(Self) -> Array[VirtualReg]
fn block_count(Self) -> Int
fn block_id_at(Self, Int) -> Int
fn block_parameters(Self, Int) -> Array[VirtualReg]
fn block_instructions(Self, Int) -> Array[Int]
fn block_successors(Self, Int) -> Array[Int]
fn edge_arguments(Self, Int, Int) -> Array[VirtualReg]
fn instruction_operands(Self, Int) -> Array[Operand]
fn instruction_clobbers(Self, Int) -> Array[PhysicalReg]
}pub suberror VerifyError {
Unassigned(vreg~ : VirtualReg)
FixedConstraintViolation(vreg~ : VirtualReg, required~ : PhysicalReg, actual~ : Location)
InvalidPreference(vreg~ : VirtualReg, preferred~ : PhysicalReg)
IncorrectValue(vreg~ : VirtualReg, location~ : Location)
ScratchRegisterUnavailable(message~ : String)
InvalidPlan(message~ : String)
} derive(Debug)pub(all) struct AllocationEdit {
value : VirtualReg
from : Location
to : Location
position : EditPosition
} derive(Eq, Debug)pub struct AllocationPlan {
// private fields
}impl Show for AllocationPlanimpl Debug for AllocationPlanfn AllocationPlan::operand_location(self : AllocationPlan, instruction : Int, operand : Int) -> Location?fn LiveRange::is_live_across(self : LiveRange, point : ProgramPoint, block_order : Array[Int]) -> Boolfn LiveRange::touch_with_order(self : LiveRange, point : ProgramPoint, block_order : Array[Int]) -> Unitpub struct MachineEnv {
allocatable_regs : Array[PhysicalReg]
scratch_regs : Array[PhysicalReg]
operand_scratch_regs : Array[PhysicalReg]
fixed_operand_regs : Array[PhysicalReg]
}fn MachineEnv::new(allocatable_regs : Array[PhysicalReg], scratch_regs : Array[PhysicalReg]) -> MachineEnvfn MachineEnv::with_fixed_operand_regs(self : MachineEnv, fixed_operand_regs : Array[PhysicalReg]) -> MachineEnvfn MachineEnv::with_operand_scratch_regs(self : MachineEnv, operand_scratch_regs : Array[PhysicalReg]) -> MachineEnvpub(all) struct Operand {
vreg : VirtualReg
role : OperandRole
constraint : OperandConstraint
preference : PhysicalReg?
tie_id : Int
timing : OperandTiming
} derive(Eq, Debug)fn ProgramPoint::compare_with_order(self : ProgramPoint, other : ProgramPoint, block_order : Array[Int]) -> Intfn ProgramRange::contains(self : ProgramRange, point : ProgramPoint, block_order : Array[Int]) -> Boolfn ProgramRange::overlaps(self : ProgramRange, other : ProgramRange, block_order : Array[Int]) -> Boolfn RegallocConfig::RegallocConfig(verify? : Bool, observer? : (RegallocPhase?) -> Unit?) -> RegallocConfigimpl Show for RegallocPhasepub(all) struct UsePosition {
point : ProgramPoint
kind : UseKind
constraint : OperandConstraint
preference : PhysicalReg?
tie_id : Int
} derive(Eq, Debug)fn UsePosition::UsePosition(point : ProgramPoint, kind : UseKind, constraint : OperandConstraint) -> UsePositionfn[F : FunctionView] allocate_function(function : F, environment : MachineEnv, config? : RegallocConfig) -> AllocationPlan raise VerifyErrorTarget-independent register allocation algorithm