diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMTargetObjectFile.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mangler.cpp | 14 | ||||
-rw-r--r-- | lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/NVPTX/NVPTXTargetObjectFile.h | 1 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 14 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetObjectFile.cpp | 4 |
6 files changed, 19 insertions, 18 deletions
diff --git a/lib/Target/ARM/ARMTargetObjectFile.cpp b/lib/Target/ARM/ARMTargetObjectFile.cpp index dfdf6ab356..7ec71b20c6 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.cpp +++ b/lib/Target/ARM/ARMTargetObjectFile.cpp @@ -47,7 +47,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MCStreamer &Streamer) const { assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only"); - return MCSymbolRefExpr::Create(Mang->getSymbol(GV), + return MCSymbolRefExpr::Create(getSymbol(*Mang, GV), MCSymbolRefExpr::VK_ARM_TARGET2, getContext()); } diff --git a/lib/Target/Mangler.cpp b/lib/Target/Mangler.cpp index f86428cff2..1deaf2b115 100644 --- a/lib/Target/Mangler.cpp +++ b/lib/Target/Mangler.cpp @@ -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()); -} - - diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index e5ca860f9e..0f8649f813 100644 --- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -887,7 +887,7 @@ bool NVPTXAsmPrinter::doInitialization(Module &M) { const_cast<TargetLoweringObjectFile &>(getObjFileLowering()) .Initialize(OutContext, TM); - Mang = new Mangler(OutContext, &TM); + Mang = new Mangler(&TM); // Emit header before any dwarf directives are emitted below. emitHeader(M, OS1); diff --git a/lib/Target/NVPTX/NVPTXTargetObjectFile.h b/lib/Target/NVPTX/NVPTXTargetObjectFile.h index bfd6ab12f4..1449f52a96 100644 --- a/lib/Target/NVPTX/NVPTXTargetObjectFile.h +++ b/lib/Target/NVPTX/NVPTXTargetObjectFile.h @@ -68,6 +68,7 @@ public: } virtual void Initialize(MCContext &ctx, const TargetMachine &TM) { + TargetLoweringObjectFile::Initialize(ctx, TM); TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel()); diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index cd810b624f..7b8d1108f1 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -97,10 +97,20 @@ static bool IsNullTerminatedString(const Constant *C) { return false; } +/// Return the MCSymbol for the specified global value. This +/// symbol is the main label that is the address of the global. +MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M, + const GlobalValue *GV) const { + SmallString<60> NameStr; + M.getNameWithPrefix(NameStr, GV, false); + return Ctx->GetOrCreateSymbol(NameStr.str()); +} + + MCSymbol *TargetLoweringObjectFile:: getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI) const { - return Mang->getSymbol(GV); + return getSymbol(*Mang, GV); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -293,7 +303,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::Create(Mang->getSymbol(GV), getContext()); + MCSymbolRefExpr::Create(getSymbol(*Mang, GV), getContext()); return getTTypeReference(Ref, Encoding, Streamer); } diff --git a/lib/Target/X86/X86TargetObjectFile.cpp b/lib/Target/X86/X86TargetObjectFile.cpp index a19c5a601e..086cd4de53 100644 --- a/lib/Target/X86/X86TargetObjectFile.cpp +++ b/lib/Target/X86/X86TargetObjectFile.cpp @@ -25,7 +25,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which // is an indirect pc-relative reference. if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) { - const MCSymbol *Sym = Mang->getSymbol(GV); + const MCSymbol *Sym = getSymbol(*Mang, GV); const MCExpr *Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext()); const MCExpr *Four = MCConstantExpr::Create(4, getContext()); @@ -39,7 +39,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MCSymbol *X86_64MachoTargetObjectFile:: getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI) const { - return Mang->getSymbol(GV); + return getSymbol(*Mang, GV); } void |