]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/SystemZ/SystemZSubtarget.h
Merge ^/head r318658 through r318963.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / SystemZ / SystemZSubtarget.h
1 //===-- SystemZSubtarget.h - SystemZ subtarget information -----*- C++ -*--===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the SystemZ specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
15 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
16
17 #include "SystemZFrameLowering.h"
18 #include "SystemZISelLowering.h"
19 #include "SystemZInstrInfo.h"
20 #include "SystemZRegisterInfo.h"
21 #include "SystemZSelectionDAGInfo.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/ADT/Triple.h"
24 #include "llvm/Target/TargetSubtargetInfo.h"
25 #include <string>
26
27 #define GET_SUBTARGETINFO_HEADER
28 #include "SystemZGenSubtargetInfo.inc"
29
30 namespace llvm {
31 class GlobalValue;
32 class StringRef;
33
34 class SystemZSubtarget : public SystemZGenSubtargetInfo {
35   virtual void anchor();
36 protected:
37   bool HasDistinctOps;
38   bool HasLoadStoreOnCond;
39   bool HasHighWord;
40   bool HasFPExtension;
41   bool HasPopulationCount;
42   bool HasMessageSecurityAssist4;
43   bool HasFastSerialization;
44   bool HasInterlockedAccess1;
45   bool HasMiscellaneousExtensions;
46   bool HasExecutionHint;
47   bool HasLoadAndTrap;
48   bool HasTransactionalExecution;
49   bool HasProcessorAssist;
50   bool HasVector;
51   bool HasLoadStoreOnCond2;
52   bool HasLoadAndZeroRightmostByte;
53   bool HasMessageSecurityAssist5;
54
55 private:
56   Triple TargetTriple;
57   SystemZInstrInfo InstrInfo;
58   SystemZTargetLowering TLInfo;
59   SystemZSelectionDAGInfo TSInfo;
60   SystemZFrameLowering FrameLowering;
61
62   SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
63                                                     StringRef FS);
64 public:
65   SystemZSubtarget(const Triple &TT, const std::string &CPU,
66                    const std::string &FS, const TargetMachine &TM);
67
68   const TargetFrameLowering *getFrameLowering() const override {
69     return &FrameLowering;
70   }
71   const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
72   const SystemZRegisterInfo *getRegisterInfo() const override {
73     return &InstrInfo.getRegisterInfo();
74   }
75   const SystemZTargetLowering *getTargetLowering() const override {
76     return &TLInfo;
77   }
78   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
79     return &TSInfo;
80   }
81
82   // This is important for reducing register pressure in vector code.
83   bool useAA() const override { return true; }
84
85   // Always enable the early if-conversion pass.
86   bool enableEarlyIfConversion() const override { return true; }
87
88   // Automatically generated by tblgen.
89   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
90
91   // Return true if the target has the distinct-operands facility.
92   bool hasDistinctOps() const { return HasDistinctOps; }
93
94   // Return true if the target has the load/store-on-condition facility.
95   bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
96
97   // Return true if the target has the load/store-on-condition facility 2.
98   bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
99
100   // Return true if the target has the high-word facility.
101   bool hasHighWord() const { return HasHighWord; }
102
103   // Return true if the target has the floating-point extension facility.
104   bool hasFPExtension() const { return HasFPExtension; }
105
106   // Return true if the target has the population-count facility.
107   bool hasPopulationCount() const { return HasPopulationCount; }
108
109   // Return true if the target has the message-security-assist
110   // extension facility 4.
111   bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; }
112
113   // Return true if the target has the fast-serialization facility.
114   bool hasFastSerialization() const { return HasFastSerialization; }
115
116   // Return true if the target has interlocked-access facility 1.
117   bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
118
119   // Return true if the target has the miscellaneous-extensions facility.
120   bool hasMiscellaneousExtensions() const {
121     return HasMiscellaneousExtensions;
122   }
123
124   // Return true if the target has the execution-hint facility.
125   bool hasExecutionHint() const { return HasExecutionHint; }
126
127   // Return true if the target has the load-and-trap facility.
128   bool hasLoadAndTrap() const { return HasLoadAndTrap; }
129
130   // Return true if the target has the transactional-execution facility.
131   bool hasTransactionalExecution() const { return HasTransactionalExecution; }
132
133   // Return true if the target has the processor-assist facility.
134   bool hasProcessorAssist() const { return HasProcessorAssist; }
135
136   // Return true if the target has the load-and-zero-rightmost-byte facility.
137   bool hasLoadAndZeroRightmostByte() const {
138     return HasLoadAndZeroRightmostByte;
139   }
140
141   // Return true if the target has the message-security-assist
142   // extension facility 5.
143   bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; }
144
145   // Return true if the target has the vector facility.
146   bool hasVector() const { return HasVector; }
147
148   // Return true if GV can be accessed using LARL for reloc model RM
149   // and code model CM.
150   bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
151
152   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
153 };
154 } // end namespace llvm
155
156 #endif