Give register classes a name.
This is just for better error messages etc.
This commit is contained in:
@@ -33,8 +33,8 @@ def gen_regclass(rc, fmt):
|
|||||||
"""
|
"""
|
||||||
Emit a static data definition for a register class.
|
Emit a static data definition for a register class.
|
||||||
"""
|
"""
|
||||||
fmt.comment(rc.name)
|
|
||||||
with fmt.indented('RegClassData {', '},'):
|
with fmt.indented('RegClassData {', '},'):
|
||||||
|
fmt.line('name: "{}",'.format(rc.name))
|
||||||
fmt.line('index: {},'.format(rc.index))
|
fmt.line('index: {},'.format(rc.index))
|
||||||
fmt.line('width: {},'.format(rc.width))
|
fmt.line('width: {},'.format(rc.width))
|
||||||
fmt.line('subclasses: 0x{:x},'.format(rc.subclass_mask()))
|
fmt.line('subclasses: 0x{:x},'.format(rc.subclass_mask()))
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ pub type RegClass = &'static RegClassData;
|
|||||||
/// A register class can be a subset of another register class. The top-level register classes are
|
/// A register class can be a subset of another register class. The top-level register classes are
|
||||||
/// disjoint.
|
/// disjoint.
|
||||||
pub struct RegClassData {
|
pub struct RegClassData {
|
||||||
|
/// The name of the register class.
|
||||||
|
pub name: &'static str,
|
||||||
|
|
||||||
/// The index of this class in the ISA's RegInfo description.
|
/// The index of this class in the ISA's RegInfo description.
|
||||||
pub index: u8,
|
pub index: u8,
|
||||||
|
|
||||||
|
|||||||
@@ -118,12 +118,14 @@ mod tests {
|
|||||||
|
|
||||||
// Register classes for testing.
|
// Register classes for testing.
|
||||||
const GPR: RegClass = &RegClassData {
|
const GPR: RegClass = &RegClassData {
|
||||||
|
name: "GPR",
|
||||||
index: 0,
|
index: 0,
|
||||||
width: 1,
|
width: 1,
|
||||||
subclasses: 0,
|
subclasses: 0,
|
||||||
mask: [0xf0000000, 0x0000000f, 0],
|
mask: [0xf0000000, 0x0000000f, 0],
|
||||||
};
|
};
|
||||||
const DPR: RegClass = &RegClassData {
|
const DPR: RegClass = &RegClassData {
|
||||||
|
name: "DPR",
|
||||||
index: 0,
|
index: 0,
|
||||||
width: 2,
|
width: 2,
|
||||||
subclasses: 0,
|
subclasses: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user