Rip out the 'is temporary' nonsense from the MCContext interface to
create symbols. It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.
This fixes rdar://7807601.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99902 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 37e8282..e02cbc7 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -23,9 +23,12 @@
// we don't need to free them here.
}
-MCSymbol *MCContext::GetOrCreateSymbol(StringRef Name, bool isTemporary) {
+MCSymbol *MCContext::GetOrCreateSymbol(StringRef Name) {
assert(!Name.empty() && "Normal symbols cannot be unnamed!");
+ // Determine whether this is an assembler temporary or normal label.
+ bool isTemporary = Name.startswith(MAI.getPrivateGlobalPrefix());
+
// Do the lookup and get the entire StringMapEntry. We want access to the
// key if we are creating the entry.
StringMapEntry<MCSymbol*> &Entry = Symbols.GetOrCreateValue(Name);
@@ -38,24 +41,17 @@
return Result;
}
-MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name, bool isTemporary) {
+MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) {
SmallString<128> NameSV;
Name.toVector(NameSV);
- return GetOrCreateSymbol(NameSV.str(), isTemporary);
+ return GetOrCreateSymbol(NameSV.str());
}
MCSymbol *MCContext::CreateTempSymbol() {
- return GetOrCreateTemporarySymbol(Twine(MAI.getPrivateGlobalPrefix()) +
- "tmp" + Twine(NextUniqueID++));
+ return GetOrCreateSymbol(Twine(MAI.getPrivateGlobalPrefix()) +
+ "tmp" + Twine(NextUniqueID++));
}
-MCSymbol *MCContext::GetOrCreateTemporarySymbol(const Twine &Name) {
- SmallString<128> NameSV;
- Name.toVector(NameSV);
- return GetOrCreateTemporarySymbol(NameSV.str());
-}
-
-
MCSymbol *MCContext::LookupSymbol(StringRef Name) const {
return Symbols.lookup(Name);
}
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp
index 8ff24d9..bc670ab 100644
--- a/lib/MC/MCExpr.cpp
+++ b/lib/MC/MCExpr.cpp
@@ -154,12 +154,6 @@
return Create(Ctx.GetOrCreateSymbol(Name), Kind, Ctx);
}
-const MCSymbolRefExpr *MCSymbolRefExpr::CreateTemp(StringRef Name,
- VariantKind Kind,
- MCContext &Ctx) {
- return Create(Ctx.GetOrCreateTemporarySymbol(Name), Kind, Ctx);
-}
-
StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
switch (Kind) {
default:
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 4ec5247..24616b4 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -238,9 +238,7 @@
}
MCSymbol *AsmParser::CreateSymbol(StringRef Name) {
- // If the label starts with L it is an assembler temporary label.
- if (Name.startswith("L"))
- return Ctx.GetOrCreateTemporarySymbol(Name);
+ // FIXME: Inline into callers.
return Ctx.GetOrCreateSymbol(Name);
}