pub trait Register:
Copy
+ Clone
+ Debug
+ Hash
+ Eq {
// Required methods
fn id(&self) -> u32;
fn abi_class(&self) -> AbiClass;
// Provided methods
fn is_caller_saved(&self) -> bool { ... }
fn is_callee_saved(&self) -> bool { ... }
fn is_special(&self) -> bool { ... }
}Expand description
A register identifier for a target architecture
Required Methods§
Sourcefn abi_class(&self) -> AbiClass
fn abi_class(&self) -> AbiClass
Get the ABI classification for this register.
This method should return the appropriate AbiClass based on the
target architecture’s calling convention.
§Example
ⓘ
// For RISC-V
match self {
Register::T0 | Register::T1 => AbiClass::CallerSaved,
Register::S0 | Register::S1 => AbiClass::CalleeSaved,
Register::SP | Register::FP => AbiClass::Other,
// ...
}Provided Methods§
Sourcefn is_caller_saved(&self) -> bool
fn is_caller_saved(&self) -> bool
Check if this register is caller-saved.
Convenience method equivalent to self.abi_class() == AbiClass::CallerSaved.
Sourcefn is_callee_saved(&self) -> bool
fn is_callee_saved(&self) -> bool
Check if this register is callee-saved.
Convenience method equivalent to self.abi_class() == AbiClass::CalleeSaved.
Sourcefn is_special(&self) -> bool
fn is_special(&self) -> bool
Check if this register is special-purpose.
Convenience method equivalent to self.abi_class() == AbiClass::Special.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.