[llvm] r245519 - MIR Printer: Extract the code that prints IR slots to a separate function. NFC.

Alex Lorenz via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 16:24:37 PDT 2015


Author: arphaman
Date: Wed Aug 19 18:24:37 2015
New Revision: 245519

URL: http://llvm.org/viewvc/llvm-project?rev=245519&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/MIRPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=245519&r1=245518&r2=245519&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Wed Aug 19 18:24:37 2015
@@ -581,6 +581,13 @@ void MIPrinter::printMBBReference(const
   }
 }
 
+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(co
     CustomMST.incorporateFunction(*F);
     Slot = CustomMST.getLocalSlot(&BB);
   }
-  if (Slot == -1)
-    OS << "<badref>";
-  else
-    OS << Slot;
+  printIRSlotNumber(OS, Slot);
 }
 
 void MIPrinter::printIRValueReference(const Value &V) {




More information about the llvm-commits mailing list