Implement legalize_signature for RISC-V.
Add an abi module with code that is probably useful to all ISAs when implementing this function. Add a unit() method to RegClassData which can be used to index the register units in a class.
This commit is contained in:
@@ -108,6 +108,9 @@ pub struct RegClassData {
|
||||
/// How many register units to allocate per register.
|
||||
pub width: u8,
|
||||
|
||||
/// The first register unit in this class.
|
||||
pub first: RegUnit,
|
||||
|
||||
/// Bit-mask of sub-classes of this register class, including itself.
|
||||
///
|
||||
/// Bits correspond to RC indexes.
|
||||
@@ -142,6 +145,12 @@ impl RegClassData {
|
||||
pub fn has_subclass<RCI: Into<RegClassIndex>>(&self, other: RCI) -> bool {
|
||||
self.subclasses & (1 << other.into().0) != 0
|
||||
}
|
||||
|
||||
/// Get a specific register unit in this class.
|
||||
pub fn unit(&self, offset: usize) -> RegUnit {
|
||||
let uoffset = offset * self.width as usize;
|
||||
self.first + uoffset as RegUnit
|
||||
}
|
||||
}
|
||||
|
||||
/// A small reference to a register class.
|
||||
|
||||
Reference in New Issue
Block a user