pub struct Accept { /* private fields */ }Expand description
Which operand shapes a use accepts: a register, memory (an address or a stack slot), an immediate in a range, a function symbol.
§Examples
use backend_lang::target::{Accept, ImmRange};
let rmi = Accept::RM.with_imm(ImmRange::I32);
assert!(rmi.reg() && rmi.mem());
assert_eq!(rmi.imm(), ImmRange::I32);
assert!(!Accept::REG.mem());Implementations§
Source§impl Accept
impl Accept
Sourcepub const fn with_imm(self, range: ImmRange) -> Accept
pub const fn with_imm(self, range: ImmRange) -> Accept
Also accepts immediates in range.
§Examples
use backend_lang::target::{Accept, ImmRange};
assert_eq!(Accept::REG.with_imm(ImmRange::U8).imm(), ImmRange::U8);Sourcepub const fn with_symbol(self) -> Accept
pub const fn with_symbol(self) -> Accept
Also accepts a function symbol (a direct call target, or the address of a function as a RIP-relative memory operand).
§Examples
use backend_lang::target::Accept;
assert!(Accept::MEM.with_symbol().symbol());Sourcepub const fn reg(self) -> bool
pub const fn reg(self) -> bool
Whether a register is accepted.
§Examples
use backend_lang::target::Accept;
assert!(Accept::RM.reg());Sourcepub const fn mem(self) -> bool
pub const fn mem(self) -> bool
Whether memory (an address or a stack slot) is accepted.
§Examples
use backend_lang::target::Accept;
assert!(Accept::MEM.mem());Trait Implementations§
impl Copy for Accept
impl Eq for Accept
impl StructuralPartialEq for Accept
Auto Trait Implementations§
impl Freeze for Accept
impl RefUnwindSafe for Accept
impl Send for Accept
impl Sync for Accept
impl Unpin for Accept
impl UnsafeUnpin for Accept
impl UnwindSafe for Accept
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