[llvm-commits] [llvm] r81514 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86MCInstLower.cpp
Chris Lattner
sabre at nondot.org
Fri Sep 11 00:03:21 PDT 2009
Author: lattner
Date: Fri Sep 11 02:03:20 2009
New Revision: 81514
URL: http://llvm.org/viewvc/llvm-project?rev=81514&view=rev
Log:
switch HiddenGVStubs to be a DenseMap instead of a string map, mirroring FnStubs and GVStubs.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=81514&r1=81513&r2=81514&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Sep 11 02:03:20 2009
@@ -330,7 +330,16 @@
StubSym = OutContext.GetOrCreateSymbol(NameStr.str());
}
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
- HiddenGVStubs[Name] = Mang->getMangledName(GV);
+ SmallString<128> NameStr;
+ Mang->getNameWithPrefix(NameStr, GV, true);
+ NameStr += "$non_lazy_ptr";
+ MCSymbol *Sym = OutContext.GetOrCreateSymbol(NameStr.str());
+ MCSymbol *&StubSym = HiddenGVStubs[Sym];
+ if (StubSym == 0) {
+ NameStr.clear();
+ Mang->getNameWithPrefix(NameStr, GV, false);
+ StubSym = OutContext.GetOrCreateSymbol(NameStr.str());
+ }
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
SmallString<128> NameStr;
Mang->getNameWithPrefix(NameStr, GV, true);
@@ -949,10 +958,13 @@
if (!HiddenGVStubs.empty()) {
OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(2);
- for (StringMap<std::string>::iterator I = HiddenGVStubs.begin(),
- E = HiddenGVStubs.end(); I != E; ++I)
- O << I->getKeyData() << ":\n" << MAI->getData32bitsDirective()
- << I->second << '\n';
+ for (DenseMap<MCSymbol*, MCSymbol*>::iterator I = HiddenGVStubs.begin(),
+ E = HiddenGVStubs.end(); I != E; ++I) {
+ I->first->print(O, MAI);
+ O << ":\n" << MAI->getData32bitsDirective();
+ I->second->print(O, MAI);
+ O << '\n';
+ }
}
// Funny Darwin hack: This flag tells the linker that no global symbols
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=81514&r1=81513&r2=81514&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Fri Sep 11 02:03:20 2009
@@ -215,10 +215,10 @@
void emitFunctionHeader(const MachineFunction &MF);
- // Necessary for Darwin to print out the apprioriate types of linker stubs
- StringMap<std::string> HiddenGVStubs;
+ // Necessary for Darwin to print out the appropriate types of linker stubs.
DenseMap<MCSymbol*, MCSymbol*> FnStubs; // Darwin $stub stubs.
DenseMap<MCSymbol*, MCSymbol*> GVStubs; // Darwin $non_lazy_ptr stub.
+ DenseMap<MCSymbol*, MCSymbol*> HiddenGVStubs; // Darwin $non_lazy_ptr stub.
// Necessary for dllexport support
StringSet<> CygMingStubs, DLLExportedFns, DLLExportedGVs;
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=81514&r1=81513&r2=81514&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Fri Sep 11 02:03:20 2009
@@ -82,10 +82,17 @@
return Sym;
}
- case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
+ case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: {
Name += "$non_lazy_ptr";
- HiddenGVStubs[Name.str()] = StringRef(Name.data(), Name.size()-13);
+ MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str());
+ MCSymbol *&StubSym = HiddenGVStubs[Sym];
+ if (StubSym == 0) {
+ Name.clear();
+ Mang->getNameWithPrefix(Name, GV, false);
+ StubSym = OutContext.GetOrCreateSymbol(Name.str());
+ }
break;
+ }
case X86II::MO_DARWIN_STUB: {
Name += "$stub";
MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str());
More information about the llvm-commits
mailing list