From: Eric Christopher Date: Tue, 3 Feb 2015 07:22:52 +0000 (+0000) Subject: Only access TLOF via the TargetMachine, not TargetLowering. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3f0a42d003cd6fc93dd4786ca580eaa48bb5fad;p=llvm Only access TLOF via the TargetMachine, not TargetLowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227949 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 9a50bd0d318..a2d1c4caf20 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -149,9 +149,6 @@ protected: public: const TargetMachine &getTargetMachine() const { return TM; } const DataLayout *getDataLayout() const { return DL; } - const TargetLoweringObjectFile &getObjFileLowering() const { - return *TM.getObjFileLowering(); - } bool isBigEndian() const { return !IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; } diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index c983bfbb696..57d6fae0fbd 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -129,7 +129,7 @@ unsigned AsmPrinter::getFunctionNumber() const { } const TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const { - return TM.getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); + return *TM.getObjFileLowering(); } /// getDataLayout - Return information about data layout. diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index 617ed75c24f..0fd1483255c 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -116,7 +116,7 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM, // all the per-module stuff we're generating, including MCContext. MachineModuleInfo *MMI = new MachineModuleInfo( *TM->getMCAsmInfo(), *TM->getSubtargetImpl()->getRegisterInfo(), - &TM->getSubtargetImpl()->getTargetLowering()->getObjFileLowering()); + TM->getObjFileLowering()); PM.add(MMI); // Set up a MachineFunction for the rest of CodeGen to work on. diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp index 038555f953d..0d07791b381 100644 --- a/lib/LTO/LTOModule.cpp +++ b/lib/LTO/LTOModule.cpp @@ -649,10 +649,8 @@ void LTOModule::parseMetadata() { // here. StringRef Op = _linkeropt_strings.insert(MDOption->getString()).first->first(); - StringRef DepLibName = _target->getSubtargetImpl() - ->getTargetLowering() - ->getObjFileLowering() - .getDepLibFromLinkerOpt(Op); + StringRef DepLibName = + _target->getObjFileLowering()->getDepLibFromLinkerOpt(Op); if (!DepLibName.empty()) _deplibs.push_back(DepLibName.data()); else if (!Op.empty()) diff --git a/lib/Target/Hexagon/HexagonISelLowering.cpp b/lib/Target/Hexagon/HexagonISelLowering.cpp index b0f78a3a789..124dc9af881 100644 --- a/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -1018,9 +1018,10 @@ SDValue HexagonTargetLowering::LowerGLOBALADDRESS(SDValue Op, SDLoc dl(Op); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), Offset); - const HexagonTargetObjectFile &TLOF = - static_cast(getObjFileLowering()); - if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) { + const HexagonTargetObjectFile *TLOF = + static_cast( + getTargetMachine().getObjFileLowering()); + if (TLOF->IsGlobalInSmallSection(GV, getTargetMachine())) { return DAG.getNode(HexagonISD::CONST32_GP, dl, getPointerTy(), Result); } diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index 4b0099fdc4e..8e00792eb9b 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -1598,10 +1598,10 @@ SDValue MipsTargetLowering::lowerGlobalAddress(SDValue Op, const GlobalValue *GV = N->getGlobal(); if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) { - const MipsTargetObjectFile &TLOF = - (const MipsTargetObjectFile &)getObjFileLowering(); - - if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) + const MipsTargetObjectFile *TLOF = + static_cast( + getTargetMachine().getObjFileLowering()); + if (TLOF->IsGlobalInSmallSection(GV, getTargetMachine())) // %gp_rel relocation return getAddrGPRel(N, SDLoc(N), Ty, DAG); @@ -1732,10 +1732,11 @@ lowerConstantPool(SDValue Op, SelectionDAG &DAG) const EVT Ty = Op.getValueType(); if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) { - const MipsTargetObjectFile &TLOF = - (const MipsTargetObjectFile &)getObjFileLowering(); + const MipsTargetObjectFile *TLOF = + static_cast( + getTargetMachine().getObjFileLowering()); - if (TLOF.IsConstantInSmallSection(N->getConstVal(), getTargetMachine())) + if (TLOF->IsConstantInSmallSection(N->getConstVal(), getTargetMachine())) // %gp_rel relocation return getAddrGPRel(N, SDLoc(N), Ty, DAG); diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index ef0341dc917..1bd99eac7dc 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -200,9 +200,8 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl &Name, return; } SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, *this); - const TargetLoweringObjectFile &TLOF = - getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); - const MCSection *TheSection = TLOF.SectionForGlobal(GV, GVKind, Mang, *this); + const TargetLoweringObjectFile *TLOF = getObjFileLowering(); + const MCSection *TheSection = TLOF->SectionForGlobal(GV, GVKind, Mang, *this); bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection); Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel); } @@ -210,7 +209,6 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl &Name, MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { SmallString<60> NameStr; getNameWithPrefix(NameStr, GV, Mang); - const TargetLoweringObjectFile &TLOF = - getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); - return TLOF.getContext().GetOrCreateSymbol(NameStr.str()); + const TargetLoweringObjectFile *TLOF = getObjFileLowering(); + return TLOF->getContext().GetOrCreateSymbol(NameStr.str()); }