[CodeGen] Print live-out register lists as liveout(...) in both MIR and debug output
Work towards the unification of MIR and debug output by printing
`liveout(...)` instead of `<regliveout>`.
Only debug syntax is affected.
llvm-svn: 320683
diff --git a/llvm/unittests/CodeGen/MachineOperandTest.cpp b/llvm/unittests/CodeGen/MachineOperandTest.cpp
index 96498e6..5c13ddc 100644
--- a/llvm/unittests/CodeGen/MachineOperandTest.cpp
+++ b/llvm/unittests/CodeGen/MachineOperandTest.cpp
@@ -272,4 +272,21 @@
}
}
+TEST(MachineOperandTest, PrintRegisterLiveOut) {
+ // Create a MachineOperand with a register live out list and print it.
+ uint32_t Mask = 0;
+ MachineOperand MO = MachineOperand::CreateRegLiveOut(&Mask);
+
+ // Checking some preconditions on the newly created
+ // MachineOperand.
+ ASSERT_TRUE(MO.isRegLiveOut());
+ ASSERT_TRUE(MO.getRegLiveOut() == &Mask);
+
+ std::string str;
+ // Print a MachineOperand containing a register live out list without a TRI.
+ raw_string_ostream OS(str);
+ MO.print(OS, /*TRI=*/nullptr, /*IntrinsicInfo=*/nullptr);
+ ASSERT_TRUE(OS.str() == "liveout(<unknown>)");
+}
+
} // end namespace