Target-independent register allocation algorithm
Dependencies
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_value_count(Self) -> Int
fn entry_value_at(Self, Int) -> VirtualReg
fn block_count(Self) -> Int
fn block_id_at(Self, Int) -> Int
fn block_parameter_count(Self, Int) -> Int
fn block_parameter_at(Self, Int, Int) -> VirtualReg
fn block_instruction_count(Self, Int) -> Int
fn block_instruction_at(Self, Int, Int) -> Int
fn block_successor_count(Self, Int) -> Int
fn block_successor_at(Self, Int, Int) -> Int
fn edge_argument_count(Self, Int, Int) -> Int
fn edge_argument_at(Self, Int, Int, Int) -> VirtualReg
fn instruction_operands(Self, Int) -> ArrayView[AllocationOperand]
fn instruction_clobbers(Self, Int) -> ArrayView[PhysicalReg]
}pub suberror VerifyError {
Unassigned(vreg~ : VirtualReg)
FixedConstraintViolation(vreg~ : VirtualReg, required~ : PhysicalReg, actual~ : AllocationLocation)
InvalidPreference(vreg~ : VirtualReg, preferred~ : PhysicalReg)
IncorrectValue(vreg~ : VirtualReg, location~ : AllocationLocation)
ScratchRegisterUnavailable(message~ : String)
InvalidPlan(message~ : String)
} derive(Debug)pub(all) struct AllocationEdit {
value : VirtualReg
from : AllocationLocation
to : AllocationLocation
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) -> AllocationLocation?fn AllocationPlan::operand_location_storage(self : AllocationPlan) -> Array[Array[AllocationLocation?]]pub struct AllocationSession {
// private fields
}fn[F : FunctionView] AllocationSession::allocate_function(self : AllocationSession, function : F, environment : MachineEnv, config? : RegallocConfig) -> AllocationPlan raise VerifyErrorfn BundleAllocationStatistics::equal(BundleAllocationStatistics, BundleAllocationStatistics) -> Boolfn BundleAllocationStatistics::not_equal(x : BundleAllocationStatistics, y : BundleAllocationStatistics) -> Boolfn 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 struct OperandAssignment {
instruction : Int
operand : Int
location : AllocationLocation
} 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]) -> Boolpub struct RegallocConfig {
verify : Bool
observer : (RegallocPhase?) -> Unit?
statistics_observer : (BundleAllocationStatistics) -> Unit?
}fn RegallocConfig::RegallocConfig(verify? : Bool, observer? : (RegallocPhase?) -> Unit?, statistics_observer? : (BundleAllocationStatistics) -> Unit?) -> RegallocConfigimpl Show for RegallocPhasepub(all) struct UsePosition {
point : ProgramPoint
kind : UseKind
constraint : AllocationConstraint
preference : PhysicalReg?
tie_id : Int
} derive(Eq, Debug)fn UsePosition::UsePosition(point : ProgramPoint, kind : UseKind, constraint : AllocationConstraint) -> UsePositionfn[F : FunctionView] allocate_function(function : F, environment : MachineEnv, config? : RegallocConfig) -> AllocationPlan raise VerifyErrorInstall
Download zipTarget-independent register allocation algorithm
Dependencies