From 56e58395742c8bc32231689a82bf91cd431434ef Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Wed, 19 Aug 2015 23:24:37 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245519 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MIRPrinter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/MIRPrinter.cpp b/lib/CodeGen/MIRPrinter.cpp index 759a8d3234d..df2f441a031 100644 --- a/lib/CodeGen/MIRPrinter.cpp +++ b/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 << ""; + 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 << ""; - else - OS << Slot; + printIRSlotNumber(OS, Slot); } void MIPrinter::printIRValueReference(const Value &V) { -- 2.34.1