Move the code that creates instances of MipsInstrInfo and MipsFrameLowering out
of MipsTargetMachine.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161191 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp
index 9480a77..03a024a 100644
--- a/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/lib/Target/Mips/MipsTargetMachine.cpp
@@ -13,10 +13,8 @@
 
 #include "MipsTargetMachine.h"
 #include "Mips.h"
-#include "Mips16FrameLowering.h"
-#include "Mips16InstrInfo.h"
-#include "MipsSEFrameLowering.h"
-#include "MipsSEInstrInfo.h"
+#include "MipsFrameLowering.h"
+#include "MipsInstrInfo.h"
 #include "llvm/PassManager.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Support/TargetRegistry.h"
@@ -30,29 +28,6 @@
   RegisterTargetMachine<MipselTargetMachine> B(TheMips64elTarget);
 }
 
-static const MipsInstrInfo *genInstrInfo(MipsTargetMachine &TM) {
-  const MipsInstrInfo *II;
-
-  if (TM.getSubtargetImpl()->inMips16Mode())
-    II = new Mips16InstrInfo(TM);
-  else
-    II = new MipsSEInstrInfo(TM);
-
-  return II;
-}
-
-static const MipsFrameLowering *genFrameLowering(MipsTargetMachine &TM,
-                                                 const MipsSubtarget &ST) {
-  const MipsFrameLowering *FL;
-
-  if (TM.getSubtargetImpl()->inMips16Mode())
-    FL = new Mips16FrameLowering(ST);
-  else
-    FL = new MipsSEFrameLowering(ST);
-
-  return FL;
-}
-
 // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
 // The stack is always 8 byte aligned
 // On function prologue, the stack is created by decrementing
@@ -75,8 +50,8 @@
                (Subtarget.isABI_N64() ?
                 "E-p:64:64:64-i8:8:32-i16:16:32-i64:64:64-f128:128:128-n32" :
                 "E-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32")),
-    InstrInfo(genInstrInfo(*this)),
-    FrameLowering(genFrameLowering(*this, Subtarget)),
+    InstrInfo(MipsInstrInfo::create(*this)),
+    FrameLowering(MipsFrameLowering::create(*this, Subtarget)),
     TLInfo(*this), TSInfo(*this), JITInfo() {
 }