pub enum Disp {
Const(i32),
Sym(SymId),
Label(Label),
LabelFar(Label),
}Expand description
Holds a memory displacement: a folded constant, a frontend-owned symbol, or the address of a code label.
Variants§
Const(i32)
Sym(SymId)
Holds {IDENT} in the offlineasm text template. onlineasm and
RISC-style backends that must fold it reject this variant.
Label(Label)
Addresses the memory at the label’s address, PC-relatively. On x86-64
this is [rip + disp32]; on AArch64 it is the closest form, an
ldr/ldrsw literal (A64Ldr19, ±1 MiB). Only valid with no base
and no index. A label is never a displacement on its own: use
Mem::label.
LabelFar(Label)
Like Disp::Label, but asks for the page-pair form on AArch64
(adrp + ldr/str low-12, ±4 GiB) instead of a literal load.
x86-64 lowers it exactly like Disp::Label.
Implementations§
Trait Implementations§
impl Copy for Disp
impl Eq for Disp
impl StructuralPartialEq for Disp
Auto Trait Implementations§
impl Forget for Disp
impl Freeze for Disp
impl Move for Disp
impl RefUnwindSafe for Disp
impl Send for Disp
impl Sync for Disp
impl Unpin for Disp
impl UnsafeUnpin for Disp
impl UnwindSafe for Disp
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