Add a ValueLoc type and the locations table.
This table holds the result of register allocation.
This commit is contained in:
24
lib/cretonne/src/ir/valueloc.rs
Normal file
24
lib/cretonne/src/ir/valueloc.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
//! Value locations.
|
||||
//!
|
||||
//! The register allocator assigns every SSA value to either a register or a stack slot. This
|
||||
//! assignment is represented by a `ValueLoc` object.
|
||||
|
||||
use isa::RegUnit;
|
||||
use ir::StackSlot;
|
||||
|
||||
/// Value location.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum ValueLoc {
|
||||
/// This value has not been assigned to a location yet.
|
||||
Unassigned,
|
||||
/// Value is assigned to a register.
|
||||
Reg(RegUnit),
|
||||
/// Value is assigned to a stack slot.
|
||||
Stack(StackSlot),
|
||||
}
|
||||
|
||||
impl Default for ValueLoc {
|
||||
fn default() -> Self {
|
||||
ValueLoc::Unassigned
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user