WIP: redundant-move elimination.
This commit is contained in:
15
src/lib.rs
15
src/lib.rs
@@ -43,7 +43,7 @@ pub struct PReg(u8, RegClass);
|
||||
impl PReg {
|
||||
pub const MAX_BITS: usize = 5;
|
||||
pub const MAX: usize = (1 << Self::MAX_BITS) - 1;
|
||||
pub const MAX_INDEX: usize = 2 * Self::MAX; // including RegClass bit
|
||||
pub const MAX_INDEX: usize = 1 << (Self::MAX_BITS + 1); // including RegClass bit
|
||||
|
||||
/// Create a new PReg. The `hw_enc` range is 6 bits.
|
||||
#[inline(always)]
|
||||
@@ -188,6 +188,19 @@ impl SpillSlot {
|
||||
pub fn plus(self, offset: usize) -> Self {
|
||||
SpillSlot::new(self.index() + offset, self.class())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn invalid() -> Self {
|
||||
SpillSlot(0xffff_ffff)
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn is_invalid(self) -> bool {
|
||||
self == Self::invalid()
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn is_valid(self) -> bool {
|
||||
self != Self::invalid()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for SpillSlot {
|
||||
|
||||
Reference in New Issue
Block a user