[llvm-commits] [llvm] r93624 - /llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Fri Jan 15 18:09:06 PST 2010
Author: lattner
Date: Fri Jan 15 20:09:06 2010
New Revision: 93624
URL: http://llvm.org/viewvc/llvm-project?rev=93624&view=rev
Log:
more string -> sym, getMangledName is now gone from this file.
Modified:
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=93624&r1=93623&r2=93624&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Fri Jan 15 20:09:06 2010
@@ -95,7 +95,7 @@
};
DenseMap<const MCSymbol*, FnStubInfo> FnStubs;
- StringMap<const MCSymbol*> GVStubs, HiddenGVStubs, TOC;
+ DenseMap<const MCSymbol*, const MCSymbol*> GVStubs, HiddenGVStubs, TOC;
const PPCSubtarget &Subtarget;
uint64_t LabelID;
public:
@@ -333,17 +333,16 @@
assert(MO.getType() == MachineOperand::MO_GlobalAddress);
- GlobalValue *GV = MO.getGlobal();
-
- std::string Name = Mang->getMangledName(GV);
+ const MCSymbol *Sym = GetGlobalValueSymbol(MO.getGlobal());
// Map symbol -> label of TOC entry.
- if (TOC.count(Name) == 0)
- TOC[Name] = OutContext.
+ const MCSymbol *&TOCEntry = TOC[Sym];
+ if (TOCEntry == 0)
+ TOCEntry = OutContext.
GetOrCreateSymbol(StringRef(MAI->getPrivateGlobalPrefix()) + "C" +
Twine(LabelID++));
- TOC[Name]->print(O, MAI);
+ TOCEntry->print(O, MAI);
O << "@toc";
}
@@ -430,16 +429,16 @@
return;
case MachineOperand::MO_ExternalSymbol: {
// Computing the address of an external symbol, not calling it.
- std::string Name(MAI->getGlobalPrefix());
- Name += MO.getSymbolName();
-
- if (TM.getRelocationModel() != Reloc::Static) {
- GVStubs[Name] =
- OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
- MO.getSymbolName()+"$non_lazy_ptr");
- Name += "$non_lazy_ptr";
+ const MCSymbol *SymName = GetExternalSymbolSymbol(MO.getSymbolName());
+ if (TM.getRelocationModel() == Reloc::Static) {
+ SymName->print(O, MAI);
+ return;
}
- O << Name;
+ const MCSymbol *NLPSym =
+ OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
+ MO.getSymbolName()+"$non_lazy_ptr");
+ GVStubs[SymName] = NLPSym;
+ NLPSym->print(O, MAI);
return;
}
case MachineOperand::MO_GlobalAddress: {
@@ -452,12 +451,11 @@
(GV->isDeclaration() || GV->isWeakForLinker())) {
if (!GV->hasHiddenVisibility()) {
SymToPrint = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
- GVStubs[Mang->getMangledName(GV)] = SymToPrint;
+ GVStubs[GetGlobalValueSymbol(GV)] = SymToPrint;
} else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
GV->hasAvailableExternallyLinkage()) {
SymToPrint = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
- HiddenGVStubs[Mang->getMangledName(GV)] = SymToPrint;
- GetGlobalValueSymbol(GV)->print(O, MAI);
+ HiddenGVStubs[GetGlobalValueSymbol(GV)] = SymToPrint;
} else {
SymToPrint = GetGlobalValueSymbol(GV);
}
@@ -828,11 +826,15 @@
O << "\t.section\t\".toc\",\"aw\"\n";
// FIXME: This is nondeterminstic!
- for (StringMap<const MCSymbol*>::iterator I = TOC.begin(), E = TOC.end();
- I != E; ++I) {
+ for (DenseMap<const MCSymbol*, const MCSymbol*>::iterator I = TOC.begin(),
+ E = TOC.end(); I != E; ++I) {
I->second->print(O, MAI);
O << ":\n";
- O << "\t.tc " << I->getKeyData() << "[TC]," << I->getKeyData() << '\n';
+ O << "\t.tc ";
+ I->first->print(O, MAI);
+ O << "[TC],";
+ I->first->print(O, MAI);
+ O << '\n';
}
}
@@ -1197,7 +1199,7 @@
for (std::vector<Function *>::const_iterator I = Personalities.begin(),
E = Personalities.end(); I != E; ++I) {
if (*I)
- GVStubs[Mang->getMangledName(*I)] =
+ GVStubs[GetGlobalValueSymbol(*I)] =
GetPrivateGlobalValueSymbolStub(*I, "$non_lazy_ptr");
}
}
@@ -1209,11 +1211,13 @@
EmitAlignment(isPPC64 ? 3 : 2);
// FIXME: This is nondeterminstic.
- for (StringMap<const MCSymbol *>::iterator I = GVStubs.begin(),
- E = GVStubs.end(); I != E; ++I) {
+ for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
+ I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) {
I->second->print(O, MAI);
O << ":\n";
- O << "\t.indirect_symbol " << I->getKeyData() << '\n';
+ O << "\t.indirect_symbol ";
+ I->first->print(O, MAI);
+ O << '\n';
O << (isPPC64 ? "\t.quad\t0\n" : "\t.long\t0\n");
}
}
@@ -1222,11 +1226,13 @@
OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(isPPC64 ? 3 : 2);
// FIXME: This is nondeterminstic.
- for (StringMap<const MCSymbol *>::iterator I = HiddenGVStubs.begin(),
- E = HiddenGVStubs.end(); I != E; ++I) {
+ for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
+ I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) {
I->second->print(O, MAI);
O << ":\n";
- O << (isPPC64 ? "\t.quad\t" : "\t.long\t") << I->getKeyData() << '\n';
+ O << (isPPC64 ? "\t.quad\t" : "\t.long\t");
+ I->first->print(O, MAI);
+ O << '\n';
}
}
More information about the llvm-commits
mailing list