summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-19 23:24:37 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-19 23:24:37 +0000
commit55dc6f8165a604f5950d8ca6001e6751f7a0aea5 (patch)
treebae4b5091228ec0cac5cf44b0cabee079d4e9c70 /llvm/lib/CodeGen
parentc7aaacde670e455dfae518e6f52c2252cad9bab2 (diff)
downloadbcm5719-llvm-55dc6f8165a604f5950d8ca6001e6751f7a0aea5.tar.gz
bcm5719-llvm-55dc6f8165a604f5950d8ca6001e6751f7a0aea5.zip
MIR Printer: Extract the code that prints IR slots to a separate function. NFC.
This code can be reused when printing references to unnamed local IR values. llvm-svn: 245519
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 759a8d3234d..df2f441a031 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -581,6 +581,13 @@ void MIPrinter::printMBBReference(const MachineBasicBlock &MBB) {
}
}
+static void printIRSlotNumber(raw_ostream &OS, int Slot) {
+ if (Slot == -1)
+ OS << "<badref>";
+ else
+ OS << Slot;
+}
+
void MIPrinter::printIRBlockReference(const BasicBlock &BB) {
OS << "%ir-block.";
if (BB.hasName()) {
@@ -597,10 +604,7 @@ void MIPrinter::printIRBlockReference(const BasicBlock &BB) {
CustomMST.incorporateFunction(*F);
Slot = CustomMST.getLocalSlot(&BB);
}
- if (Slot == -1)
- OS << "<badref>";
- else
- OS << Slot;
+ printIRSlotNumber(OS, Slot);
}
void MIPrinter::printIRValueReference(const Value &V) {
OpenPOWER on IntegriCloud