Debug output for Operands: omit default/most common positions.

This commit is contained in:
Chris Fallin
2021-08-12 14:49:42 -07:00
parent c071e44fc0
commit ffc06b2099

View File

@@ -403,11 +403,18 @@ impl std::fmt::Debug for Operand {
impl std::fmt::Display for Operand { impl std::fmt::Display for Operand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match (self.kind(), self.pos()) {
(OperandKind::Def, OperandPos::After)
| (OperandKind::Mod | OperandKind::Use, OperandPos::Before) => {
write!(f, "{:?}", self.kind())?;
}
_ => {
write!(f, "{:?}@{:?}", self.kind(), self.pos())?;
}
}
write!( write!(
f, f,
"{:?}@{:?}: {}{} {}", ": {}{} {}",
self.kind(),
self.pos(),
self.vreg(), self.vreg(),
match self.class() { match self.class() {
RegClass::Int => "i", RegClass::Int => "i",