Skip to content

Commit

Permalink
MIR Printer: Extract the code that prints IR slots to a separate func…
Browse files Browse the repository at this point in the history
…tion. NFC.

This code can be reused when printing references to unnamed local IR values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245519 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
hyp committed Aug 19, 2015
1 parent 1168321 commit 56e5839
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/CodeGen/MIRPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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) {
Expand Down

0 comments on commit 56e5839

Please sign in to comment.