xref: /netbsd-src/external/apache2/llvm/dist/llvm/lib/Target/SystemZ/SystemZSubtarget.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
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   SystemZCallingConventionRegisters *SpecialRegisters;
76   SystemZInstrInfo InstrInfo;
77   SystemZTargetLowering TLInfo;
78   SystemZSelectionDAGInfo TSInfo;
79   SystemZFrameLowering FrameLowering;
80 
81   SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
82                                                     StringRef FS);
83   SystemZCallingConventionRegisters *initializeSpecialRegisters(void);
84 
85 public:
86   SystemZSubtarget(const Triple &TT, const std::string &CPU,
87                    const std::string &FS, const TargetMachine &TM);
88 
89   ~SystemZSubtarget();
90 
getSpecialRegisters()91   SystemZCallingConventionRegisters *getSpecialRegisters() const {
92     assert(SpecialRegisters && "Unsupported SystemZ calling convention");
93     return SpecialRegisters;
94   }
95 
getFrameLowering()96   const TargetFrameLowering *getFrameLowering() const override {
97     return &FrameLowering;
98   }
getInstrInfo()99   const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
getRegisterInfo()100   const SystemZRegisterInfo *getRegisterInfo() const override {
101     return &InstrInfo.getRegisterInfo();
102   }
getTargetLowering()103   const SystemZTargetLowering *getTargetLowering() const override {
104     return &TLInfo;
105   }
getSelectionDAGInfo()106   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
107     return &TSInfo;
108   }
109 
110   // True if the subtarget should run MachineScheduler after aggressive
111   // coalescing. This currently replaces the SelectionDAG scheduler with the
112   // "source" order scheduler.
enableMachineScheduler()113   bool enableMachineScheduler() const override { return true; }
114 
115   // This is important for reducing register pressure in vector code.
useAA()116   bool useAA() const override { return true; }
117 
118   // Always enable the early if-conversion pass.
enableEarlyIfConversion()119   bool enableEarlyIfConversion() const override { return true; }
120 
121   // Enable tracking of subregister liveness in register allocator.
122   bool enableSubRegLiveness() const override;
123 
124   // Automatically generated by tblgen.
125   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
126 
127   // Return true if the target has the distinct-operands facility.
hasDistinctOps()128   bool hasDistinctOps() const { return HasDistinctOps; }
129 
130   // Return true if the target has the load/store-on-condition facility.
hasLoadStoreOnCond()131   bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
132 
133   // Return true if the target has the load/store-on-condition facility 2.
hasLoadStoreOnCond2()134   bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
135 
136   // Return true if the target has the high-word facility.
hasHighWord()137   bool hasHighWord() const { return HasHighWord; }
138 
139   // Return true if the target has the floating-point extension facility.
hasFPExtension()140   bool hasFPExtension() const { return HasFPExtension; }
141 
142   // Return true if the target has the population-count facility.
hasPopulationCount()143   bool hasPopulationCount() const { return HasPopulationCount; }
144 
145   // Return true if the target has the message-security-assist
146   // extension facility 3.
hasMessageSecurityAssist3()147   bool hasMessageSecurityAssist3() const { return HasMessageSecurityAssist3; }
148 
149   // Return true if the target has the message-security-assist
150   // extension facility 4.
hasMessageSecurityAssist4()151   bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; }
152 
153   // Return true if the target has the reset-reference-bits-multiple facility.
hasResetReferenceBitsMultiple()154   bool hasResetReferenceBitsMultiple() const {
155     return HasResetReferenceBitsMultiple;
156   }
157 
158   // Return true if the target has the fast-serialization facility.
hasFastSerialization()159   bool hasFastSerialization() const { return HasFastSerialization; }
160 
161   // Return true if the target has interlocked-access facility 1.
hasInterlockedAccess1()162   bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
163 
164   // Return true if the target has the miscellaneous-extensions facility.
hasMiscellaneousExtensions()165   bool hasMiscellaneousExtensions() const {
166     return HasMiscellaneousExtensions;
167   }
168 
169   // Return true if the target has the execution-hint facility.
hasExecutionHint()170   bool hasExecutionHint() const { return HasExecutionHint; }
171 
172   // Return true if the target has the load-and-trap facility.
hasLoadAndTrap()173   bool hasLoadAndTrap() const { return HasLoadAndTrap; }
174 
175   // Return true if the target has the transactional-execution facility.
hasTransactionalExecution()176   bool hasTransactionalExecution() const { return HasTransactionalExecution; }
177 
178   // Return true if the target has the processor-assist facility.
hasProcessorAssist()179   bool hasProcessorAssist() const { return HasProcessorAssist; }
180 
181   // Return true if the target has the DFP zoned-conversion facility.
hasDFPZonedConversion()182   bool hasDFPZonedConversion() const { return HasDFPZonedConversion; }
183 
184   // Return true if the target has the enhanced-DAT facility 2.
hasEnhancedDAT2()185   bool hasEnhancedDAT2() const { return HasEnhancedDAT2; }
186 
187   // Return true if the target has the load-and-zero-rightmost-byte facility.
hasLoadAndZeroRightmostByte()188   bool hasLoadAndZeroRightmostByte() const {
189     return HasLoadAndZeroRightmostByte;
190   }
191 
192   // Return true if the target has the message-security-assist
193   // extension facility 5.
hasMessageSecurityAssist5()194   bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; }
195 
196   // Return true if the target has the DFP packed-conversion facility.
hasDFPPackedConversion()197   bool hasDFPPackedConversion() const { return HasDFPPackedConversion; }
198 
199   // Return true if the target has the vector facility.
hasVector()200   bool hasVector() const { return HasVector; }
201 
202   // Return true if the target has the miscellaneous-extensions facility 2.
hasMiscellaneousExtensions2()203   bool hasMiscellaneousExtensions2() const {
204     return HasMiscellaneousExtensions2;
205   }
206 
207   // Return true if the target has the guarded-storage facility.
hasGuardedStorage()208   bool hasGuardedStorage() const { return HasGuardedStorage; }
209 
210   // Return true if the target has the message-security-assist
211   // extension facility 7.
hasMessageSecurityAssist7()212   bool hasMessageSecurityAssist7() const { return HasMessageSecurityAssist7; }
213 
214   // Return true if the target has the message-security-assist
215   // extension facility 8.
hasMessageSecurityAssist8()216   bool hasMessageSecurityAssist8() const { return HasMessageSecurityAssist8; }
217 
218   // Return true if the target has the vector-enhancements facility 1.
hasVectorEnhancements1()219   bool hasVectorEnhancements1() const { return HasVectorEnhancements1; }
220 
221   // Return true if the target has the vector-packed-decimal facility.
hasVectorPackedDecimal()222   bool hasVectorPackedDecimal() const { return HasVectorPackedDecimal; }
223 
224   // Return true if the target has the insert-reference-bits-multiple facility.
hasInsertReferenceBitsMultiple()225   bool hasInsertReferenceBitsMultiple() const {
226     return HasInsertReferenceBitsMultiple;
227   }
228 
229   // Return true if the target has the miscellaneous-extensions facility 3.
hasMiscellaneousExtensions3()230   bool hasMiscellaneousExtensions3() const {
231     return HasMiscellaneousExtensions3;
232   }
233 
234   // Return true if the target has the message-security-assist
235   // extension facility 9.
hasMessageSecurityAssist9()236   bool hasMessageSecurityAssist9() const { return HasMessageSecurityAssist9; }
237 
238   // Return true if the target has the vector-enhancements facility 2.
hasVectorEnhancements2()239   bool hasVectorEnhancements2() const { return HasVectorEnhancements2; }
240 
241   // Return true if the target has the vector-packed-decimal
242   // enhancement facility.
hasVectorPackedDecimalEnhancement()243   bool hasVectorPackedDecimalEnhancement() const {
244     return HasVectorPackedDecimalEnhancement;
245   }
246 
247   // Return true if the target has the enhanced-sort facility.
hasEnhancedSort()248   bool hasEnhancedSort() const { return HasEnhancedSort; }
249 
250   // Return true if the target has the deflate-conversion facility.
hasDeflateConversion()251   bool hasDeflateConversion() const { return HasDeflateConversion; }
252 
253   // Return true if soft float should be used.
hasSoftFloat()254   bool hasSoftFloat() const { return HasSoftFloat; }
255 
256   // Return true if GV can be accessed using LARL for reloc model RM
257   // and code model CM.
258   bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
259 
isTargetELF()260   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
261 
262   // Returns TRUE if we are generating GOFF object code
isTargetGOFF()263   bool isTargetGOFF() const { return TargetTriple.isOSBinFormatGOFF(); }
264 
265   // Returns TRUE if we are using XPLINK64 linkage convention
isTargetXPLINK64()266   bool isTargetXPLINK64() const { return (isTargetGOFF() && isTargetzOS()); }
267 
268   // Returns TRUE if we are generating code for a s390x machine running zOS
isTargetzOS()269   bool isTargetzOS() const { return TargetTriple.isOSzOS(); }
270 };
271 } // end namespace llvm
272 
273 #endif
274