Move getSymbol to TargetLoweringObjectFile.

This allows constructing a Mangler with just a TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-10-29 17:28:26 +00:00
parent faf4ed2da8
commit 93cf0939f9
12 changed files with 35 additions and 39 deletions

View File

@@ -111,7 +111,7 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
StringRef Name = GVName.toStringRef(TmpData);
assert(!Name.empty() && "getNameWithPrefix requires non-empty name");
const MCAsmInfo *MAI = Context.getAsmInfo();
const MCAsmInfo *MAI = TM->getMCAsmInfo();
// If the global name is not led with \1, add the appropriate prefixes.
if (Name[0] == '\1') {
@@ -212,7 +212,7 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
// If we are supposed to add a microsoft-style suffix for stdcall/fastcall,
// add it.
if (Context.getAsmInfo()->hasMicrosoftFastStdCallMangling()) {
if (TM->getMCAsmInfo()->hasMicrosoftFastStdCallMangling()) {
if (const Function *F = dyn_cast<Function>(GV)) {
CallingConv::ID CC = F->getCallingConv();
@@ -236,13 +236,3 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
}
}
}
/// getSymbol - Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global.
MCSymbol *Mangler::getSymbol(const GlobalValue *GV) {
SmallString<60> NameStr;
getNameWithPrefix(NameStr, GV, false);
return Context.GetOrCreateSymbol(NameStr.str());
}