#[non_exhaustive]pub enum FrameStep {
Push(PReg),
SetFramePointer,
Alloc {
bytes: u32,
probe: u32,
},
SaveVec {
reg: PReg,
offset: i32,
},
RestoreVec {
reg: PReg,
offset: i32,
},
Free(u32),
Pop(PReg),
}Expand description
One step of a prologue or epilogue, in execution order.
§Examples
use backend_lang::mir::{Function, SlotKind};
use backend_lang::target::frame::FrameStep;
use backend_lang::x86_64::{WIN64, RBP};
let mut f = Function::new("f", &WIN64);
let _big = f.stack_slot(SlotKind::Local { size: 10000, align: 8 })?;
let frame = f.frame_layout().unwrap();
assert_eq!(frame.prologue()[0], FrameStep::Push(RBP));
assert_eq!(frame.prologue()[1], FrameStep::SetFramePointer);
// Win64 probes frames of a page or more.
assert!(matches!(frame.prologue()[2], FrameStep::Alloc { probe: 4096, .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Push(PReg)
Push a register (push r).
SetFramePointer
Point the frame pointer at the stack pointer (mov rbp, rsp).
Alloc
Lower the stack pointer by bytes. With probe non-zero, one page of
probe bytes at a time, touching each.
SaveVec
Store a vector register into the frame at [sp + offset].
RestoreVec
Reload a vector register saved by FrameStep::SaveVec.
Free(u32)
Raise the stack pointer by bytes (add rsp, bytes).
Pop(PReg)
Pop a register (pop r).
Trait Implementations§
impl Copy for FrameStep
impl Eq for FrameStep
impl StructuralPartialEq for FrameStep
Auto Trait Implementations§
impl Freeze for FrameStep
impl RefUnwindSafe for FrameStep
impl Send for FrameStep
impl Sync for FrameStep
impl Unpin for FrameStep
impl UnsafeUnpin for FrameStep
impl UnwindSafe for FrameStep
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