llvm.org GIT mirror llvm / 7c185f3
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 Eric Christopher 5 years ago
2 changed file(s) with 9 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
143143 ARMFunctionInfo *AFI = MF.getInfo();
144144 if (AFI->getGlobalBaseReg() == 0)
145145 return false;
146
147 const ARMTargetMachine *TM =
148 static_cast(&MF.getTarget());
149 if (TM->getRelocationModel() != Reloc::PIC_)
146 const ARMSubtarget &STI =
147 static_cast(MF.getSubtarget());
148 const TargetMachine &TM = MF.getTarget();
149 if (TM.getRelocationModel() != Reloc::PIC_)
150150 return false;
151151
152152 LLVMContext *Context = &MF.getFunction()->getContext();
153153 unsigned ARMPCLabelIndex = AFI->createPICLabelUId();
154 unsigned PCAdj = TM->getSubtarget().isThumb() ? 4 : 8;
154 unsigned PCAdj = STI.isThumb() ? 4 : 8;
155155 ARMConstantPoolValue *CPV = ARMConstantPoolSymbol::Create(
156156 *Context, "_GLOBAL_OFFSET_TABLE_", ARMPCLabelIndex, PCAdj);
157157
158 unsigned Align = TM->getDataLayout()->getPrefTypeAlignment(
158 unsigned Align = TM.getDataLayout()->getPrefTypeAlignment(
159159 Type::getInt32PtrTy(*Context));
160160 unsigned Idx = MF.getConstantPool()->getConstantPoolIndex(CPV, Align);
161161
164164 DebugLoc DL = FirstMBB.findDebugLoc(MBBI);
165165 unsigned TempReg =
166166 MF.getRegInfo().createVirtualRegister(&ARM::rGPRRegClass);
167 const ARMSubtarget &STI =
168 static_cast(MF.getSubtarget());
169167 unsigned Opc = STI.isThumb2() ? ARM::t2LDRpci : ARM::LDRcp;
170168 const TargetInstrInfo &TII = *STI.getInstrInfo();
171169 MachineInstrBuilder MIB = BuildMI(FirstMBB, MBBI, DL,
184182 if (Opc == ARM::PICADD)
185183 AddDefaultPred(MIB);
186184
187
188185 return true;
189186 }
190187
77 //===----------------------------------------------------------------------===//
88
99 #include "ARMTargetObjectFile.h"
10 #include "ARMSubtarget.h"
10 #include "ARMTargetMachine.h"
1111 #include "llvm/ADT/StringExtras.h"
1212 #include "llvm/IR/Mangler.h"
1313 #include "llvm/MC/MCAsmInfo.h"
2626
2727 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
2828 const TargetMachine &TM) {
29 bool isAAPCS_ABI = TM.getSubtarget().isAAPCS_ABI();
29 bool isAAPCS_ABI = static_cast(TM).TargetABI ==
30 ARMTargetMachine::ARMABI::ARM_ABI_AAPCS;
3031 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
3132 InitializeELF(isAAPCS_ABI);
3233