Normalize Subtarget constructors to take a target triple string instead of
Module*.

Also, dropped uses of TargetMachine where unnecessary. The only target which
still takes a TargetMachine& is Mips, I would appreciate it if someone would
normalize this to match other targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77918 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Mips/MipsSubtarget.cpp b/lib/Target/Mips/MipsSubtarget.cpp
index 87c2208..c56bc9d 100644
--- a/lib/Target/Mips/MipsSubtarget.cpp
+++ b/lib/Target/Mips/MipsSubtarget.cpp
@@ -14,7 +14,6 @@
 #include "MipsSubtarget.h"
 #include "Mips.h"
 #include "MipsGenSubtarget.inc"
-#include "llvm/Module.h"
 #include "llvm/Support/CommandLine.h"
 using namespace llvm;
 
@@ -25,7 +24,7 @@
 AbsoluteCall("enable-mips-absolute-call", cl::Hidden,
              cl::desc("Enable absolute call within abicall"));
 
-MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, 
+MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const std::string &TT,
                              const std::string &FS, bool little) : 
   MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
   IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasABICall(true), 
@@ -37,7 +36,6 @@
 
   // Parse features string.
   ParseSubtargetFeatures(FS, CPU);
-  const std::string& TT = M.getTargetTriple();
 
   // Is the target system Linux ?
   if (TT.find("linux") == std::string::npos)
diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h
index 2244e49..2485fef 100644
--- a/lib/Target/Mips/MipsSubtarget.h
+++ b/lib/Target/Mips/MipsSubtarget.h
@@ -20,7 +20,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class MipsSubtarget : public TargetSubtarget {
 
@@ -99,8 +98,8 @@
   unsigned getTargetABI() const { return MipsABI; }
 
   /// This constructor initializes the data members to match that
-  /// of the specified module.
-  MipsSubtarget(const TargetMachine &TM, const Module &M, 
+  /// of the specified triple.
+  MipsSubtarget(const TargetMachine &TM, const std::string &TT, 
                 const std::string &FS, bool little);
   
   /// ParseSubtargetFeatures - Parses features string setting specified 
diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp
index b5e2da7..db18b09 100644
--- a/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/lib/Target/Mips/MipsTargetMachine.cpp
@@ -42,7 +42,7 @@
 MipsTargetMachine(const Target &T, const Module &M, const std::string &FS, 
                   bool isLittle=false):
   LLVMTargetMachine(T),
-  Subtarget(*this, M, FS, isLittle), 
+  Subtarget(*this, M.getTargetTriple(), FS, isLittle), 
   DataLayout(isLittle ? std::string("e-p:32:32:32-i8:8:32-i16:16:32") :
                         std::string("E-p:32:32:32-i8:8:32-i16:16:32")), 
   InstrInfo(*this),