From 7c185f36744a13e99f6336b93ba3417c2be7ae2d Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 30 Jan 2015 01:30:01 +0000 Subject: [PATCH] Remove calls to bare getSubtarget and clean up the functions accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227535 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrInfo.cpp | 15 ++++++--------- lib/Target/ARM/ARMTargetObjectFile.cpp | 5 +++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp index 6fa9a359f1a..9ef2204a87f 100644 --- a/lib/Target/ARM/ARMInstrInfo.cpp +++ b/lib/Target/ARM/ARMInstrInfo.cpp @@ -144,19 +144,19 @@ namespace { ARMFunctionInfo *AFI = MF.getInfo(); if (AFI->getGlobalBaseReg() == 0) return false; - - const ARMTargetMachine *TM = - static_cast(&MF.getTarget()); - if (TM->getRelocationModel() != Reloc::PIC_) + const ARMSubtarget &STI = + static_cast(MF.getSubtarget()); + const TargetMachine &TM = MF.getTarget(); + if (TM.getRelocationModel() != Reloc::PIC_) return false; LLVMContext *Context = &MF.getFunction()->getContext(); unsigned ARMPCLabelIndex = AFI->createPICLabelUId(); - unsigned PCAdj = TM->getSubtarget().isThumb() ? 4 : 8; + unsigned PCAdj = STI.isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = ARMConstantPoolSymbol::Create( *Context, "_GLOBAL_OFFSET_TABLE_", ARMPCLabelIndex, PCAdj); - unsigned Align = TM->getDataLayout()->getPrefTypeAlignment( + unsigned Align = TM.getDataLayout()->getPrefTypeAlignment( Type::getInt32PtrTy(*Context)); unsigned Idx = MF.getConstantPool()->getConstantPoolIndex(CPV, Align); @@ -165,8 +165,6 @@ namespace { DebugLoc DL = FirstMBB.findDebugLoc(MBBI); unsigned TempReg = MF.getRegInfo().createVirtualRegister(&ARM::rGPRRegClass); - const ARMSubtarget &STI = - static_cast(MF.getSubtarget()); unsigned Opc = STI.isThumb2() ? ARM::t2LDRpci : ARM::LDRcp; const TargetInstrInfo &TII = *STI.getInstrInfo(); MachineInstrBuilder MIB = BuildMI(FirstMBB, MBBI, DL, @@ -185,7 +183,6 @@ namespace { if (Opc == ARM::PICADD) AddDefaultPred(MIB); - return true; } diff --git a/lib/Target/ARM/ARMTargetObjectFile.cpp b/lib/Target/ARM/ARMTargetObjectFile.cpp index 1dd15b7527e..80f03c62bbf 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.cpp +++ b/lib/Target/ARM/ARMTargetObjectFile.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "ARMTargetObjectFile.h" -#include "ARMSubtarget.h" +#include "ARMTargetMachine.h" #include "llvm/ADT/StringExtras.h" #include "llvm/IR/Mangler.h" #include "llvm/MC/MCAsmInfo.h" @@ -27,7 +27,8 @@ using namespace dwarf; void ARMElfTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) { - bool isAAPCS_ABI = TM.getSubtarget().isAAPCS_ABI(); + bool isAAPCS_ABI = static_cast(TM).TargetABI == + ARMTargetMachine::ARMABI::ARM_ABI_AAPCS; TargetLoweringObjectFileELF::Initialize(Ctx, TM); InitializeELF(isAAPCS_ABI);