Add an Affinity::display() method.

Make it possible to display affinities given a RegInfo reference.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-26 11:15:46 -07:00
parent a20ae9eade
commit 2f81fbdb77
2 changed files with 37 additions and 0 deletions

View File

@@ -153,6 +153,12 @@ impl RegClassData {
}
}
impl fmt::Display for RegClassData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.name)
}
}
/// A small reference to a register class.
///
/// Use this when storing register classes in compact data structures. The `RegInfo::rc()` method
@@ -176,6 +182,12 @@ impl From<RegClass> for RegClassIndex {
}
}
impl fmt::Display for RegClassIndex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "rci{}", self.0)
}
}
/// Information about the registers in an ISA.
///
/// The `RegUnit` data structure collects all relevant static information about the registers in an