pub struct ClassInfo { /* private fields */ }Expand description
A register class: its members, the members an allocator may hand out, and the size and alignment of a spill slot for one of its values.
§Examples
use backend_lang::x86_64::{self, GPR, RSP};
let gpr = x86_64::TARGET.class(GPR);
assert!(gpr.regs().contains(RSP));
assert!(!gpr.allocatable().contains(RSP));
assert_eq!((gpr.spill_size(), gpr.spill_align()), (8, 8));Implementations§
Source§impl ClassInfo
impl ClassInfo
Sourcepub const fn new(
name: &'static str,
regs: RegSet,
allocatable: RegSet,
spill_size: u32,
spill_align: u32,
) -> ClassInfo
pub const fn new( name: &'static str, regs: RegSet, allocatable: RegSet, spill_size: u32, spill_align: u32, ) -> ClassInfo
Describes a class named name with members regs, of which
allocatable may be handed out by an allocator, spilled to slots of
spill_size bytes aligned to spill_align.
§Examples
use backend_lang::RegSet;
use backend_lang::target::ClassInfo;
let c = ClassInfo::new("int", RegSet::EMPTY, RegSet::EMPTY, 8, 8);
assert_eq!(c.name(), "int");Sourcepub const fn name(&self) -> &'static str
pub const fn name(&self) -> &'static str
The class’s name, as the MIR printer writes it.
§Examples
use backend_lang::x86_64::{self, VEC};
assert_eq!(x86_64::TARGET.class(VEC).name(), "vec");Sourcepub const fn regs(&self) -> RegSet
pub const fn regs(&self) -> RegSet
Every register of the class.
§Examples
use backend_lang::x86_64::{self, VEC};
assert_eq!(x86_64::TARGET.class(VEC).regs().len(), 16);Sourcepub const fn allocatable(&self) -> RegSet
pub const fn allocatable(&self) -> RegSet
The registers an allocator may assign: the class minus the stack
pointer and the frame pointer. (Without a frame pointer the frame
pointer register is allocatable too; see
Function::omit_frame_pointer.)
§Examples
use backend_lang::x86_64::{self, GPR, RBP};
let gpr = x86_64::TARGET.class(GPR);
assert_eq!(gpr.allocatable().len(), 14);
assert!(!gpr.allocatable().contains(RBP));Sourcepub const fn spill_size(&self) -> u32
pub const fn spill_size(&self) -> u32
Bytes in a spill slot for one value of the class.
§Examples
use backend_lang::x86_64::{self, VEC};
assert_eq!(x86_64::TARGET.class(VEC).spill_size(), 16);Sourcepub const fn spill_align(&self) -> u32
pub const fn spill_align(&self) -> u32
Required alignment of a spill slot for the class.
§Examples
use backend_lang::x86_64::{self, VEC};
assert_eq!(x86_64::TARGET.class(VEC).spill_align(), 16);Trait Implementations§
impl Copy for ClassInfo
impl Eq for ClassInfo
impl StructuralPartialEq for ClassInfo
Auto Trait Implementations§
impl Freeze for ClassInfo
impl RefUnwindSafe for ClassInfo
impl Send for ClassInfo
impl Sync for ClassInfo
impl Unpin for ClassInfo
impl UnsafeUnpin for ClassInfo
impl UnwindSafe for ClassInfo
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