diff options
author | Tim Northover <tnorthover@apple.com> | 2016-11-22 16:17:20 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-11-22 16:17:20 +0000 |
commit | b64fb453eaf3c2d768538571b2d99b4c5acf8911 (patch) | |
tree | 5caa3f2fde0a3e51156f873257f7f48f1dc6522f /llvm/lib | |
parent | 9a355219d19b316f3f5baa093164ca554e7af17e (diff) | |
download | bcm5719-llvm-b64fb453eaf3c2d768538571b2d99b4c5acf8911.tar.gz bcm5719-llvm-b64fb453eaf3c2d768538571b2d99b4c5acf8911.zip |
CodeGen: simplify TargetMachine::getSymbol interface. NFC.
No-one actually had a mangler handy when calling this function, and
getSymbol itself went most of the way towards getting its own mangler
(with a local TLOF variable) so forcing all callers to supply one was
just extra complication.
llvm-svn: 287645
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMTargetObjectFile.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86TargetObjectFile.cpp | 6 |
8 files changed, 23 insertions, 24 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6b52e97a02c..74724c224c8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -345,7 +345,7 @@ void AsmPrinter::getNameWithPrefix(SmallVectorImpl<char> &Name, } MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const { - return TM.getSymbol(GV, getObjFileLowering().getMangler()); + return TM.getSymbol(GV); } /// EmitGlobalVariable - Emit the specified global variable to the .s file. diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 539d485ffef..bdb1210553e 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -55,9 +55,9 @@ MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol( unsigned Encoding = getPersonalityEncoding(); if ((Encoding & 0x80) == dwarf::DW_EH_PE_indirect) return getContext().getOrCreateSymbol(StringRef("DW.ref.") + - TM.getSymbol(GV, getMangler())->getName()); + TM.getSymbol(GV)->getName()); if ((Encoding & 0x70) == dwarf::DW_EH_PE_absptr) - return TM.getSymbol(GV, getMangler()); + return TM.getSymbol(GV); report_fatal_error("We do not support this DWARF encoding yet!"); } @@ -96,7 +96,7 @@ const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference( // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); if (!StubSym.getPointer()) { - MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + MCSymbol *Sym = TM.getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -443,10 +443,9 @@ const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference( return nullptr; return MCBinaryExpr::createSub( - MCSymbolRefExpr::create(TM.getSymbol(LHS, getMangler()), PLTRelativeVariantKind, + MCSymbolRefExpr::create(TM.getSymbol(LHS), PLTRelativeVariantKind, getContext()), - MCSymbolRefExpr::create(TM.getSymbol(RHS, getMangler()), getContext()), - getContext()); + MCSymbolRefExpr::create(TM.getSymbol(RHS), getContext()), getContext()); } void @@ -712,7 +711,7 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference( // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); if (!StubSym.getPointer()) { - MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + MCSymbol *Sym = TM.getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -738,7 +737,7 @@ MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol( // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); if (!StubSym.getPointer()) { - MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + MCSymbol *Sym = TM.getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -929,7 +928,7 @@ MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal( ComdatGV = GO; if (!ComdatGV->hasPrivateLinkage()) { - MCSymbol *Sym = TM.getSymbol(ComdatGV, getMangler()); + MCSymbol *Sym = TM.getSymbol(ComdatGV); COMDATSymName = Sym->getName(); Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT; } else { @@ -982,7 +981,7 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal( UniqueID = NextUniqueID++; if (!ComdatGV->hasPrivateLinkage()) { - MCSymbol *Sym = TM.getSymbol(ComdatGV, getMangler()); + MCSymbol *Sym = TM.getSymbol(ComdatGV); StringRef COMDATSymName = Sym->getName(); return getContext().getCOFFSection(Name, Characteristics, Kind, COMDATSymName, Selection, UniqueID); @@ -1037,7 +1036,7 @@ MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable( if (F.hasPrivateLinkage()) return ReadOnlySection; - MCSymbol *Sym = TM.getSymbol(&F, getMangler()); + MCSymbol *Sym = TM.getSymbol(&F); StringRef COMDATSymName = Sym->getName(); SectionKind Kind = SectionKind::getReadOnly(); diff --git a/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp b/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp index cafbb5361b9..8875f9b7264 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp @@ -37,7 +37,7 @@ const MCExpr *AArch64_MachoTargetObjectFile::getTTypeGlobalReference( // won't reference using the GOT, so we need this target-specific // version. if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) { - const MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + const MCSymbol *Sym = TM.getSymbol(GV); const MCExpr *Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, getContext()); MCSymbol *PCSym = getContext().createTempSymbol(); @@ -53,7 +53,7 @@ const MCExpr *AArch64_MachoTargetObjectFile::getTTypeGlobalReference( MCSymbol *AArch64_MachoTargetObjectFile::getCFIPersonalitySymbol( const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const { - return TM.getSymbol(GV, getMangler()); + return TM.getSymbol(GV); } const MCExpr *AArch64_MachoTargetObjectFile::getIndirectSymViaGOTPCRel( diff --git a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp index 8218a90aaae..ec364e8d795 100644 --- a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp +++ b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp @@ -49,7 +49,7 @@ const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference( assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only"); - return MCSymbolRefExpr::create(TM.getSymbol(GV, getMangler()), + return MCSymbolRefExpr::create(TM.getSymbol(GV), MCSymbolRefExpr::VK_ARM_TARGET2, getContext()); } diff --git a/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp b/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp index b3d766801f8..8fdde15d8d2 100644 --- a/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp +++ b/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp @@ -28,7 +28,7 @@ const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); if (!StubSym.getPointer()) { - MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + MCSymbol *Sym = TM.getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index a8b2af18ebf..375f8511f7a 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -118,7 +118,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase( MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol( const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const { - return TM.getSymbol(GV, *Mang); + return TM.getSymbol(GV); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -288,7 +288,7 @@ const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference( const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::create(TM.getSymbol(GV, *Mang), getContext()); + MCSymbolRefExpr::create(TM.getSymbol(GV), getContext()); return getTTypeReference(Ref, Encoding, Streamer); } diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 792280af84d..e16ced1661a 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -213,9 +213,9 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name, TLOF->getNameWithPrefix(Name, GV, *this); } -MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { - SmallString<128> NameStr; - getNameWithPrefix(NameStr, GV, Mang); +MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV) const { const TargetLoweringObjectFile *TLOF = getObjFileLowering(); + SmallString<128> NameStr; + getNameWithPrefix(NameStr, GV, TLOF->getMangler()); return TLOF->getContext().getOrCreateSymbol(NameStr); } diff --git a/llvm/lib/Target/X86/X86TargetObjectFile.cpp b/llvm/lib/Target/X86/X86TargetObjectFile.cpp index d050ec0287f..7f70829cb6c 100644 --- a/llvm/lib/Target/X86/X86TargetObjectFile.cpp +++ b/llvm/lib/Target/X86/X86TargetObjectFile.cpp @@ -30,7 +30,7 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference( // 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) && (Encoding & DW_EH_PE_pcrel)) { - const MCSymbol *Sym = TM.getSymbol(GV, getMangler()); + const MCSymbol *Sym = TM.getSymbol(GV); const MCExpr *Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext()); const MCExpr *Four = MCConstantExpr::create(4, getContext()); @@ -44,7 +44,7 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference( MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol( const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const { - return TM.getSymbol(GV, getMangler()); + return TM.getSymbol(GV); } const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel( @@ -108,7 +108,7 @@ const MCExpr *X86WindowsTargetObjectFile::lowerRelativeReference( cast<GlobalVariable>(RHS)->hasInitializer() || RHS->hasSection()) return nullptr; - return MCSymbolRefExpr::create(TM.getSymbol(LHS, getMangler()), + return MCSymbolRefExpr::create(TM.getSymbol(LHS), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext()); } |