diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMTargetObjectFile.cpp | 10 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetObjectFile.h | 8 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCMCInstLower.cpp | 11 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcTargetObjectFile.cpp | 10 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcTargetObjectFile.h | 8 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 33 | ||||
-rw-r--r-- | lib/Target/X86/X86MCInstLower.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetObjectFile.cpp | 26 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetObjectFile.h | 12 | ||||
-rw-r--r-- | lib/Target/XCore/XCoreTargetObjectFile.cpp | 7 |
10 files changed, 68 insertions, 59 deletions
diff --git a/lib/Target/ARM/ARMTargetObjectFile.cpp b/lib/Target/ARM/ARMTargetObjectFile.cpp index f9d71acf11..4e81fcdc3a 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.cpp +++ b/lib/Target/ARM/ARMTargetObjectFile.cpp @@ -16,7 +16,7 @@ #include "llvm/MC/MCSectionELF.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ELF.h" -#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetLowering.h" using namespace llvm; using namespace dwarf; @@ -43,12 +43,12 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx, const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference( const GlobalValue *GV, unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, MCStreamer &Streamer) const { + const TargetMachine &TM, MachineModuleInfo *MMI, + MCStreamer &Streamer) const { assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only"); - return MCSymbolRefExpr::Create(getSymbol(GV, Mang), - MCSymbolRefExpr::VK_ARM_TARGET2, - getContext()); + return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang), + MCSymbolRefExpr::VK_ARM_TARGET2, getContext()); } const MCExpr *ARMElfTargetObjectFile:: diff --git a/lib/Target/ARM/ARMTargetObjectFile.h b/lib/Target/ARM/ARMTargetObjectFile.h index c703f2fafa..aee5836141 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.h +++ b/lib/Target/ARM/ARMTargetObjectFile.h @@ -28,10 +28,10 @@ public: void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE; - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, - unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, - MCStreamer &Streamer) const + const MCExpr * + getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, + Mangler &Mang, const TargetMachine &TM, + MachineModuleInfo *MMI, MCStreamer &Streamer) const LLVM_OVERRIDE; /// \brief Describe a TLS variable address within debug info. diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp index fed254d799..cc40361cfc 100644 --- a/lib/Target/PowerPC/PPCMCInstLower.cpp +++ b/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -25,7 +25,8 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" -#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" using namespace llvm; static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) { @@ -34,7 +35,9 @@ static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) { static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){ - const DataLayout *DL = AP.TM.getDataLayout(); + const TargetMachine &TM = AP.TM; + Mangler *Mang = AP.Mang; + const DataLayout *DL = TM.getDataLayout(); MCContext &Ctx = AP.OutContext; SmallString<128> Name; @@ -51,10 +54,10 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){ if (!MO.isGlobal()) { assert(MO.isSymbol() && "Isn't a symbol reference"); - AP.Mang->getNameWithPrefix(Name, MO.getSymbolName()); + Mang->getNameWithPrefix(Name, MO.getSymbolName()); } else { const GlobalValue *GV = MO.getGlobal(); - AP.Mang->getNameWithPrefix(Name, GV); + TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang); } unsigned OrigLen = Name.size() - PrefixLen; diff --git a/lib/Target/Sparc/SparcTargetObjectFile.cpp b/lib/Target/Sparc/SparcTargetObjectFile.cpp index 11cc41f8c6..b732e18d81 100644 --- a/lib/Target/Sparc/SparcTargetObjectFile.cpp +++ b/lib/Target/Sparc/SparcTargetObjectFile.cpp @@ -11,23 +11,25 @@ #include "MCTargetDesc/SparcMCExpr.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Target/TargetLowering.h" using namespace llvm; const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( const GlobalValue *GV, unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, MCStreamer &Streamer) const { + const TargetMachine &TM, MachineModuleInfo *MMI, + MCStreamer &Streamer) const { if (Encoding & dwarf::DW_EH_PE_pcrel) { MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>(); - MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang); + MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM); // Add information about the stub reference to ELFMMI so that the stub // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { - MCSymbol *Sym = getSymbol(GV, Mang); + MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -37,5 +39,5 @@ const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( } return TargetLoweringObjectFileELF::getTTypeGlobalReference( - GV, Encoding, Mang, MMI, Streamer); + GV, Encoding, Mang, TM, MMI, Streamer); } diff --git a/lib/Target/Sparc/SparcTargetObjectFile.h b/lib/Target/Sparc/SparcTargetObjectFile.h index 933d758f76..cce4a78690 100644 --- a/lib/Target/Sparc/SparcTargetObjectFile.h +++ b/lib/Target/Sparc/SparcTargetObjectFile.h @@ -23,10 +23,10 @@ public: TargetLoweringObjectFileELF() {} - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, - unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, - MCStreamer &Streamer) const + const MCExpr * + getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, + Mangler &Mang, const TargetMachine &TM, + MachineModuleInfo *MMI, MCStreamer &Streamer) const LLVM_OVERRIDE; }; diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index a0218a83df..9fff220d47 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetOptions.h" using namespace llvm; @@ -99,30 +100,22 @@ 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(const GlobalValue *GV, - Mangler &M) const { - SmallString<60> NameStr; - M.getNameWithPrefix(NameStr, GV); - return Ctx->GetOrCreateSymbol(NameStr.str()); -} - MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase( - const GlobalValue *GV, StringRef Suffix, Mangler &M) const { + const GlobalValue *GV, StringRef Suffix, Mangler &Mang, + const TargetMachine &TM) const { assert(!Suffix.empty()); SmallString<60> NameStr; NameStr += DL->getPrivateGlobalPrefix(); - M.getNameWithPrefix(NameStr, GV); + TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang); NameStr.append(Suffix.begin(), Suffix.end()); return Ctx->GetOrCreateSymbol(NameStr.str()); } -MCSymbol *TargetLoweringObjectFile:: -getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, - MachineModuleInfo *MMI) const { - return getSymbol(GV, Mang); +MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol( + const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, + MachineModuleInfo *MMI) const { + return TM.getTargetLowering()->getSymbol(GV, Mang); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -275,6 +268,10 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, return SelectSectionForGlobal(GV, Kind, Mang, TM); } +bool TargetLoweringObjectFile::isSectionAtomizableBySymbols( + const MCSection &Section) const { + return false; +} // Lame default implementation. Calculate the section name for global. const MCSection * @@ -312,9 +309,11 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const { /// handling information. const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference( const GlobalValue *GV, unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, MCStreamer &Streamer) const { + const TargetMachine &TM, MachineModuleInfo *MMI, + MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext()); + MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang), + getContext()); return getTTypeReference(Ref, Encoding, Streamer); } diff --git a/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index 6f88cf1059..3dabbd72ed 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/lib/Target/X86/X86MCInstLower.cpp @@ -98,7 +98,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const { if (MO.isGlobal()) { const GlobalValue *GV = MO.getGlobal(); - getMang()->getNameWithPrefix(Name, GV); + AsmPrinter.getNameWithPrefix(Name, GV); } else if (MO.isSymbol()) { getMang()->getNameWithPrefix(Name, MO.getSymbolName()); } else if (MO.isMBB()) { diff --git a/lib/Target/X86/X86TargetObjectFile.cpp b/lib/Target/X86/X86TargetObjectFile.cpp index c5ba3ecd91..95fccba48a 100644 --- a/lib/Target/X86/X86TargetObjectFile.cpp +++ b/lib/Target/X86/X86TargetObjectFile.cpp @@ -14,18 +14,20 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Target/TargetLowering.h" using namespace llvm; using namespace dwarf; const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference( const GlobalValue *GV, unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, MCStreamer &Streamer) const { + const TargetMachine &TM, MachineModuleInfo *MMI, + MCStreamer &Streamer) const { // 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 = getSymbol(GV, Mang); + const MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang); const MCExpr *Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext()); const MCExpr *Four = MCConstantExpr::Create(4, getContext()); @@ -33,13 +35,13 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference( } return TargetLoweringObjectFileMachO::getTTypeGlobalReference( - GV, Encoding, Mang, MMI, Streamer); + GV, Encoding, Mang, TM, MMI, Streamer); } -MCSymbol *X86_64MachoTargetObjectFile:: -getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, - MachineModuleInfo *MMI) const { - return getSymbol(GV, Mang); +MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol( + const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, + MachineModuleInfo *MMI) const { + return TM.getTargetLowering()->getSymbol(GV, Mang); } void @@ -54,9 +56,8 @@ X86LinuxTargetObjectFile::getDebugThreadLocalSymbol( return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext()); } -const MCExpr * -X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE, - Mangler &Mang) const { +const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol( + const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const { // We are looking for the difference of two symbols, need a subtraction // operation. const SubOperator *Sub = dyn_cast<SubOperator>(CE); @@ -101,6 +102,7 @@ X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE, if (GVLHS->isThreadLocal()) return 0; - return MCSymbolRefExpr::Create( - getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext()); + return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GVLHS, Mang), + MCSymbolRefExpr::VK_COFF_IMGREL32, + getContext()); } diff --git a/lib/Target/X86/X86TargetObjectFile.h b/lib/Target/X86/X86TargetObjectFile.h index 45739475f8..22f3e572d9 100644 --- a/lib/Target/X86/X86TargetObjectFile.h +++ b/lib/Target/X86/X86TargetObjectFile.h @@ -20,15 +20,16 @@ namespace llvm { /// x86-64. class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO { public: - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, - unsigned Encoding, Mangler &Mang, - MachineModuleInfo *MMI, - MCStreamer &Streamer) const + const MCExpr * + getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, + Mangler &Mang, const TargetMachine &TM, + MachineModuleInfo *MMI, MCStreamer &Streamer) const LLVM_OVERRIDE; // getCFIPersonalitySymbol - The symbol that gets passed to // .cfi_personality. MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, + const TargetMachine &TM, MachineModuleInfo *MMI) const LLVM_OVERRIDE; }; @@ -46,7 +47,8 @@ namespace llvm { /// \brief This implementation is used for Windows targets on x86 and x86-64. class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF { const MCExpr *getExecutableRelativeSymbol(const ConstantExpr *CE, - Mangler &Mang) const + Mangler &Mang, + const TargetMachine &TM) const LLVM_OVERRIDE; }; diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 6584ee2d13..ab0f7ad47d 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -118,9 +118,10 @@ static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel) { return Flags; } -const MCSection *XCoreTargetObjectFile:: -getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler &Mang, const TargetMachine &TM) const { +const MCSection * +XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV, + SectionKind Kind, Mangler &Mang, + const TargetMachine &TM) const { StringRef SectionName = GV->getSection(); // Infer section flags from the section name if we can. bool IsCPRel = SectionName.startswith(".cp."); |