llvm.org GIT mirror llvm / ee9250b
eliminate some uses of Mangler::makeNameProper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93305 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
3 changed file(s) with 23 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
7070 }
7171
7272 void Init(StringRef GVName, Mangler *Mang) {
73 // Already initialized.
74 if (!Stub.empty()) return;
73 assert(!GVName.empty());
74 if (!Stub.empty()) return; // Already initialized.
75 // Get the names for the external symbol name.
7576 SmallString<128> TmpStr;
76 Mang->makeNameProper(TmpStr, GVName + "$stub", Mangler::Private);
77 Mang->getNameWithPrefix(TmpStr, GVName + "$stub", Mangler::Private);
7778 Stub = TmpStr.str();
7879 TmpStr.clear();
7980
80 Mang->makeNameProper(TmpStr, GVName + "$lazy_ptr", Mangler::Private);
81 Mang->getNameWithPrefix(TmpStr, GVName + "$lazy_ptr", Mangler::Private);
8182 LazyPtr = TmpStr.str();
8283 TmpStr.clear();
8384
84 Mang->makeNameProper(TmpStr, GVName + "$stub$tmp", Mangler::Private);
85 Mang->getNameWithPrefix(TmpStr, GVName + "$stub$tmp", Mangler::Private);
8586 AnonSymbol = TmpStr.str();
8687 }
8788 };
236237 }
237238 if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
238239 SmallString<128> MangledName;
239 Mang->makeNameProper(MangledName, MO.getSymbolName());
240 Mang->getNameWithPrefix(MangledName, MO.getSymbolName());
240241 FnStubInfo &FnInfo = FnStubs[MangledName.str()];
241242 FnInfo.Init(MO.getSymbolName(), Mang);
242243 O << FnInfo.Stub;
10791079 if (GV->isWeakForLinker()) {
10801080 const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
10811081 SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
1082 Mang->makeNameProper(Name, GV->getNameStr());
1082 Mang->getNameWithPrefix(Name, GV->getName());
10831083 return getCOFFSection(Name.str(), false, Kind);
10841084 }
10851085
282282 break;
283283 }
284284 case MachineOperand::MO_ExternalSymbol: {
285 Mang->makeNameProper(TempNameStr, MO.getSymbolName());
285 const MCSymbol *SymToPrint;
286286 if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
287 TempNameStr += "$stub";
288 MCSymbol *Sym = OutContext.GetOrCreateSymbol(TempNameStr.str());
287 Mang->getNameWithPrefix(TempNameStr,
288 StringRef(MO.getSymbolName())+"$stub");
289 const MCSymbol *Sym = OutContext.GetOrCreateSymbol(TempNameStr.str());
289290 const MCSymbol *&StubSym =
290291 MMI->getObjFileInfo().getFnStubEntry(Sym);
291292 if (StubSym == 0) {
292293 TempNameStr.erase(TempNameStr.end()-5, TempNameStr.end());
293294 StubSym = OutContext.GetOrCreateSymbol(TempNameStr.str());
294295 }
296 SymToPrint = StubSym;
297 } else {
298 Mang->getNameWithPrefix(TempNameStr, MO.getSymbolName());
299 SymToPrint = OutContext.GetOrCreateSymbol(TempNameStr.str());
295300 }
296301
297302 // If the name begins with a dollar-sign, enclose it in parens. We do this
298303 // to avoid having it look like an integer immediate to the assembler.
299 if (TempNameStr[0] == '$')
300 O << '(' << TempNameStr << ')';
301 else
302 O << TempNameStr;
304 if (SymToPrint->getName()[0] != '$')
305 SymToPrint->print(O, MAI);
306 else {
307 O << '(';
308 SymToPrint->print(O, MAI);
309 O << '(';
310 }
303311 break;
304312 }
305313 }