pub struct ClassInfo {
pub name: &'static str,
pub bits: u32,
pub regs: &'static [&'static str],
pub allocatable: bool,
}Expand description
One class of registers, and the registers in it.
Fields§
§name: &'static strWhat the class is called in a dump, such as gpr.
bits: u32How wide one of its registers is, in bits.
regs: &'static [&'static str]The registers, in the order their numbers run, without the sigil a dump writes.
allocatable: boolWhether the allocator may put a value in one of these.
True for every class a target means the allocator to use, which is nearly all of them. False says the registers exist and are named and are not somewhere a value may be told to live, so a virtual register of this class is a mistake at the point it was made rather than a value the allocator has nowhere to put.
The x87 stack is the case this exists for, and it is worth the sentence because it is not
the usual reason a register is unavailable. rsp is unavailable because it has a job;
st0 is unavailable because the machine addresses it as a stack, so which register a name
means depends on how many values are on the stack at the time, and an allocator that hands
out a name has no way to say that. So nothing allocates from it, an eighty bit value lives
in a stack slot between one operation and the next, and the stack is empty on both sides of
every group of instructions that uses it. See spec/10-backend.md section 10.8, which says
what a group is and why nothing the allocator inserts can get into the middle of one, and
tamnd/rucc#540.
A register in such a class can still be named, which is the whole reason the class is
described at all: a long double comes back from a call in st0 and the convention has to
be able to say so.