Add a ValueLoc type and the locations table.

This table holds the result of register allocation.
This commit is contained in:
Jakob Stoklund Olesen
2016-12-08 13:57:28 -10:00
parent a08a470a18
commit e1c5abaff5
4 changed files with 43 additions and 2 deletions

View 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
}
}