pub struct MoveEnv {
pub free: RegSet,
pub scratch_slot: Option<StackSlot>,
pub victim_slot: Option<StackSlot>,
pub swap: bool,
}Expand description
What the resolver may use besides the moves’ own locations.
§Examples
use backend_lang::RegSet;
use backend_lang::mir::StackSlot;
use backend_lang::moves::MoveEnv;
use backend_lang::x86_64::R11;
let env = MoveEnv::new()
.with_free(RegSet::of(&[R11]))
.with_scratch_slot(StackSlot::new(4))
.with_victim_slot(StackSlot::new(5));
assert!(env.free.contains(R11));Fields§
§free: RegSetRegisters the caller guarantees are dead here and may be overwritten. Registers that are a source or destination of a move are ignored.
scratch_slot: Option<StackSlot>A stack slot (of the largest class’s spill size) for a cycle’s saved value when no free register of its class exists.
victim_slot: Option<StackSlot>A stack slot to save a borrowed register in, for a memory-to-memory move when no free register exists.
swap: boolWhether register cycles may be resolved with swaps (honoured only on targets that have them). On by default.
Implementations§
Source§impl MoveEnv
impl MoveEnv
Sourcepub const fn new() -> MoveEnv
pub const fn new() -> MoveEnv
No free registers, no slots, swaps allowed.
§Examples
use backend_lang::moves::MoveEnv;
assert!(MoveEnv::new().free.is_empty());
assert!(MoveEnv::new().swap);Sourcepub const fn with_free(self, free: RegSet) -> MoveEnv
pub const fn with_free(self, free: RegSet) -> MoveEnv
With free as the free registers.
§Examples
use backend_lang::RegSet;
use backend_lang::moves::MoveEnv;
use backend_lang::x86_64::R10;
assert!(MoveEnv::new().with_free(RegSet::of(&[R10])).free.contains(R10));Sourcepub const fn with_scratch_slot(self, slot: StackSlot) -> MoveEnv
pub const fn with_scratch_slot(self, slot: StackSlot) -> MoveEnv
With slot as the scratch slot.
§Examples
use backend_lang::mir::StackSlot;
use backend_lang::moves::MoveEnv;
let env = MoveEnv::new().with_scratch_slot(StackSlot::new(0));
assert_eq!(env.scratch_slot, Some(StackSlot::new(0)));Sourcepub const fn with_victim_slot(self, slot: StackSlot) -> MoveEnv
pub const fn with_victim_slot(self, slot: StackSlot) -> MoveEnv
With slot as the victim slot.
§Examples
use backend_lang::mir::StackSlot;
use backend_lang::moves::MoveEnv;
let env = MoveEnv::new().with_victim_slot(StackSlot::new(1));
assert_eq!(env.victim_slot, Some(StackSlot::new(1)));Trait Implementations§
impl Copy for MoveEnv
impl Eq for MoveEnv
impl StructuralPartialEq for MoveEnv
Auto Trait Implementations§
impl Freeze for MoveEnv
impl RefUnwindSafe for MoveEnv
impl Send for MoveEnv
impl Sync for MoveEnv
impl Unpin for MoveEnv
impl UnsafeUnpin for MoveEnv
impl UnwindSafe for MoveEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more