aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-16 02:09:06 +0000
committerChris Lattner <sabre@nondot.org>2010-01-16 02:09:06 +0000
commit75abc68d324158b72c58b5caf2224b1e35ac0c92 (patch)
tree8f0e7b6d49c6634970c0d2d75d43f9520209ecbf /lib
parenta40128c3504b1b650fc57882b7b5d8efd3f7de28 (diff)
downloadexternal_llvm-75abc68d324158b72c58b5caf2224b1e35ac0c92.zip
external_llvm-75abc68d324158b72c58b5caf2224b1e35ac0c92.tar.gz
external_llvm-75abc68d324158b72c58b5caf2224b1e35ac0c92.tar.bz2
more string -> sym, getMangledName is now gone from this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp64
1 files changed, 35 insertions, 29 deletions
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index 7fb3208..ef171dd 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -95,7 +95,7 @@ namespace {
};
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 @@ namespace {
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 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
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 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
(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 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
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 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
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 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
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 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
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';
}
}