[CFLAA] LLVM_CONSTEXPR -> const
[oota-llvm.git] / lib / Target / ARM / ARMCodeEmitter.cpp
index 2fd7eddd87489085a58f875fce37add739a202b0..714497c1bd8e7ad9ad49a8ddc055f437bc010be5 100644 (file)
@@ -15,6 +15,7 @@
 #include "ARM.h"
 #include "ARMBaseInstrInfo.h"
 #include "ARMConstantPoolValue.h"
+#include "ARMMachineFunctionInfo.h"
 #include "ARMRelocations.h"
 #include "ARMSubtarget.h"
 #include "ARMTargetMachine.h"
@@ -66,11 +67,11 @@ namespace {
     static char ID;
   public:
     ARMCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce)
-      : MachineFunctionPass(ID), JTI(nullptr),
-        II((const ARMBaseInstrInfo *)tm.getInstrInfo()),
-        TD(tm.getDataLayout()), TM(tm),
-        MCE(mce), MCPEs(nullptr), MJTEs(nullptr),
-        IsPIC(TM.getRelocationModel() == Reloc::PIC_), IsThumb(false) {}
+        : MachineFunctionPass(ID), JTI(nullptr),
+          II((const ARMBaseInstrInfo *)tm.getSubtargetImpl()->getInstrInfo()),
+          TD(tm.getSubtargetImpl()->getDataLayout()), TM(tm), MCE(mce),
+          MCPEs(nullptr), MJTEs(nullptr),
+          IsPIC(TM.getRelocationModel() == Reloc::PIC_), IsThumb(false) {}
 
     /// getBinaryCodeForInstr - This function, generated by the
     /// CodeEmitterGenerator using TableGen, produces the binary encoding for
@@ -367,12 +368,13 @@ bool ARMCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
   assert((Target.getRelocationModel() != Reloc::Default ||
           Target.getRelocationModel() != Reloc::Static) &&
          "JIT relocation model must be set to static or default!");
-
-  JTI = static_cast<ARMJITInfo*>(Target.getJITInfo());
-  II = static_cast<const ARMBaseInstrInfo*>(Target.getInstrInfo());
-  TD = Target.getDataLayout();
-
+  // Initialize the subtarget first so we can grab all of the
+  // subtarget dependent variables from there.
   Subtarget = &TM.getSubtarget<ARMSubtarget>();
+  JTI = static_cast<ARMJITInfo *>(Target.getSubtargetImpl()->getJITInfo());
+  II = static_cast<const ARMBaseInstrInfo *>(Subtarget->getInstrInfo());
+  TD = Target.getSubtargetImpl()->getDataLayout();
+
   MCPEs = &MF.getConstantPool()->getConstants();
   MJTEs = nullptr;
   if (MF.getJumpTableInfo()) MJTEs = &MF.getJumpTableInfo()->getJumpTables();