diff options
Diffstat (limited to 'llvm/unittests/CodeGen/MachineOperandTest.cpp')
-rw-r--r-- | llvm/unittests/CodeGen/MachineOperandTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/unittests/CodeGen/MachineOperandTest.cpp b/llvm/unittests/CodeGen/MachineOperandTest.cpp index 96498e681ed..5c13ddc4b8c 100644 --- a/llvm/unittests/CodeGen/MachineOperandTest.cpp +++ b/llvm/unittests/CodeGen/MachineOperandTest.cpp @@ -272,4 +272,21 @@ TEST(MachineOperandTest, PrintGlobalAddress) { } } +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 |