summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/CodeGen/MachineOperandTest.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-13 10:30:59 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-13 10:30:59 +0000
commitb41dbbe32582dcfe18e6ea763886fabf5fd7c84d (patch)
tree5c8b1ce5df3a97533818dcd4d340c1ee09265c13 /llvm/unittests/CodeGen/MachineOperandTest.cpp
parentb3a0d513749623b8ee51183c127be74350052426 (diff)
downloadbcm5719-llvm-b41dbbe32582dcfe18e6ea763886fabf5fd7c84d.tar.gz
bcm5719-llvm-b41dbbe32582dcfe18e6ea763886fabf5fd7c84d.zip
[CodeGen] Print jump-table index operands as %jump-table.0 in both MIR and debug output
Work towards the unification of MIR and debug output by printing `%jump-table.0` instead of `<jt#0>`. Only debug syntax is affected. llvm-svn: 320566
Diffstat (limited to 'llvm/unittests/CodeGen/MachineOperandTest.cpp')
-rw-r--r--llvm/unittests/CodeGen/MachineOperandTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/unittests/CodeGen/MachineOperandTest.cpp b/llvm/unittests/CodeGen/MachineOperandTest.cpp
index 46f50ab0151..aed60c0a3d6 100644
--- a/llvm/unittests/CodeGen/MachineOperandTest.cpp
+++ b/llvm/unittests/CodeGen/MachineOperandTest.cpp
@@ -181,4 +181,20 @@ TEST(MachineOperandTest, PrintTargetIndexName) {
}
}
+TEST(MachineOperandTest, PrintJumpTableIndex) {
+ // Create a MachineOperand with a jump-table index and print it.
+ MachineOperand MO = MachineOperand::CreateJTI(3);
+
+ // Checking some preconditions on the newly created
+ // MachineOperand.
+ ASSERT_TRUE(MO.isJTI());
+ ASSERT_TRUE(MO.getIndex() == 3);
+
+ // Print a MachineOperand containing a jump-table index.
+ std::string str;
+ raw_string_ostream OS(str);
+ MO.print(OS, /*TRI=*/nullptr, /*IntrinsicInfo=*/nullptr);
+ ASSERT_TRUE(OS.str() == "%jump-table.3");
+}
+
} // end namespace
OpenPOWER on IntegriCloud