[llvm-commits] [llvm] r81503 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Chris Lattner
sabre at nondot.org
Thu Sep 10 21:36:44 PDT 2009
Author: lattner
Date: Thu Sep 10 23:36:43 2009
New Revision: 81503
URL: http://llvm.org/viewvc/llvm-project?rev=81503&view=rev
Log:
convert X86ATTAsmPrinter::GetExternalSymbolSymbol to use SmallString
instead of std::string and Mangler.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=81503&r1=81502&r2=81503&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Thu Sep 10 23:36:43 2009
@@ -92,9 +92,9 @@
}
MCSymbol *X86ATTAsmPrinter::GetExternalSymbolSymbol(const MachineOperand &MO) {
- std::string Name = Mang->makeNameProper(MO.getSymbolName());
- if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB)
- Name += "$stub";
+ SmallString<256> Name;
+ Name += MAI->getGlobalPrefix();
+ Name += MO.getSymbolName();
switch (MO.getTargetFlags()) {
default: llvm_unreachable("Unknown target flag on GV operand");
@@ -102,12 +102,16 @@
case X86II::MO_GOT_ABSOLUTE_ADDRESS: // Doesn't modify symbol name.
case X86II::MO_PIC_BASE_OFFSET: // Doesn't modify symbol name.
break;
- case X86II::MO_DLLIMPORT:
+ case X86II::MO_DLLIMPORT: {
// Handle dllimport linkage.
- Name = "__imp_" + Name;
+ const char *Prefix = "__imp_";
+ Name.insert(Name.begin(), Prefix, Prefix+strlen(Prefix));
break;
+ }
case X86II::MO_DARWIN_STUB:
- FnStubs[Name] = Mang->makeNameProper(MO.getSymbolName());
+ // Insert: FnStub["_foo$stub"] = "_foo";
+ Name += "$stub";
+ FnStubs[Name.str()] = StringRef(Name.data(), Name.size()-5);
break;
// FIXME: These probably should be a modifier on the symbol or something??
case X86II::MO_TLSGD: Name += "@TLSGD"; break;
@@ -121,7 +125,7 @@
case X86II::MO_PLT: Name += "@PLT"; break;
}
- return OutContext.GetOrCreateSymbol(Name);
+ return OutContext.GetOrCreateSymbol(Name.str());
}
MCSymbol *X86ATTAsmPrinter::GetJumpTableSymbol(const MachineOperand &MO) {
More information about the llvm-commits
mailing list