summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-03-17 20:07:06 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-03-17 20:07:06 +0000
commit9ab09237dcfedb123340676d75e59821dac35513 (patch)
tree435f70f63ffcd0c9e9232b6fd186f46aec16461e /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parent0641ca1a2dc2d4923ee702651aab2a9704d563b5 (diff)
downloadbcm5719-llvm-9ab09237dcfedb123340676d75e59821dac35513.tar.gz
bcm5719-llvm-9ab09237dcfedb123340676d75e59821dac35513.zip
Centralize the handling of unique ids for temporary labels.
Before this patch code wanting to create temporary labels for a given entity (function, cu, exception range, etc) had to keep its own counter to have stable symbol names. createTempSymbol would still add a suffix to make sure a new symbol was always returned, but it kept a single counter. Because of that, if we were to use just createTempSymbol("cu_begin"), the label could change from cu_begin42 to cu_begin43 because some other code started using temporary labels. Simplify this by just keeping one counter per prefix and removing the various specialized counters. llvm-svn: 232535
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index c5075273f13..7de5e4f10f1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -103,7 +103,7 @@ static unsigned getGVAlignmentLog2(const GlobalValue *GV, const DataLayout &DL,
AsmPrinter::AsmPrinter(TargetMachine &tm, std::unique_ptr<MCStreamer> Streamer)
: MachineFunctionPass(ID), TM(tm), MAI(tm.getMCAsmInfo()),
OutContext(Streamer->getContext()), OutStreamer(*Streamer.release()),
- LastMI(nullptr), LastFn(0), Counter(~0U), SetCounter(0) {
+ LastMI(nullptr), LastFn(0), Counter(~0U) {
DD = nullptr;
MMI = nullptr;
LI = nullptr;
@@ -890,7 +890,7 @@ void AsmPrinter::EmitFunctionBody() {
if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||
MAI->hasDotTypeDotSizeDirective()) {
// Create a symbol for the end of function.
- CurrentFnEnd = createTempSymbol("func_end", getFunctionNumber());
+ CurrentFnEnd = createTempSymbol("func_end");
OutStreamer.EmitLabel(CurrentFnEnd);
}
@@ -1133,7 +1133,7 @@ bool AsmPrinter::doFinalization(Module &M) {
MCSymbol *AsmPrinter::getCurExceptionSym() {
if (!CurExceptionSym)
- CurExceptionSym = createTempSymbol("exception", getFunctionNumber());
+ CurExceptionSym = createTempSymbol("exception");
return CurExceptionSym;
}
@@ -1147,7 +1147,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
bool NeedsLocalForSize = MAI->needsLocalForSize();
if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||
NeedsLocalForSize) {
- CurrentFnBegin = createTempSymbol("func_begin", getFunctionNumber());
+ CurrentFnBegin = createTempSymbol("func_begin");
if (NeedsLocalForSize)
CurrentFnSymForSize = CurrentFnBegin;
}
@@ -1577,7 +1577,7 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
}
// Otherwise, emit with .set (aka assignment).
- MCSymbol *SetLabel = createTempSymbol("set", SetCounter++);
+ MCSymbol *SetLabel = createTempSymbol("set");
OutStreamer.EmitAssignment(SetLabel, Diff);
OutStreamer.EmitSymbolValue(SetLabel, Size);
}
@@ -2252,8 +2252,8 @@ void AsmPrinter::printOffset(int64_t Offset, raw_ostream &OS) const {
// Symbol Lowering Routines.
//===----------------------------------------------------------------------===//
-MCSymbol *AsmPrinter::createTempSymbol(const Twine &Name, unsigned ID) const {
- return OutContext.createTempSymbol(Name + Twine(ID));
+MCSymbol *AsmPrinter::createTempSymbol(const Twine &Name) const {
+ return OutContext.createTempSymbol(Name, true);
}
MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const {
OpenPOWER on IntegriCloud