diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-04-23 23:34:05 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-04-23 23:34:05 +0000 |
commit | 0bad85de10d5415395cb627c5981e1a7b7346de7 (patch) | |
tree | 687f7bba9c6e584082215901c75610507afbed39 /llvm/lib | |
parent | 50474bf5d2356feab24d985cac3ea91f856df59b (diff) | |
download | bcm5719-llvm-0bad85de10d5415395cb627c5981e1a7b7346de7.tar.gz bcm5719-llvm-0bad85de10d5415395cb627c5981e1a7b7346de7.zip |
MC: Allow targets to stop symbol name quoting
Currently symbol names are printed in quotes if it contains something
outside of the arbitrary set of characters that isAcceptableChar tests
for. On somem targets, it is never OK to print a symbol name in quotes
so allow targets to opt out of this behavior.
llvm-svn: 235670
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCAsmInfo.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/MC/MCSymbol.cpp | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCAsmInfo.cpp b/llvm/lib/MC/MCAsmInfo.cpp index bad257a961b..f2d3b2a1855 100644 --- a/llvm/lib/MC/MCAsmInfo.cpp +++ b/llvm/lib/MC/MCAsmInfo.cpp @@ -50,6 +50,7 @@ MCAsmInfo::MCAsmInfo() { Code64Directive = ".code64"; AssemblerDialect = 0; AllowAtInName = false; + NoSymbolNameQuoting = false; UseDataRegionDirectives = false; ZeroDirective = "\t.zero\t"; AsciiDirective = "\t.ascii\t"; diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 5f8e3c11de3..a43bdc7bfa2 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -125,7 +125,8 @@ MCSymbol *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) { } auto NameIter = UsedNames.insert(std::make_pair(Name, true)).first; - Sym = new (*this) MCSymbol(NameIter->getKey(), /*isTemporary*/ false); + Sym = new (*this) MCSymbol(NameIter->getKey(), /*isTemporary*/ false, + MAI->noSymbolNameQuoting()); if (!OldSym) OldSym = Sym; @@ -163,7 +164,8 @@ MCSymbol *MCContext::CreateSymbol(StringRef Name, bool AlwaysAddSuffix) { // Ok, we found a name. Have the MCSymbol object itself refer to the copy // of the string that is embedded in the UsedNames entry. MCSymbol *Result = - new (*this) MCSymbol(NameEntry.first->getKey(), IsTemporary); + new (*this) MCSymbol(NameEntry.first->getKey(), IsTemporary, + MAI->noSymbolNameQuoting()); return Result; } assert(IsTemporary && "Cannot rename non-temporary symbols"); diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp index ccb9f8def9e..346a9260709 100644 --- a/llvm/lib/MC/MCSymbol.cpp +++ b/llvm/lib/MC/MCSymbol.cpp @@ -51,7 +51,7 @@ void MCSymbol::print(raw_ostream &OS) const { // some targets support quoting names with funny characters. If the name // contains a funny character, then print it quoted. StringRef Name = getName(); - if (!NameNeedsQuoting(Name)) { + if (NoQuoting || !NameNeedsQuoting(Name)) { OS << Name; return; } |