forked from OSchip/llvm-project
eliminate some uses of Mangler::makeNameProper.
llvm-svn: 93305
This commit is contained in:
parent
98b05e017b
commit
f0a401fcf0
|
@ -71,18 +71,19 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init(StringRef GVName, Mangler *Mang) {
|
void Init(StringRef GVName, Mangler *Mang) {
|
||||||
// Already initialized.
|
assert(!GVName.empty());
|
||||||
if (!Stub.empty()) return;
|
if (!Stub.empty()) return; // Already initialized.
|
||||||
|
// Get the names for the external symbol name.
|
||||||
SmallString<128> TmpStr;
|
SmallString<128> TmpStr;
|
||||||
Mang->makeNameProper(TmpStr, GVName + "$stub", Mangler::Private);
|
Mang->getNameWithPrefix(TmpStr, GVName + "$stub", Mangler::Private);
|
||||||
Stub = TmpStr.str();
|
Stub = TmpStr.str();
|
||||||
TmpStr.clear();
|
TmpStr.clear();
|
||||||
|
|
||||||
Mang->makeNameProper(TmpStr, GVName + "$lazy_ptr", Mangler::Private);
|
Mang->getNameWithPrefix(TmpStr, GVName + "$lazy_ptr", Mangler::Private);
|
||||||
LazyPtr = TmpStr.str();
|
LazyPtr = TmpStr.str();
|
||||||
TmpStr.clear();
|
TmpStr.clear();
|
||||||
|
|
||||||
Mang->makeNameProper(TmpStr, GVName + "$stub$tmp", Mangler::Private);
|
Mang->getNameWithPrefix(TmpStr, GVName + "$stub$tmp", Mangler::Private);
|
||||||
AnonSymbol = TmpStr.str();
|
AnonSymbol = TmpStr.str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -237,7 +238,7 @@ namespace {
|
||||||
}
|
}
|
||||||
if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
|
if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
|
||||||
SmallString<128> MangledName;
|
SmallString<128> MangledName;
|
||||||
Mang->makeNameProper(MangledName, MO.getSymbolName());
|
Mang->getNameWithPrefix(MangledName, MO.getSymbolName());
|
||||||
FnStubInfo &FnInfo = FnStubs[MangledName.str()];
|
FnStubInfo &FnInfo = FnStubs[MangledName.str()];
|
||||||
FnInfo.Init(MO.getSymbolName(), Mang);
|
FnInfo.Init(MO.getSymbolName(), Mang);
|
||||||
O << FnInfo.Stub;
|
O << FnInfo.Stub;
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
if (GV->isWeakForLinker()) {
|
if (GV->isWeakForLinker()) {
|
||||||
const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
|
const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
|
||||||
SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
|
SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
|
||||||
Mang->makeNameProper(Name, GV->getNameStr());
|
Mang->getNameWithPrefix(Name, GV->getName());
|
||||||
return getCOFFSection(Name.str(), false, Kind);
|
return getCOFFSection(Name.str(), false, Kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,24 +283,32 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MachineOperand::MO_ExternalSymbol: {
|
case MachineOperand::MO_ExternalSymbol: {
|
||||||
Mang->makeNameProper(TempNameStr, MO.getSymbolName());
|
const MCSymbol *SymToPrint;
|
||||||
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
||||||
TempNameStr += "$stub";
|
Mang->getNameWithPrefix(TempNameStr,
|
||||||
MCSymbol *Sym = OutContext.GetOrCreateSymbol(TempNameStr.str());
|
StringRef(MO.getSymbolName())+"$stub");
|
||||||
|
const MCSymbol *Sym = OutContext.GetOrCreateSymbol(TempNameStr.str());
|
||||||
const MCSymbol *&StubSym =
|
const MCSymbol *&StubSym =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
|
MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
|
||||||
if (StubSym == 0) {
|
if (StubSym == 0) {
|
||||||
TempNameStr.erase(TempNameStr.end()-5, TempNameStr.end());
|
TempNameStr.erase(TempNameStr.end()-5, TempNameStr.end());
|
||||||
StubSym = OutContext.GetOrCreateSymbol(TempNameStr.str());
|
StubSym = OutContext.GetOrCreateSymbol(TempNameStr.str());
|
||||||
}
|
}
|
||||||
|
SymToPrint = StubSym;
|
||||||
|
} else {
|
||||||
|
Mang->getNameWithPrefix(TempNameStr, MO.getSymbolName());
|
||||||
|
SymToPrint = OutContext.GetOrCreateSymbol(TempNameStr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the name begins with a dollar-sign, enclose it in parens. We do this
|
// If the name begins with a dollar-sign, enclose it in parens. We do this
|
||||||
// to avoid having it look like an integer immediate to the assembler.
|
// to avoid having it look like an integer immediate to the assembler.
|
||||||
if (TempNameStr[0] == '$')
|
if (SymToPrint->getName()[0] != '$')
|
||||||
O << '(' << TempNameStr << ')';
|
SymToPrint->print(O, MAI);
|
||||||
else
|
else {
|
||||||
O << TempNameStr;
|
O << '(';
|
||||||
|
SymToPrint->print(O, MAI);
|
||||||
|
O << '(';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue