diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-12 23:02:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-12 23:02:08 +0000 |
commit | 7cb384dcca3f1ccfc993182ee4b972f7fffc8ffa (patch) | |
tree | e3202f7ce4416713cc41a6c9dd51da7e581a9029 /lib | |
parent | deb8c1547e4410026a77d839ef75b6daeb0339db (diff) |
devirtualize AsmPrinter::printBasicBlockLabel since it is never overridden.
Move GetMBBSymbol up to AsmPrinter and make printBasicBlockLabel use it so that
we only have one place that decides what to name bb labels. Hopefully various
clients of printBasicBlockLabel can start using GetMBBSymbol instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 14 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86MCInstLower.cpp | 11 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86MCInstLower.h | 1 |
3 files changed, 13 insertions, 13 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 3e8c9131e0..64947e824b 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -28,6 +28,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" @@ -1634,6 +1635,15 @@ bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, return true; } +MCSymbol *AsmPrinter::GetMBBSymbol(unsigned MBBID) const { + SmallString<60> Name; + raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "BB" + << getFunctionNumber() << '_' << MBBID; + + return OutContext.GetOrCreateSymbol(Name.str()); +} + + /// printBasicBlockLabel - This method prints the label for the specified /// MachineBasicBlock void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB, @@ -1646,8 +1656,8 @@ void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB, EmitAlignment(Log2_32(Align)); } - O << MAI->getPrivateGlobalPrefix() << "BB" << getFunctionNumber() << '_' - << MBB->getNumber(); + GetMBBSymbol(MBB->getNumber())->print(O, MAI); + if (printColon) O << ':'; if (printComment) { diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index 023882ce5d..9e8fb5a733 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -45,15 +45,6 @@ MCSymbol *X86MCInstLower::GetPICBaseSymbol() const { return Ctx.GetOrCreateSymbol(Name.str()); } -MCSymbol *X86MCInstLower::GetMBBSymbol(unsigned MBBID) const { - SmallString<60> Name; - raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "BB" - << AsmPrinter.getFunctionNumber() << '_' << MBBID; - - return Ctx.GetOrCreateSymbol(Name.str()); -} - - /// LowerGlobalAddressOperand - Lower an MO_GlobalAddress operand to an /// MCOperand. @@ -320,7 +311,7 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { break; case MachineOperand::MO_MachineBasicBlock: MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create( - GetMBBSymbol(MO.getMBB()->getNumber()), Ctx)); + AsmPrinter.GetMBBSymbol(MO.getMBB()->getNumber()), Ctx)); break; case MachineOperand::MO_GlobalAddress: MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO)); diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.h b/lib/Target/X86/AsmPrinter/X86MCInstLower.h index 3329b90cda..bf529fd44e 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.h +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.h @@ -36,7 +36,6 @@ public: MCSymbol *GetPICBaseSymbol() const; - MCSymbol *GetMBBSymbol(unsigned MBBID) const; MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const; |