xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZSubtarget.h (revision 5def4c47d4bd90b209b9b4a4ba9faec15846d8fd)
1 //===-- SystemZSubtarget.h - SystemZ subtarget information -----*- C++ -*--===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the SystemZ specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
14 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
15 
16 #include "SystemZFrameLowering.h"
17 #include "SystemZISelLowering.h"
18 #include "SystemZInstrInfo.h"
19 #include "SystemZRegisterInfo.h"
20 #include "SystemZSelectionDAGInfo.h"
21 #include "llvm/ADT/Triple.h"
22 #include "llvm/CodeGen/TargetSubtargetInfo.h"
23 #include "llvm/IR/DataLayout.h"
24 #include <string>
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "SystemZGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 class GlobalValue;
31 class StringRef;
32 
33 class SystemZSubtarget : public SystemZGenSubtargetInfo {
34   virtual void anchor();
35 protected:
36   bool HasDistinctOps;
37   bool HasLoadStoreOnCond;
38   bool HasHighWord;
39   bool HasFPExtension;
40   bool HasPopulationCount;
41   bool HasMessageSecurityAssist3;
42   bool HasMessageSecurityAssist4;
43   bool HasResetReferenceBitsMultiple;
44   bool HasFastSerialization;
45   bool HasInterlockedAccess1;
46   bool HasMiscellaneousExtensions;
47   bool HasExecutionHint;
48   bool HasLoadAndTrap;
49   bool HasTransactionalExecution;
50   bool HasProcessorAssist;
51   bool HasDFPZonedConversion;
52   bool HasEnhancedDAT2;
53   bool HasVector;
54   bool HasLoadStoreOnCond2;
55   bool HasLoadAndZeroRightmostByte;
56   bool HasMessageSecurityAssist5;
57   bool HasDFPPackedConversion;
58   bool HasMiscellaneousExtensions2;
59   bool HasGuardedStorage;
60   bool HasMessageSecurityAssist7;
61   bool HasMessageSecurityAssist8;
62   bool HasVectorEnhancements1;
63   bool HasVectorPackedDecimal;
64   bool HasInsertReferenceBitsMultiple;
65   bool HasMiscellaneousExtensions3;
66   bool HasMessageSecurityAssist9;
67   bool HasVectorEnhancements2;
68   bool HasVectorPackedDecimalEnhancement;
69   bool HasEnhancedSort;
70   bool HasDeflateConversion;
71   bool HasSoftFloat;
72 
73 private:
74   Triple TargetTriple;
75   SystemZInstrInfo InstrInfo;
76   SystemZTargetLowering TLInfo;
77   SystemZSelectionDAGInfo TSInfo;
78   SystemZFrameLowering FrameLowering;
79 
80   SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
81                                                     StringRef FS);
82 public:
83   SystemZSubtarget(const Triple &TT, const std::string &CPU,
84                    const std::string &FS, const TargetMachine &TM);
85 
86   const TargetFrameLowering *getFrameLowering() const override {
87     return &FrameLowering;
88   }
89   const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
90   const SystemZRegisterInfo *getRegisterInfo() const override {
91     return &InstrInfo.getRegisterInfo();
92   }
93   const SystemZTargetLowering *getTargetLowering() const override {
94     return &TLInfo;
95   }
96   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
97     return &TSInfo;
98   }
99 
100   // True if the subtarget should run MachineScheduler after aggressive
101   // coalescing. This currently replaces the SelectionDAG scheduler with the
102   // "source" order scheduler.
103   bool enableMachineScheduler() const override { return true; }
104 
105   // This is important for reducing register pressure in vector code.
106   bool useAA() const override { return true; }
107 
108   // Always enable the early if-conversion pass.
109   bool enableEarlyIfConversion() const override { return true; }
110 
111   // Enable tracking of subregister liveness in register allocator.
112   bool enableSubRegLiveness() const override;
113 
114   // Automatically generated by tblgen.
115   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
116 
117   // Return true if the target has the distinct-operands facility.
118   bool hasDistinctOps() const { return HasDistinctOps; }
119 
120   // Return true if the target has the load/store-on-condition facility.
121   bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
122 
123   // Return true if the target has the load/store-on-condition facility 2.
124   bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
125 
126   // Return true if the target has the high-word facility.
127   bool hasHighWord() const { return HasHighWord; }
128 
129   // Return true if the target has the floating-point extension facility.
130   bool hasFPExtension() const { return HasFPExtension; }
131 
132   // Return true if the target has the population-count facility.
133   bool hasPopulationCount() const { return HasPopulationCount; }
134 
135   // Return true if the target has the message-security-assist
136   // extension facility 3.
137   bool hasMessageSecurityAssist3() const { return HasMessageSecurityAssist3; }
138 
139   // Return true if the target has the message-security-assist
140   // extension facility 4.
141   bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; }
142 
143   // Return true if the target has the reset-reference-bits-multiple facility.
144   bool hasResetReferenceBitsMultiple() const {
145     return HasResetReferenceBitsMultiple;
146   }
147 
148   // Return true if the target has the fast-serialization facility.
149   bool hasFastSerialization() const { return HasFastSerialization; }
150 
151   // Return true if the target has interlocked-access facility 1.
152   bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
153 
154   // Return true if the target has the miscellaneous-extensions facility.
155   bool hasMiscellaneousExtensions() const {
156     return HasMiscellaneousExtensions;
157   }
158 
159   // Return true if the target has the execution-hint facility.
160   bool hasExecutionHint() const { return HasExecutionHint; }
161 
162   // Return true if the target has the load-and-trap facility.
163   bool hasLoadAndTrap() const { return HasLoadAndTrap; }
164 
165   // Return true if the target has the transactional-execution facility.
166   bool hasTransactionalExecution() const { return HasTransactionalExecution; }
167 
168   // Return true if the target has the processor-assist facility.
169   bool hasProcessorAssist() const { return HasProcessorAssist; }
170 
171   // Return true if the target has the DFP zoned-conversion facility.
172   bool hasDFPZonedConversion() const { return HasDFPZonedConversion; }
173 
174   // Return true if the target has the enhanced-DAT facility 2.
175   bool hasEnhancedDAT2() const { return HasEnhancedDAT2; }
176 
177   // Return true if the target has the load-and-zero-rightmost-byte facility.
178   bool hasLoadAndZeroRightmostByte() const {
179     return HasLoadAndZeroRightmostByte;
180   }
181 
182   // Return true if the target has the message-security-assist
183   // extension facility 5.
184   bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; }
185 
186   // Return true if the target has the DFP packed-conversion facility.
187   bool hasDFPPackedConversion() const { return HasDFPPackedConversion; }
188 
189   // Return true if the target has the vector facility.
190   bool hasVector() const { return HasVector; }
191 
192   // Return true if the target has the miscellaneous-extensions facility 2.
193   bool hasMiscellaneousExtensions2() const {
194     return HasMiscellaneousExtensions2;
195   }
196 
197   // Return true if the target has the guarded-storage facility.
198   bool hasGuardedStorage() const { return HasGuardedStorage; }
199 
200   // Return true if the target has the message-security-assist
201   // extension facility 7.
202   bool hasMessageSecurityAssist7() const { return HasMessageSecurityAssist7; }
203 
204   // Return true if the target has the message-security-assist
205   // extension facility 8.
206   bool hasMessageSecurityAssist8() const { return HasMessageSecurityAssist8; }
207 
208   // Return true if the target has the vector-enhancements facility 1.
209   bool hasVectorEnhancements1() const { return HasVectorEnhancements1; }
210 
211   // Return true if the target has the vector-packed-decimal facility.
212   bool hasVectorPackedDecimal() const { return HasVectorPackedDecimal; }
213 
214   // Return true if the target has the insert-reference-bits-multiple facility.
215   bool hasInsertReferenceBitsMultiple() const {
216     return HasInsertReferenceBitsMultiple;
217   }
218 
219   // Return true if the target has the miscellaneous-extensions facility 3.
220   bool hasMiscellaneousExtensions3() const {
221     return HasMiscellaneousExtensions3;
222   }
223 
224   // Return true if the target has the message-security-assist
225   // extension facility 9.
226   bool hasMessageSecurityAssist9() const { return HasMessageSecurityAssist9; }
227 
228   // Return true if the target has the vector-enhancements facility 2.
229   bool hasVectorEnhancements2() const { return HasVectorEnhancements2; }
230 
231   // Return true if the target has the vector-packed-decimal
232   // enhancement facility.
233   bool hasVectorPackedDecimalEnhancement() const {
234     return HasVectorPackedDecimalEnhancement;
235   }
236 
237   // Return true if the target has the enhanced-sort facility.
238   bool hasEnhancedSort() const { return HasEnhancedSort; }
239 
240   // Return true if the target has the deflate-conversion facility.
241   bool hasDeflateConversion() const { return HasDeflateConversion; }
242 
243   // Return true if soft float should be used.
244   bool hasSoftFloat() const { return HasSoftFloat; }
245 
246   // Return true if GV can be accessed using LARL for reloc model RM
247   // and code model CM.
248   bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
249 
250   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
251 };
252 } // end namespace llvm
253 
254 #endif
255