Only access TLOF via the TargetMachine, not TargetLowering.

llvm-svn: 227949
This commit is contained in:
Eric Christopher 2015-02-03 07:22:52 +00:00
parent 8f276db622
commit 36fe028a2a
7 changed files with 20 additions and 25 deletions

View File

@ -149,9 +149,6 @@ protected:
public: public:
const TargetMachine &getTargetMachine() const { return TM; } const TargetMachine &getTargetMachine() const { return TM; }
const DataLayout *getDataLayout() const { return DL; } const DataLayout *getDataLayout() const { return DL; }
const TargetLoweringObjectFile &getObjFileLowering() const {
return *TM.getObjFileLowering();
}
bool isBigEndian() const { return !IsLittleEndian; } bool isBigEndian() const { return !IsLittleEndian; }
bool isLittleEndian() const { return IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; }

View File

@ -129,7 +129,7 @@ unsigned AsmPrinter::getFunctionNumber() const {
} }
const TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const { const TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const {
return TM.getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); return *TM.getObjFileLowering();
} }
/// getDataLayout - Return information about data layout. /// getDataLayout - Return information about data layout.

View File

@ -116,7 +116,7 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM,
// all the per-module stuff we're generating, including MCContext. // all the per-module stuff we're generating, including MCContext.
MachineModuleInfo *MMI = new MachineModuleInfo( MachineModuleInfo *MMI = new MachineModuleInfo(
*TM->getMCAsmInfo(), *TM->getSubtargetImpl()->getRegisterInfo(), *TM->getMCAsmInfo(), *TM->getSubtargetImpl()->getRegisterInfo(),
&TM->getSubtargetImpl()->getTargetLowering()->getObjFileLowering()); TM->getObjFileLowering());
PM.add(MMI); PM.add(MMI);
// Set up a MachineFunction for the rest of CodeGen to work on. // Set up a MachineFunction for the rest of CodeGen to work on.

View File

@ -649,10 +649,8 @@ void LTOModule::parseMetadata() {
// here. // here.
StringRef Op = StringRef Op =
_linkeropt_strings.insert(MDOption->getString()).first->first(); _linkeropt_strings.insert(MDOption->getString()).first->first();
StringRef DepLibName = _target->getSubtargetImpl() StringRef DepLibName =
->getTargetLowering() _target->getObjFileLowering()->getDepLibFromLinkerOpt(Op);
->getObjFileLowering()
.getDepLibFromLinkerOpt(Op);
if (!DepLibName.empty()) if (!DepLibName.empty())
_deplibs.push_back(DepLibName.data()); _deplibs.push_back(DepLibName.data());
else if (!Op.empty()) else if (!Op.empty())

View File

@ -1018,9 +1018,10 @@ SDValue HexagonTargetLowering::LowerGLOBALADDRESS(SDValue Op,
SDLoc dl(Op); SDLoc dl(Op);
Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), Offset); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), Offset);
const HexagonTargetObjectFile &TLOF = const HexagonTargetObjectFile *TLOF =
static_cast<const HexagonTargetObjectFile &>(getObjFileLowering()); static_cast<const HexagonTargetObjectFile *>(
if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) { getTargetMachine().getObjFileLowering());
if (TLOF->IsGlobalInSmallSection(GV, getTargetMachine())) {
return DAG.getNode(HexagonISD::CONST32_GP, dl, getPointerTy(), Result); return DAG.getNode(HexagonISD::CONST32_GP, dl, getPointerTy(), Result);
} }

View File

@ -1598,10 +1598,10 @@ SDValue MipsTargetLowering::lowerGlobalAddress(SDValue Op,
const GlobalValue *GV = N->getGlobal(); const GlobalValue *GV = N->getGlobal();
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) { if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) {
const MipsTargetObjectFile &TLOF = const MipsTargetObjectFile *TLOF =
(const MipsTargetObjectFile &)getObjFileLowering(); static_cast<const MipsTargetObjectFile *>(
getTargetMachine().getObjFileLowering());
if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) if (TLOF->IsGlobalInSmallSection(GV, getTargetMachine()))
// %gp_rel relocation // %gp_rel relocation
return getAddrGPRel(N, SDLoc(N), Ty, DAG); return getAddrGPRel(N, SDLoc(N), Ty, DAG);
@ -1732,10 +1732,11 @@ lowerConstantPool(SDValue Op, SelectionDAG &DAG) const
EVT Ty = Op.getValueType(); EVT Ty = Op.getValueType();
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) { if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !ABI.IsN64()) {
const MipsTargetObjectFile &TLOF = const MipsTargetObjectFile *TLOF =
(const MipsTargetObjectFile &)getObjFileLowering(); static_cast<const MipsTargetObjectFile *>(
getTargetMachine().getObjFileLowering());
if (TLOF.IsConstantInSmallSection(N->getConstVal(), getTargetMachine())) if (TLOF->IsConstantInSmallSection(N->getConstVal(), getTargetMachine()))
// %gp_rel relocation // %gp_rel relocation
return getAddrGPRel(N, SDLoc(N), Ty, DAG); return getAddrGPRel(N, SDLoc(N), Ty, DAG);

View File

@ -200,9 +200,8 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
return; return;
} }
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, *this); SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, *this);
const TargetLoweringObjectFile &TLOF = const TargetLoweringObjectFile *TLOF = getObjFileLowering();
getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); const MCSection *TheSection = TLOF->SectionForGlobal(GV, GVKind, Mang, *this);
const MCSection *TheSection = TLOF.SectionForGlobal(GV, GVKind, Mang, *this);
bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection); bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection);
Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel); Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
} }
@ -210,7 +209,6 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {
SmallString<60> NameStr; SmallString<60> NameStr;
getNameWithPrefix(NameStr, GV, Mang); getNameWithPrefix(NameStr, GV, Mang);
const TargetLoweringObjectFile &TLOF = const TargetLoweringObjectFile *TLOF = getObjFileLowering();
getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); return TLOF->getContext().GetOrCreateSymbol(NameStr.str());
return TLOF.getContext().GetOrCreateSymbol(NameStr.str());
} }