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 | a602bebb61f6fec2b155c65028c5e6cd3872c144 (patch) | |
| tree | 124b1e248f48493e6a51ca3b4bd51bf908f5e6a7 /llvm/lib/CodeGen | |
| parent | 95a312b2e9b6bdee918f7f0deb06773ac6b70122 (diff) | |
| download | bcm5719-llvm-a602bebb61f6fec2b155c65028c5e6cd3872c144.tar.gz bcm5719-llvm-a602bebb61f6fec2b155c65028c5e6cd3872c144.zip | |
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.
llvm-svn: 81652
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 3e8c9131e01..64947e824b8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/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) { |

