diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-19 16:51:52 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-19 16:51:52 +0000 |
commit | 874ae6faa546cc76644f89072fb6848cc7cf882d (patch) | |
tree | 3303335980e433fd796fb2dee4e8a51f3a7b9963 /llvm/unittests/CodeGen/MachineOperandTest.cpp | |
parent | 6f648df1b940ac707ac05390c236015c92f5996f (diff) | |
download | bcm5719-llvm-874ae6faa546cc76644f89072fb6848cc7cf882d.tar.gz bcm5719-llvm-874ae6faa546cc76644f89072fb6848cc7cf882d.zip |
[CodeGen] Move printing MO_CFIIndex operands to MachineOperand::print
Work towards the unification of MIR and debug output by refactoring the
interfaces.
Before this patch we printed "<call frame instruction>" in the debug
output.
llvm-svn: 321084
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 e51207b9571..fb43e10742b 100644 --- a/llvm/unittests/CodeGen/MachineOperandTest.cpp +++ b/llvm/unittests/CodeGen/MachineOperandTest.cpp @@ -336,4 +336,21 @@ TEST(MachineOperandTest, PrintMCSymbol) { ASSERT_TRUE(OS.str() == "<mcsymbol foo>"); } +TEST(MachineOperandTest, PrintCFI) { + // Create a MachineOperand with a CFI index but no function and print it. + MachineOperand MO = MachineOperand::CreateCFIIndex(8); + + // Checking some preconditions on the newly created + // MachineOperand. + ASSERT_TRUE(MO.isCFIIndex()); + ASSERT_TRUE(MO.getCFIIndex() == 8); + + std::string str; + // Print a MachineOperand containing a CFI Index node but no machine function + // attached to it. + raw_string_ostream OS(str); + MO.print(OS, /*TRI=*/nullptr, /*IntrinsicInfo=*/nullptr); + ASSERT_TRUE(OS.str() == "<cfi directive>"); +} + } // end namespace |