Normalize Subtarget constructors to take a target triple string instead of
authorDaniel Dunbar <daniel@zuster.org>
Sun, 2 Aug 2009 22:11:08 +0000 (22:11 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 2 Aug 2009 22:11:08 +0000 (22:11 +0000)
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

37 files changed:
lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/ARMSubtarget.h
lib/Target/ARM/ARMTargetMachine.cpp
lib/Target/Alpha/AlphaSubtarget.cpp
lib/Target/Alpha/AlphaSubtarget.h
lib/Target/Alpha/AlphaTargetMachine.cpp
lib/Target/Blackfin/BlackfinSubtarget.cpp
lib/Target/Blackfin/BlackfinSubtarget.h
lib/Target/Blackfin/BlackfinTargetMachine.cpp
lib/Target/CellSPU/SPUSubtarget.cpp
lib/Target/CellSPU/SPUSubtarget.h
lib/Target/CellSPU/SPUTargetMachine.cpp
lib/Target/MSP430/MSP430Subtarget.cpp
lib/Target/MSP430/MSP430Subtarget.h
lib/Target/MSP430/MSP430TargetMachine.cpp
lib/Target/Mips/MipsSubtarget.cpp
lib/Target/Mips/MipsSubtarget.h
lib/Target/Mips/MipsTargetMachine.cpp
lib/Target/PIC16/PIC16Subtarget.cpp
lib/Target/PIC16/PIC16Subtarget.h
lib/Target/PIC16/PIC16TargetMachine.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCSubtarget.cpp
lib/Target/PowerPC/PPCSubtarget.h
lib/Target/PowerPC/PPCTargetMachine.cpp
lib/Target/Sparc/SparcSubtarget.cpp
lib/Target/Sparc/SparcSubtarget.h
lib/Target/Sparc/SparcTargetMachine.cpp
lib/Target/SystemZ/SystemZSubtarget.cpp
lib/Target/SystemZ/SystemZSubtarget.h
lib/Target/SystemZ/SystemZTargetMachine.cpp
lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86Subtarget.h
lib/Target/X86/X86TargetMachine.cpp
lib/Target/XCore/XCoreSubtarget.cpp
lib/Target/XCore/XCoreSubtarget.h
lib/Target/XCore/XCoreTargetMachine.cpp

index d30592b0f4ca411e484f9e9934dea419118182a8..71c77e10682c422fe1f6d14b819a81df057868c0 100644 (file)
@@ -13,8 +13,6 @@
 
 #include "ARMSubtarget.h"
 #include "ARMGenSubtarget.inc"
-#include "llvm/Module.h"
-#include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Support/CommandLine.h"
 using namespace llvm;
@@ -23,7 +21,7 @@ static cl::opt<bool>
 ReserveR9("arm-reserve-r9", cl::Hidden,
           cl::desc("Reserve R9, making it unavailable as GPR"));
 
-ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS,
+ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
                            bool isThumb)
   : ARMArchVersion(V4T)
   , ARMFPUType(None)
@@ -45,7 +43,6 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS,
 
   // Set the boolean corresponding to the current target triple, or the default
   // if one cannot be determined, to true.
-  const std::string& TT = M.getTargetTriple();
   unsigned Len = TT.length();
   unsigned Idx = 0;
 
index 60c3bd13ed7bbe6a63693a5302c9b244fe77f44e..4ec77ff93e6e92d7f11349c243f558d035449721 100644 (file)
@@ -19,7 +19,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class ARMSubtarget : public TargetSubtarget {
 protected:
@@ -73,9 +72,9 @@ protected:
   } TargetABI;
 
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  ARMSubtarget(const Module &M, const std::string &FS, bool isThumb);
+  ARMSubtarget(const std::string &TT, const std::string &FS, bool isThumb);
 
   /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
   /// that still makes it profitable to inline the call.
index 96552ede201ecc31c786cb5672e352a0e9e075c4..0546e5751307e19f2beaca25e88ad8e3c37e6277 100644 (file)
@@ -41,7 +41,7 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T,
                                            const std::string &FS,
                                            bool isThumb)
   : LLVMTargetMachine(T),
-    Subtarget(M, FS, isThumb),
+    Subtarget(M.getTargetTriple(), FS, isThumb),
     FrameInfo(Subtarget),
     JITInfo(),
     InstrItins(Subtarget.getInstrItineraryData()) {
index d5a9365d75c11f351a91612c2beaed761ef7ac57..bda7104ab926802fe719d99a9e8ea4b09b7ddbb0 100644 (file)
@@ -16,7 +16,7 @@
 #include "AlphaGenSubtarget.inc"
 using namespace llvm;
 
-AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS)
+AlphaSubtarget::AlphaSubtarget(const std::string &TT, const std::string &FS)
   : HasCT(false) {
   std::string CPU = "generic";
 
index 0a944cb0a634b96c36865d5c992af4635581ddd6..f0eb93c6cba2e62b63210af95941901b4d4b3f92 100644 (file)
@@ -20,7 +20,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class AlphaSubtarget : public TargetSubtarget {
 protected:
@@ -31,9 +30,9 @@ protected:
 
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  AlphaSubtarget(const Module &M, const std::string &FS);
+  AlphaSubtarget(const std::string &TT, const std::string &FS);
   
   /// ParseSubtargetFeatures - Parses features string setting specified 
   /// subtarget options.  Definition of function is auto generated by tblgen.
index 9de5c36d15b6f108551b78c1297aeb5a9a8729c0..b72f96fb62d5e07bbc25edfd7de7406a40e58fb7 100644 (file)
@@ -36,7 +36,7 @@ AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M,
     DataLayout("e-f128:128:128"),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
     JITInfo(*this),
-    Subtarget(M, FS),
+    Subtarget(M.getTargetTriple(), FS),
     TLInfo(*this) {
   setRelocationModel(Reloc::PIC_);
 }
index 80a242182d82feb48f1b95a198c7f4818298efdc..e104c5245a9e5b6de62eb32ad9abf243afa2ba6a 100644 (file)
@@ -16,8 +16,7 @@
 
 using namespace llvm;
 
-BlackfinSubtarget::BlackfinSubtarget(const TargetMachine &TM,
-                                     const Module &M,
+BlackfinSubtarget::BlackfinSubtarget(const std::string &TT,
                                      const std::string &FS)
   : sdram(false),
     icplb(false),
index 13d8e240ab6aaa9e83fe7c1ad6cfc1d75ffc6a7f..d667fe26519ba6bd925c64eefed5f216d39d800c 100644 (file)
@@ -19,9 +19,6 @@
 
 namespace llvm {
 
-  class TargetMachine;
-  class Module;
-
   class BlackfinSubtarget : public TargetSubtarget {
     bool sdram;
     bool icplb;
@@ -35,8 +32,7 @@ namespace llvm {
     bool wa_killed_mmr;
     bool wa_rets;
   public:
-    BlackfinSubtarget(const TargetMachine &TM, const Module &M,
-                      const std::string &FS);
+    BlackfinSubtarget(const std::string &TT, const std::string &FS);
 
     /// ParseSubtargetFeatures - Parses features string setting specified
     /// subtarget options.  Definition of function is auto generated by tblgen.
index 059916b2007f92eeee4622f81930f4bf4e56f45c..b69adf609ee2078ad7c122c0c5852bbea2cb228e 100644 (file)
@@ -32,7 +32,7 @@ BlackfinTargetMachine::BlackfinTargetMachine(const Target &T,
                                              const std::string &FS)
   : LLVMTargetMachine(T),
     DataLayout("e-p:32:32-i64:32-f64:32"),
-    Subtarget(*this, M, FS),
+    Subtarget(M.getTargetTriple(), FS),
     TLInfo(*this),
     InstrInfo(Subtarget),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 4, 0) {
index 0a1c2f75cfe5ef02307651ac8ee54ded94553f57..0f18b7fa8b26a3eec0ecefeb448a4ce02a3e1afc 100644 (file)
 
 #include "SPUSubtarget.h"
 #include "SPU.h"
-#include "llvm/Module.h"
-#include "llvm/Target/TargetMachine.h"
 #include "SPUGenSubtarget.inc"
 
 using namespace llvm;
 
-SPUSubtarget::SPUSubtarget(const TargetMachine &tm, const Module &M,
-                           const std::string &FS) :
-  TM(tm),
+SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &FS) :
   StackAlignment(16),
   ProcDirective(SPU::DEFAULT_PROC),
   UseLargeMem(false)
index b6a34099b2f7df832ba6dc2b1e3dc7ccebf551dc..94ac73ce39f82cbe1c245c67db2a15619772ed38 100644 (file)
@@ -20,9 +20,7 @@
 #include <string>
 
 namespace llvm {
-  class Module;
   class GlobalValue;
-  class TargetMachine;
 
   namespace SPU {
     enum {
@@ -33,8 +31,6 @@ namespace llvm {
     
   class SPUSubtarget : public TargetSubtarget {
   protected:
-    const TargetMachine &TM;
-    
     /// stackAlignment - The minimum alignment known to hold of the stack frame
     /// on entry to the function and which must be maintained by every function.
     unsigned StackAlignment;
@@ -52,10 +48,9 @@ namespace llvm {
     
   public:
     /// This constructor initializes the data members to match that
-    /// of the specified module.
+    /// of the specified triple.
     ///
-    SPUSubtarget(const TargetMachine &TM, const Module &M,
-                 const std::string &FS);
+    SPUSubtarget(const std::string &TT, const std::string &FS);
     
     /// ParseSubtargetFeatures - Parses features string setting specified 
     /// subtarget options.  Definition of function is auto generated by tblgen.
index 340eb56f361ade07e9e5dd6ec6da44372ec1c81d..16b923b8ce7d322702d2b805bd315d9a0da2a10d 100644 (file)
@@ -41,7 +41,7 @@ const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const {
 SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M, 
                                    const std::string &FS)
   : LLVMTargetMachine(T),
-    Subtarget(*this, M, FS),
+    Subtarget(M.getTargetTriple(), FS),
     DataLayout(Subtarget.getTargetDataString()),
     InstrInfo(*this),
     FrameInfo(*this),
index ef9e10339bc3f7fbc0257ca87a4fd3f04beaf011..1346cb9a04dc8264fa92013c688bb7cb7d4e4f9c 100644 (file)
 #include "MSP430Subtarget.h"
 #include "MSP430.h"
 #include "MSP430GenSubtarget.inc"
-#include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
 
-MSP430Subtarget::MSP430Subtarget(const TargetMachine &TM, const Module &M,
-                                 const std::string &FS) {
+MSP430Subtarget::MSP430Subtarget(const std::string &TT, const std::string &FS) {
   std::string CPU = "generic";
 
   // Parse features string.
index 96c8108b71bc83fd78f197d0a130feefcfb391a8..1070544f0773efbbe33581e78f6e16751f15f8b3 100644 (file)
 #include <string>
 
 namespace llvm {
-class Module;
-class TargetMachine;
 
 class MSP430Subtarget : public TargetSubtarget {
   bool ExtendedInsts;
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  MSP430Subtarget(const TargetMachine &TM, const Module &M,
-                  const std::string &FS);
+  MSP430Subtarget(const std::string &TT, const std::string &FS);
 
   /// ParseSubtargetFeatures - Parses features string setting specified
   /// subtarget options.  Definition of function is auto generated by tblgen.
index 6f57003b541c4b20371ae646f561e5a974657405..e5642db01f519d0ef1418548314f9e98d7fcf81a 100644 (file)
@@ -24,7 +24,7 @@ MSP430TargetMachine::MSP430TargetMachine(const Target &T,
                                          const Module &M,
                                          const std::string &FS) :
   LLVMTargetMachine(T),
-  Subtarget(*this, M, FS),
+  Subtarget(M.getTargetTriple(), FS),
   // FIXME: Check TargetData string.
   DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
   InstrInfo(*this), TLInfo(*this),
index 87c2208e9d42a0cb2fb46270c354610ae69a05be..c56bc9d290d739d9970304299b3a2ec1da331668 100644 (file)
@@ -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 @@ static cl::opt<bool>
 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 @@ MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M,
 
   // Parse features string.
   ParseSubtargetFeatures(FS, CPU);
-  const std::string& TT = M.getTargetTriple();
 
   // Is the target system Linux ?
   if (TT.find("linux") == std::string::npos)
index 2244e497dd756f8393488860843ad88451c65067..2485fef887ea3cd169a94cff123e0ce90422de94 100644 (file)
@@ -20,7 +20,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class MipsSubtarget : public TargetSubtarget {
 
@@ -99,8 +98,8 @@ public:
   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 
index b5e2da74ba7e4b9ffed57875f5df5c1081a648d7..db18b097c40487fdc39a71d6773d9e94e9ea90ec 100644 (file)
@@ -42,7 +42,7 @@ MipsTargetMachine::
 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), 
index db8a5d84a4bff612f9de16ad7eb70e18e6a12f21..33fc3fb169945fcc39901e07e78e644ea7acc814 100644 (file)
@@ -16,7 +16,7 @@
 
 using namespace llvm;
 
-PIC16Subtarget::PIC16Subtarget(const Module &M, const std::string &FS, 
+PIC16Subtarget::PIC16Subtarget(const std::string &TT, const std::string &FS, 
                                bool Cooper)
   :IsCooper(Cooper)
 {
index e5147a0cf892871ca63a24ffea124ef29ba174bc..81e3783d72999f098d75cb4a4dedf92aad47b3e7 100644 (file)
@@ -19,7 +19,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class PIC16Subtarget : public TargetSubtarget {
 
@@ -28,9 +27,9 @@ class PIC16Subtarget : public TargetSubtarget {
 
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  PIC16Subtarget(const Module &M, const std::string &FS, bool Cooper);
+  PIC16Subtarget(const std::string &TT, const std::string &FS, bool Cooper);
   
   /// isCooper - Returns true if the target ISA is Cooper.
   bool isCooper() const { return IsCooper; }
index 1c5d3d4f2e5702d031881c79492f520bb5a472b8..9a3b1858b80200d1e4f0ede3410a46da2b2ef177 100644 (file)
@@ -25,7 +25,7 @@ using namespace llvm;
 PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, 
                                        const std::string &FS, bool Cooper)
 : LLVMTargetMachine(T),
-  Subtarget(M, FS, Cooper),
+  Subtarget(M.getTargetTriple(), FS, Cooper),
   DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), 
   InstrInfo(*this), TLInfo(*this),
   FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
index 9b0dd1f78266137acfa323ba58535153ac861f3b..2db69ecdc66eb0f09a790df655034cf972692a02 100644 (file)
@@ -1201,7 +1201,7 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op,
 
   Lo = DAG.getNode(ISD::ADD, dl, PtrVT, Hi, Lo);
 
-  if (!TM.getSubtarget<PPCSubtarget>().hasLazyResolverStub(GV))
+  if (!TM.getSubtarget<PPCSubtarget>().hasLazyResolverStub(GV, TM))
     return Lo;
 
   // If the global is weak or external, we have to go through the lazy
index 425d8e6195c6a5cd7491ba481d7d96bb7ad8b712..e0937e21c10a8891c9a192b63994b616223ea81c 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "PPCSubtarget.h"
 #include "PPC.h"
-#include "llvm/Module.h"
+#include "llvm/GlobalValue.h"
 #include "llvm/Target/TargetMachine.h"
 #include "PPCGenSubtarget.inc"
 #include <cstdlib>
@@ -57,10 +57,9 @@ static const char *GetCurrentPowerPCCPU() {
 #endif
 
 
-PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
-                           const std::string &FS, bool is64Bit)
-  : TM(tm)
-  , StackAlignment(16)
+PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &FS,
+                           bool is64Bit)
+  : StackAlignment(16)
   , DarwinDirective(PPC::DIR_NONE)
   , IsGigaProcessor(false)
   , Has64BitSupport(false)
@@ -95,7 +94,6 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
   
   // Set the boolean corresponding to the current target triple, or the default
   // if one cannot be determined, to true.
-  const std::string &TT = M.getTargetTriple();
   if (TT.length() > 7) {
     // Determine which version of darwin this is.
     size_t DarwinPos = TT.find("-darwin");
@@ -138,7 +136,8 @@ void PPCSubtarget::SetJITMode() {
 /// hasLazyResolverStub - Return true if accesses to the specified global have
 /// to go through a dyld lazy resolution stub.  This means that an extra load
 /// is required to get the address of the global.
-bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const {
+bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV,
+                                       const TargetMachine &TM) const {
   // We never hae stubs if HasLazyResolverStubs=false or if in static mode.
   if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static)
     return false;
index f633cc6d2da4c2f9bc385f24a36d5ac0b1548ee9..45ff91cb23f2d3c3b54168f9d450c89f44260ba0 100644 (file)
@@ -39,7 +39,6 @@ namespace PPC {
   };
 }
 
-class Module;
 class GlobalValue;
 class TargetMachine;
   
@@ -49,8 +48,6 @@ public:
     OldMnemonic, NewMnemonic, Unset
   };
 protected:
-  const TargetMachine &TM;
-  
   /// stackAlignment - The minimum alignment known to hold of the stack frame on
   /// entry to the function and which must be maintained by every function.
   unsigned StackAlignment;
@@ -79,10 +76,9 @@ protected:
   unsigned char DarwinVers; // Is any darwin-ppc platform.
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  PPCSubtarget(const TargetMachine &TM, const Module &M,
-               const std::string &FS, bool is64Bit);
+  PPCSubtarget(const std::string &TT, const std::string &FS, bool is64Bit);
   
   /// ParseSubtargetFeatures - Parses features string setting specified 
   /// subtarget options.  Definition of function is auto generated by tblgen.
@@ -132,7 +128,8 @@ public:
   /// hasLazyResolverStub - Return true if accesses to the specified global have
   /// to go through a dyld lazy resolution stub.  This means that an extra load
   /// is required to get the address of the global.
-  bool hasLazyResolverStub(const GlobalValue *GV) const;
+  bool hasLazyResolverStub(const GlobalValue *GV, 
+                           const TargetMachine &TM) const;
   
   // Specific obvious features.
   bool hasFSQRT() const { return HasFSQRT; }
index bb228c614ecef448d8490f1579e8fd53ce701569..da6ebc49a93ffd48f8d1f6b7177c724675f625b1 100644 (file)
@@ -37,7 +37,7 @@ const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
 PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M, 
                                    const std::string &FS, bool is64Bit)
   : LLVMTargetMachine(T),
-    Subtarget(*this, M, FS, is64Bit),
+    Subtarget(M.getTargetTriple(), FS, is64Bit),
     DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
     FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this),
     InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) {
index aaddbff073ad552134f6d9962cbba0e5d9839da4..8a88cc076429a7be89d0a232ce63515c52a37858 100644 (file)
@@ -22,7 +22,7 @@ namespace {
                           cl::desc("Enable V9 instructions in the V8 target"));
 }
 
-SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) {
+SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &FS) {
   // Set the default features.
   IsV9 = false;
   V8DeprecatedInsts = false;
index e5a5ba47f1064e3b8ba83ee1c2d328056fbbf957..43770343d3348c5d2bfcac41e76a230faa1b922e 100644 (file)
 #include <string>
 
 namespace llvm {
-  class Module;
-  
+
 class SparcSubtarget : public TargetSubtarget {
   bool IsV9;
   bool V8DeprecatedInsts;
   bool IsVIS;
 public:
-  SparcSubtarget(const Module &M, const std::string &FS);
+  SparcSubtarget(const std::string &TT, const std::string &FS);
 
   bool isV9() const { return IsV9; }
   bool isVIS() const { return IsVIS; }
index 17a419f862e0cab63f356fe7b0ab0ed7152fe4dc..48924d618b2fd58179647db41ea43073576dbdaf 100644 (file)
@@ -34,7 +34,7 @@ SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M,
                                        const std::string &FS)
   : LLVMTargetMachine(T),
     DataLayout("E-p:32:32-f128:128:128"),
-    Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget),
+    Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
 }
 
index 18a8e1633dae03991ccf3e58bae18fa7c77ef101..a8b5e1f18679784c999f0d25b59d75bdf57bdf1c 100644 (file)
@@ -19,7 +19,7 @@
 
 using namespace llvm;
 
-SystemZSubtarget::SystemZSubtarget(const TargetMachine &TM, const Module &M,
+SystemZSubtarget::SystemZSubtarget(const std::string &TT, 
                                    const std::string &FS):
   HasZ10Insts(false) {
   std::string CPU = "z9";
index fd8212c8727900b0f4c4a440a32554e5b041747c..405d6e91b7ee5cea11b1796b153d039164a3f26a 100644 (file)
 #include <string>
 
 namespace llvm {
-class Module;
-class TargetMachine;
 class GlobalValue;
+class TargetMachine;
 
 class SystemZSubtarget : public TargetSubtarget {
   bool HasZ10Insts;
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  SystemZSubtarget(const TargetMachine &TM, const Module &M,
-                   const std::string &FS);
+  SystemZSubtarget(const std::string &TT, const std::string &FS);
 
   /// ParseSubtargetFeatures - Parses features string setting specified
   /// subtarget options.  Definition of function is auto generated by tblgen.
index 8bebf5b41af8bbed0f97c871f6856affe9a66a5f..6a9c10c7b08f78a0d20d8f79253354ac286bfa84 100644 (file)
@@ -33,7 +33,7 @@ SystemZTargetMachine::SystemZTargetMachine(const Target &T,
                                            const Module &M,
                                            const std::string &FS)
   : LLVMTargetMachine(T),
-    Subtarget(*this, M, FS),
+    Subtarget(M.getTargetTriple(), FS),
     DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
                "-f64:64:64-f128:128:128-a0:16:16"),
     InstrInfo(*this), TLInfo(*this),
index 733f02ff06925924f486c5bf195ddc6eee278bb8..6e5d8d808d8a90b2343dc1bb15a113d7677b3c56 100644 (file)
@@ -15,7 +15,7 @@
 #include "X86Subtarget.h"
 #include "X86InstrInfo.h"
 #include "X86GenSubtarget.inc"
-#include "llvm/Module.h"
+#include "llvm/GlobalValue.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetMachine.h"
@@ -383,7 +383,8 @@ static const char *GetCurrentX86CPU() {
   }
 }
 
-X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
+X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS, 
+                           bool is64Bit)
   : AsmFlavor(AsmWriterFlavor)
   , PICStyle(PICStyles::None)
   , X86SSELevel(NoMMXSSE)
@@ -434,7 +435,6 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
 
   // Set the boolean corresponding to the current target triple, or the default
   // if one cannot be determined, to true.
-  const std::string& TT = M.getTargetTriple();
   if (TT.length() > 5) {
     size_t Pos;
     if ((Pos = TT.find("-darwin")) != std::string::npos) {
index 6397a56ab0cf5123bec29a50082ddeb72e70db39..9b8a5a727ab2c160dc2f2459e2e53b622b67e9d7 100644 (file)
@@ -18,7 +18,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 class GlobalValue;
 class TargetMachine;
   
@@ -101,7 +100,7 @@ protected:
   unsigned MaxInlineSizeThreshold;
 
 private:
-  /// Is64Bit - True if the processor supports 64-bit instructions and module
+  /// Is64Bit - True if the processor supports 64-bit instructions and
   /// pointer size is 64 bit.
   bool Is64Bit;
 
@@ -111,9 +110,9 @@ public:
   } TargetType;
 
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  X86Subtarget(const Module &M, const std::string &FS, bool is64Bit);
+  X86Subtarget(const std::string &TT, const std::string &FS, bool is64Bit);
 
   /// getStackAlignment - Returns the minimum alignment known to hold of the
   /// stack frame on entry to the function and which must be maintained by every
index ee0daed167c68ee2f0bf8ecd930cd6634324dd15..56c0e9247694295b69cbce26311485781f186394 100644 (file)
@@ -62,7 +62,7 @@ X86_64TargetMachine::X86_64TargetMachine(const Target &T, const Module &M,
 X86TargetMachine::X86TargetMachine(const Target &T, const Module &M, 
                                    const std::string &FS, bool is64Bit)
   : LLVMTargetMachine(T), 
-    Subtarget(M, FS, is64Bit),
+    Subtarget(M.getTargetTriple(), FS, is64Bit),
     DataLayout(Subtarget.getDataLayout()),
     FrameInfo(TargetFrameInfo::StackGrowsDown,
               Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4),
index dc53da4ddf0bb494a053bf7392d9f46da0815be8..5fb1eaad54b61772a0b2b7f80577f90eee59872a 100644 (file)
@@ -16,8 +16,7 @@
 #include "XCoreGenSubtarget.inc"
 using namespace llvm;
 
-XCoreSubtarget::XCoreSubtarget(const TargetMachine &TM, const Module &M, 
-                             const std::string &FS)
+XCoreSubtarget::XCoreSubtarget(const std::string &TT, const std::string &FS)
   : IsXS1A(false),
     IsXS1B(false)
 {
index ff6475baa81046a12f36603191ab8070ab0dbe92..4839351487bbbce01a00d9fab90b1860da3370b2 100644 (file)
@@ -20,7 +20,6 @@
 #include <string>
 
 namespace llvm {
-class Module;
 
 class XCoreSubtarget : public TargetSubtarget {
   bool IsXS1A;
@@ -28,10 +27,9 @@ class XCoreSubtarget : public TargetSubtarget {
 
 public:
   /// This constructor initializes the data members to match that
-  /// of the specified module.
+  /// of the specified triple.
   ///
-  XCoreSubtarget(const TargetMachine &TM, const Module &M, 
-                const std::string &FS);
+  XCoreSubtarget(const std::string &TT, const std::string &FS);
 
   bool isXS1A() const { return IsXS1A; }
   bool isXS1B() const { return IsXS1B; }
index eac8ca1b15467ad477d816c5bb7b9853d5b85e0c..570e3fd52df359c6fdfdfa9d6473a0a8cde6c677 100644 (file)
@@ -26,7 +26,7 @@ const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const {
 XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Module &M, 
                                        const std::string &FS)
   : LLVMTargetMachine(T),
-    Subtarget(*this, M, FS),
+    Subtarget(M.getTargetTriple(), FS),
     DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-"
                "i16:16:32-i32:32:32-i64:32:32"),
     InstrInfo(),