llvm.org GIT mirror llvm / 3be0340
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 Daniel Dunbar 10 years ago
37 changed file(s) with 60 addition(s) and 99 deletion(s). Raw diff Collapse all Expand all
1212
1313 #include "ARMSubtarget.h"
1414 #include "ARMGenSubtarget.inc"
15 #include "llvm/Module.h"
16 #include "llvm/Target/TargetMachine.h"
1715 #include "llvm/Target/TargetOptions.h"
1816 #include "llvm/Support/CommandLine.h"
1917 using namespace llvm;
2220 ReserveR9("arm-reserve-r9", cl::Hidden,
2321 cl::desc("Reserve R9, making it unavailable as GPR"));
2422
25 ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS,
23 ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
2624 bool isThumb)
2725 : ARMArchVersion(V4T)
2826 , ARMFPUType(None)
4442
4543 // Set the boolean corresponding to the current target triple, or the default
4644 // if one cannot be determined, to true.
47 const std::string& TT = M.getTargetTriple();
4845 unsigned Len = TT.length();
4946 unsigned Idx = 0;
5047
1818 #include
1919
2020 namespace llvm {
21 class Module;
2221
2322 class ARMSubtarget : public TargetSubtarget {
2423 protected:
7271 } TargetABI;
7372
7473 /// This constructor initializes the data members to match that
75 /// of the specified module.
74 /// of the specified triple.
7675 ///
77 ARMSubtarget(const Module &M, const std::string &FS, bool isThumb);
76 ARMSubtarget(const std::string &TT, const std::string &FS, bool isThumb);
7877
7978 /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
8079 /// that still makes it profitable to inline the call.
4040 const std::string &FS,
4141 bool isThumb)
4242 : LLVMTargetMachine(T),
43 Subtarget(M, FS, isThumb),
43 Subtarget(M.getTargetTriple(), FS, isThumb),
4444 FrameInfo(Subtarget),
4545 JITInfo(),
4646 InstrItins(Subtarget.getInstrItineraryData()) {
1515 #include "AlphaGenSubtarget.inc"
1616 using namespace llvm;
1717
18 AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS)
18 AlphaSubtarget::AlphaSubtarget(const std::string &TT, const std::string &FS)
1919 : HasCT(false) {
2020 std::string CPU = "generic";
2121
1919 #include
2020
2121 namespace llvm {
22 class Module;
2322
2423 class AlphaSubtarget : public TargetSubtarget {
2524 protected:
3029
3130 public:
3231 /// This constructor initializes the data members to match that
33 /// of the specified module.
32 /// of the specified triple.
3433 ///
35 AlphaSubtarget(const Module &M, const std::string &FS);
34 AlphaSubtarget(const std::string &TT, const std::string &FS);
3635
3736 /// ParseSubtargetFeatures - Parses features string setting specified
3837 /// subtarget options. Definition of function is auto generated by tblgen.
3535 DataLayout("e-f128:128:128"),
3636 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
3737 JITInfo(*this),
38 Subtarget(M, FS),
38 Subtarget(M.getTargetTriple(), FS),
3939 TLInfo(*this) {
4040 setRelocationModel(Reloc::PIC_);
4141 }
1515
1616 using namespace llvm;
1717
18 BlackfinSubtarget::BlackfinSubtarget(const TargetMachine &TM,
19 const Module &M,
18 BlackfinSubtarget::BlackfinSubtarget(const std::string &TT,
2019 const std::string &FS)
2120 : sdram(false),
2221 icplb(false),
1818
1919 namespace llvm {
2020
21 class TargetMachine;
22 class Module;
23
2421 class BlackfinSubtarget : public TargetSubtarget {
2522 bool sdram;
2623 bool icplb;
3431 bool wa_killed_mmr;
3532 bool wa_rets;
3633 public:
37 BlackfinSubtarget(const TargetMachine &TM, const Module &M,
38 const std::string &FS);
34 BlackfinSubtarget(const std::string &TT, const std::string &FS);
3935
4036 /// ParseSubtargetFeatures - Parses features string setting specified
4137 /// subtarget options. Definition of function is auto generated by tblgen.
3131 const std::string &FS)
3232 : LLVMTargetMachine(T),
3333 DataLayout("e-p:32:32-i64:32-f64:32"),
34 Subtarget(*this, M, FS),
34 Subtarget(M.getTargetTriple(), FS),
3535 TLInfo(*this),
3636 InstrInfo(Subtarget),
3737 FrameInfo(TargetFrameInfo::StackGrowsDown, 4, 0) {
1212
1313 #include "SPUSubtarget.h"
1414 #include "SPU.h"
15 #include "llvm/Module.h"
16 #include "llvm/Target/TargetMachine.h"
1715 #include "SPUGenSubtarget.inc"
1816
1917 using namespace llvm;
2018
21 SPUSubtarget::SPUSubtarget(const TargetMachine &tm, const Module &M,
22 const std::string &FS) :
23 TM(tm),
19 SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &FS) :
2420 StackAlignment(16),
2521 ProcDirective(SPU::DEFAULT_PROC),
2622 UseLargeMem(false)
1919 #include
2020
2121 namespace llvm {
22 class Module;
2322 class GlobalValue;
24 class TargetMachine;
2523
2624 namespace SPU {
2725 enum {
3230
3331 class SPUSubtarget : public TargetSubtarget {
3432 protected:
35 const TargetMachine &TM;
36
3733 /// stackAlignment - The minimum alignment known to hold of the stack frame
3834 /// on entry to the function and which must be maintained by every function.
3935 unsigned StackAlignment;
5147
5248 public:
5349 /// This constructor initializes the data members to match that
54 /// of the specified module.
50 /// of the specified triple.
5551 ///
56 SPUSubtarget(const TargetMachine &TM, const Module &M,
57 const std::string &FS);
52 SPUSubtarget(const std::string &TT, const std::string &FS);
5853
5954 /// ParseSubtargetFeatures - Parses features string setting specified
6055 /// subtarget options. Definition of function is auto generated by tblgen.
4040 SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M,
4141 const std::string &FS)
4242 : LLVMTargetMachine(T),
43 Subtarget(*this, M, FS),
43 Subtarget(M.getTargetTriple(), FS),
4444 DataLayout(Subtarget.getTargetDataString()),
4545 InstrInfo(*this),
4646 FrameInfo(*this),
1313 #include "MSP430Subtarget.h"
1414 #include "MSP430.h"
1515 #include "MSP430GenSubtarget.inc"
16 #include "llvm/Target/TargetMachine.h"
1716
1817 using namespace llvm;
1918
20 MSP430Subtarget::MSP430Subtarget(const TargetMachine &TM, const Module &M,
21 const std::string &FS) {
19 MSP430Subtarget::MSP430Subtarget(const std::string &TT, const std::string &FS) {
2220 std::string CPU = "generic";
2321
2422 // Parse features string.
1818 #include
1919
2020 namespace llvm {
21 class Module;
22 class TargetMachine;
2321
2422 class MSP430Subtarget : public TargetSubtarget {
2523 bool ExtendedInsts;
2624 public:
2725 /// This constructor initializes the data members to match that
28 /// of the specified module.
26 /// of the specified triple.
2927 ///
30 MSP430Subtarget(const TargetMachine &TM, const Module &M,
31 const std::string &FS);
28 MSP430Subtarget(const std::string &TT, const std::string &FS);
3229
3330 /// ParseSubtargetFeatures - Parses features string setting specified
3431 /// subtarget options. Definition of function is auto generated by tblgen.
2323 const Module &M,
2424 const std::string &FS) :
2525 LLVMTargetMachine(T),
26 Subtarget(*this, M, FS),
26 Subtarget(M.getTargetTriple(), FS),
2727 // FIXME: Check TargetData string.
2828 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
2929 InstrInfo(*this), TLInfo(*this),
1313 #include "MipsSubtarget.h"
1414 #include "Mips.h"
1515 #include "MipsGenSubtarget.inc"
16 #include "llvm/Module.h"
1716 #include "llvm/Support/CommandLine.h"
1817 using namespace llvm;
1918
2423 AbsoluteCall("enable-mips-absolute-call", cl::Hidden,
2524 cl::desc("Enable absolute call within abicall"));
2625
27 MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M,
26 MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const std::string &TT,
2827 const std::string &FS, bool little) :
2928 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
3029 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasABICall(true),
3635
3736 // Parse features string.
3837 ParseSubtargetFeatures(FS, CPU);
39 const std::string& TT = M.getTargetTriple();
4038
4139 // Is the target system Linux ?
4240 if (TT.find("linux") == std::string::npos)
1919 #include
2020
2121 namespace llvm {
22 class Module;
2322
2423 class MipsSubtarget : public TargetSubtarget {
2524
9897 unsigned getTargetABI() const { return MipsABI; }
9998
10099 /// This constructor initializes the data members to match that
101 /// of the specified module.
102 MipsSubtarget(const TargetMachine &TM, const Module &M,
100 /// of the specified triple.
101 MipsSubtarget(const TargetMachine &TM, const std::string &TT,
103102 const std::string &FS, bool little);
104103
105104 /// ParseSubtargetFeatures - Parses features string setting specified
4141 MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
4242 bool isLittle=false):
4343 LLVMTargetMachine(T),
44 Subtarget(*this, M, FS, isLittle),
44 Subtarget(*this, M.getTargetTriple(), FS, isLittle),
4545 DataLayout(isLittle ? std::string("e-p:32:32:32-i8:8:32-i16:16:32") :
4646 std::string("E-p:32:32:32-i8:8:32-i16:16:32")),
4747 InstrInfo(*this),
1515
1616 using namespace llvm;
1717
18 PIC16Subtarget::PIC16Subtarget(const Module &M, const std::string &FS,
18 PIC16Subtarget::PIC16Subtarget(const std::string &TT, const std::string &FS,
1919 bool Cooper)
2020 :IsCooper(Cooper)
2121 {
1818 #include
1919
2020 namespace llvm {
21 class Module;
2221
2322 class PIC16Subtarget : public TargetSubtarget {
2423
2726
2827 public:
2928 /// This constructor initializes the data members to match that
30 /// of the specified module.
29 /// of the specified triple.
3130 ///
32 PIC16Subtarget(const Module &M, const std::string &FS, bool Cooper);
31 PIC16Subtarget(const std::string &TT, const std::string &FS, bool Cooper);
3332
3433 /// isCooper - Returns true if the target ISA is Cooper.
3534 bool isCooper() const { return IsCooper; }
2424 PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M,
2525 const std::string &FS, bool Cooper)
2626 : LLVMTargetMachine(T),
27 Subtarget(M, FS, Cooper),
27 Subtarget(M.getTargetTriple(), FS, Cooper),
2828 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
2929 InstrInfo(*this), TLInfo(*this),
3030 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
12001200
12011201 Lo = DAG.getNode(ISD::ADD, dl, PtrVT, Hi, Lo);
12021202
1203 if (!TM.getSubtarget().hasLazyResolverStub(GV))
1203 if (!TM.getSubtarget().hasLazyResolverStub(GV, TM))
12041204 return Lo;
12051205
12061206 // If the global is weak or external, we have to go through the lazy
1212
1313 #include "PPCSubtarget.h"
1414 #include "PPC.h"
15 #include "llvm/Module.h"
15 #include "llvm/GlobalValue.h"
1616 #include "llvm/Target/TargetMachine.h"
1717 #include "PPCGenSubtarget.inc"
1818 #include
5656 #endif
5757
5858
59 PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
60 const std::string &FS, bool is64Bit)
61 : TM(tm)
62 , StackAlignment(16)
59 PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &FS,
60 bool is64Bit)
61 : StackAlignment(16)
6362 , DarwinDirective(PPC::DIR_NONE)
6463 , IsGigaProcessor(false)
6564 , Has64BitSupport(false)
9493
9594 // Set the boolean corresponding to the current target triple, or the default
9695 // if one cannot be determined, to true.
97 const std::string &TT = M.getTargetTriple();
9896 if (TT.length() > 7) {
9997 // Determine which version of darwin this is.
10098 size_t DarwinPos = TT.find("-darwin");
137135 /// hasLazyResolverStub - Return true if accesses to the specified global have
138136 /// to go through a dyld lazy resolution stub. This means that an extra load
139137 /// is required to get the address of the global.
140 bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const {
138 bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV,
139 const TargetMachine &TM) const {
141140 // We never hae stubs if HasLazyResolverStubs=false or if in static mode.
142141 if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static)
143142 return false;
3838 };
3939 }
4040
41 class Module;
4241 class GlobalValue;
4342 class TargetMachine;
4443
4847 OldMnemonic, NewMnemonic, Unset
4948 };
5049 protected:
51 const TargetMachine &TM;
52
5350 /// stackAlignment - The minimum alignment known to hold of the stack frame on
5451 /// entry to the function and which must be maintained by every function.
5552 unsigned StackAlignment;
7875 unsigned char DarwinVers; // Is any darwin-ppc platform.
7976 public:
8077 /// This constructor initializes the data members to match that
81 /// of the specified module.
78 /// of the specified triple.
8279 ///
83 PPCSubtarget(const TargetMachine &TM, const Module &M,
84 const std::string &FS, bool is64Bit);
80 PPCSubtarget(const std::string &TT, const std::string &FS, bool is64Bit);
8581
8682 /// ParseSubtargetFeatures - Parses features string setting specified
8783 /// subtarget options. Definition of function is auto generated by tblgen.
131127 /// hasLazyResolverStub - Return true if accesses to the specified global have
132128 /// to go through a dyld lazy resolution stub. This means that an extra load
133129 /// is required to get the address of the global.
134 bool hasLazyResolverStub(const GlobalValue *GV) const;
130 bool hasLazyResolverStub(const GlobalValue *GV,
131 const TargetMachine &TM) const;
135132
136133 // Specific obvious features.
137134 bool hasFSQRT() const { return HasFSQRT; }
3636 PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M,
3737 const std::string &FS, bool is64Bit)
3838 : LLVMTargetMachine(T),
39 Subtarget(*this, M, FS, is64Bit),
39 Subtarget(M.getTargetTriple(), FS, is64Bit),
4040 DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
4141 FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this),
4242 InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) {
2121 cl::desc("Enable V9 instructions in the V8 target"));
2222 }
2323
24 SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) {
24 SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &FS) {
2525 // Set the default features.
2626 IsV9 = false;
2727 V8DeprecatedInsts = false;
1717 #include
1818
1919 namespace llvm {
20 class Module;
21
20
2221 class SparcSubtarget : public TargetSubtarget {
2322 bool IsV9;
2423 bool V8DeprecatedInsts;
2524 bool IsVIS;
2625 public:
27 SparcSubtarget(const Module &M, const std::string &FS);
26 SparcSubtarget(const std::string &TT, const std::string &FS);
2827
2928 bool isV9() const { return IsV9; }
3029 bool isVIS() const { return IsVIS; }
3333 const std::string &FS)
3434 : LLVMTargetMachine(T),
3535 DataLayout("E-p:32:32-f128:128:128"),
36 Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget),
36 Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget),
3737 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
3838 }
3939
1818
1919 using namespace llvm;
2020
21 SystemZSubtarget::SystemZSubtarget(const TargetMachine &TM, const Module &M,
21 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
2222 const std::string &FS):
2323 HasZ10Insts(false) {
2424 std::string CPU = "z9";
1818 #include
1919
2020 namespace llvm {
21 class Module;
21 class GlobalValue;
2222 class TargetMachine;
23 class GlobalValue;
2423
2524 class SystemZSubtarget : public TargetSubtarget {
2625 bool HasZ10Insts;
2726 public:
2827 /// This constructor initializes the data members to match that
29 /// of the specified module.
28 /// of the specified triple.
3029 ///
31 SystemZSubtarget(const TargetMachine &TM, const Module &M,
32 const std::string &FS);
30 SystemZSubtarget(const std::string &TT, const std::string &FS);
3331
3432 /// ParseSubtargetFeatures - Parses features string setting specified
3533 /// subtarget options. Definition of function is auto generated by tblgen.
3232 const Module &M,
3333 const std::string &FS)
3434 : LLVMTargetMachine(T),
35 Subtarget(*this, M, FS),
35 Subtarget(M.getTargetTriple(), FS),
3636 DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
3737 "-f64:64:64-f128:128:128-a0:16:16"),
3838 InstrInfo(*this), TLInfo(*this),
1414 #include "X86Subtarget.h"
1515 #include "X86InstrInfo.h"
1616 #include "X86GenSubtarget.inc"
17 #include "llvm/Module.h"
17 #include "llvm/GlobalValue.h"
1818 #include "llvm/Support/CommandLine.h"
1919 #include "llvm/Support/Debug.h"
2020 #include "llvm/Target/TargetMachine.h"
382382 }
383383 }
384384
385 X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
385 X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
386 bool is64Bit)
386387 : AsmFlavor(AsmWriterFlavor)
387388 , PICStyle(PICStyles::None)
388389 , X86SSELevel(NoMMXSSE)
433434
434435 // Set the boolean corresponding to the current target triple, or the default
435436 // if one cannot be determined, to true.
436 const std::string& TT = M.getTargetTriple();
437437 if (TT.length() > 5) {
438438 size_t Pos;
439439 if ((Pos = TT.find("-darwin")) != std::string::npos) {
1717 #include
1818
1919 namespace llvm {
20 class Module;
2120 class GlobalValue;
2221 class TargetMachine;
2322
10099 unsigned MaxInlineSizeThreshold;
101100
102101 private:
103 /// Is64Bit - True if the processor supports 64-bit instructions and module
102 /// Is64Bit - True if the processor supports 64-bit instructions and
104103 /// pointer size is 64 bit.
105104 bool Is64Bit;
106105
110109 } TargetType;
111110
112111 /// This constructor initializes the data members to match that
113 /// of the specified module.
114 ///
115 X86Subtarget(const Module &M, const std::string &FS, bool is64Bit);
112 /// of the specified triple.
113 ///
114 X86Subtarget(const std::string &TT, const std::string &FS, bool is64Bit);
116115
117116 /// getStackAlignment - Returns the minimum alignment known to hold of the
118117 /// stack frame on entry to the function and which must be maintained by every
6161 X86TargetMachine::X86TargetMachine(const Target &T, const Module &M,
6262 const std::string &FS, bool is64Bit)
6363 : LLVMTargetMachine(T),
64 Subtarget(M, FS, is64Bit),
64 Subtarget(M.getTargetTriple(), FS, is64Bit),
6565 DataLayout(Subtarget.getDataLayout()),
6666 FrameInfo(TargetFrameInfo::StackGrowsDown,
6767 Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4),
1515 #include "XCoreGenSubtarget.inc"
1616 using namespace llvm;
1717
18 XCoreSubtarget::XCoreSubtarget(const TargetMachine &TM, const Module &M,
19 const std::string &FS)
18 XCoreSubtarget::XCoreSubtarget(const std::string &TT, const std::string &FS)
2019 : IsXS1A(false),
2120 IsXS1B(false)
2221 {
1919 #include
2020
2121 namespace llvm {
22 class Module;
2322
2423 class XCoreSubtarget : public TargetSubtarget {
2524 bool IsXS1A;
2726
2827 public:
2928 /// This constructor initializes the data members to match that
30 /// of the specified module.
29 /// of the specified triple.
3130 ///
32 XCoreSubtarget(const TargetMachine &TM, const Module &M,
33 const std::string &FS);
31 XCoreSubtarget(const std::string &TT, const std::string &FS);
3432
3533 bool isXS1A() const { return IsXS1A; }
3634 bool isXS1B() const { return IsXS1B; }
2525 XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Module &M,
2626 const std::string &FS)
2727 : LLVMTargetMachine(T),
28 Subtarget(*this, M, FS),
28 Subtarget(M.getTargetTriple(), FS),
2929 DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-"
3030 "i16:16:32-i32:32:32-i64:32:32"),
3131 InstrInfo(),