pub struct RegFile { /* private fields */ }Expand description
Every register a target has.
Implementations§
Source§impl RegFile
impl RegFile
Sourcepub const fn new(classes: &'static [ClassInfo]) -> Self
pub const fn new(classes: &'static [ClassInfo]) -> Self
A file made of those classes, numbered in the order they are given.
Sourcepub fn classes(
&self,
) -> impl Iterator<Item = (RegClass, &'static ClassInfo)> + use<>
pub fn classes( &self, ) -> impl Iterator<Item = (RegClass, &'static ClassInfo)> + use<>
Its classes, each with the number it is known by.
Sourcepub fn class_named(&self, name: &str) -> Option<RegClass>
pub fn class_named(&self, name: &str) -> Option<RegClass>
The class of that name, such as gpr.
Sourcepub fn len(&self, class: RegClass) -> usize
pub fn len(&self, class: RegClass) -> usize
How many registers are in a class, which is one past the largest number in it.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the file has no classes at all, which is a target that has not described one.
Sourcepub fn name(&self, class: RegClass, reg: PhysReg) -> Option<&'static str>
pub fn name(&self, class: RegClass, reg: PhysReg) -> Option<&'static str>
What one register is called.
Sourcepub fn reg_named(&self, name: &str) -> Option<(RegClass, PhysReg)>
pub fn reg_named(&self, name: &str) -> Option<(RegClass, PhysReg)>
The register of that name, and the class it is in.
The name is written without the sigil, so rax rather than $rax.
Sourcepub fn duplicate(&self) -> Option<&'static str>
pub fn duplicate(&self) -> Option<&'static str>
A name this file gives to two registers, if it gives one to two.
Reading a dump back needs every name to say which register it means, and a target that breaks that produces text that cannot be parsed rather than an error at the point of the mistake. So every target’s own test asks this, which is why it is here and public.