move gettemplabel and getdwlabel to AsmPrinter and rename
them for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100345 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 62207f2..5c63cf2 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -962,9 +962,7 @@
}
// Otherwise, emit with .set (aka assignment).
- MCSymbol *SetLabel =
- OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) +
- "set" + Twine(SetCounter++));
+ MCSymbol *SetLabel = GetTempSymbol("set", SetCounter++);
OutStreamer.EmitAssignment(SetLabel, Diff);
OutStreamer.EmitSymbolValue(SetLabel, Size, 0/*AddrSpace*/);
}
@@ -1345,6 +1343,29 @@
OS << Offset;
}
+//===----------------------------------------------------------------------===//
+// Symbol Lowering Routines.
+//===----------------------------------------------------------------------===//
+
+/// GetTempSymbol - Return the MCSymbol corresponding to the assembler
+/// temporary label with the specified stem and unique ID.
+MCSymbol *AsmPrinter::GetTempSymbol(StringRef Name, unsigned ID) const {
+ // FIXME: REMOVE this. However, there is stuff in EH that passes counters in
+ // here that can be zero.
+
+ //assert(ID && "Should use GetTempSymbol if no ID");
+ if (ID == 0) return GetTempSymbol(Name);
+ return OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix())+
+ Name + Twine(ID));
+}
+
+/// GetTempSymbol - Return an assembler temporary label with the specified
+/// stem.
+MCSymbol *AsmPrinter::GetTempSymbol(StringRef Name) const {
+ return OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix())+
+ Name);
+}
+
MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const {
return MMI->getAddrLabelSymbol(BA->getBasicBlock());