diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-06-30 18:00:16 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-06-30 18:00:16 +0000 |
| commit | 5d26fa835d67b9e9344ee9459f3d4ba1589a5295 (patch) | |
| tree | 9f8a1269ecb34faf572d528ae3afda072967f385 /llvm/lib | |
| parent | 0fd7c621efaabecd93de194ca56604ede8f75bdc (diff) | |
| download | bcm5719-llvm-5d26fa835d67b9e9344ee9459f3d4ba1589a5295.tar.gz bcm5719-llvm-5d26fa835d67b9e9344ee9459f3d4ba1589a5295.zip | |
MIR Printer: extract the code that prints MBB references into a new method. NFC.
This commit enables the MIR printer to reuse the code that prints MBB
references.
llvm-svn: 241087
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index de747783468..18c976bcd3e 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -61,6 +61,7 @@ public: : M(M), OS(OS), RegisterMaskIds(RegisterMaskIds) {} void print(const MachineInstr &MI); + void printMBBReference(const MachineBasicBlock &MBB); void print(const MachineOperand &Op, const TargetRegisterInfo *TRI); }; @@ -193,6 +194,14 @@ static void printReg(unsigned Reg, raw_ostream &OS, llvm_unreachable("Can't print this kind of register yet"); } +void MIPrinter::printMBBReference(const MachineBasicBlock &MBB) { + OS << "%bb." << MBB.getNumber(); + if (const auto *BB = MBB.getBasicBlock()) { + if (BB->hasName()) + OS << '.' << BB->getName(); + } +} + void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI) { switch (Op.getType()) { case MachineOperand::MO_Register: @@ -204,11 +213,7 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI) { OS << Op.getImm(); break; case MachineOperand::MO_MachineBasicBlock: - OS << "%bb." << Op.getMBB()->getNumber(); - if (const auto *BB = Op.getMBB()->getBasicBlock()) { - if (BB->hasName()) - OS << '.' << BB->getName(); - } + printMBBReference(*Op.getMBB()); break; case MachineOperand::MO_GlobalAddress: // FIXME: Make this faster - print as operand will create a slot tracker to |

