blob: 8285b4277d11daff0efeba0fe4c7a4d6140129e7 [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
15#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
Ulrich Weigand5f613df2013-05-06 16:15:19 +000016
Eric Christopher52349952014-07-01 20:19:02 +000017#include "SystemZFrameLowering.h"
18#include "SystemZISelLowering.h"
19#include "SystemZInstrInfo.h"
20#include "SystemZRegisterInfo.h"
21#include "SystemZSelectionDAGInfo.h"
Ulrich Weigand5f613df2013-05-06 16:15:19 +000022#include "llvm/ADT/Triple.h"
David Blaikieb3bde2e2017-11-17 01:07:10 +000023#include "llvm/CodeGen/TargetSubtargetInfo.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000024#include "llvm/IR/DataLayout.h"
Ulrich Weigand5f613df2013-05-06 16:15:19 +000025#include <string>
26
27#define GET_SUBTARGETINFO_HEADER
28#include "SystemZGenSubtargetInfo.inc"
29
30namespace llvm {
31class GlobalValue;
32class StringRef;
33
34class SystemZSubtarget : public SystemZGenSubtargetInfo {
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000035 virtual void anchor();
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000036protected:
37 bool HasDistinctOps;
Richard Sandiforda68e6f52013-07-25 08:57:02 +000038 bool HasLoadStoreOnCond;
Richard Sandiford6cf80b32013-07-31 11:17:35 +000039 bool HasHighWord;
Richard Sandiford8e92c382013-08-21 08:58:08 +000040 bool HasFPExtension;
Ulrich Weigandb4012182015-03-31 12:56:33 +000041 bool HasPopulationCount;
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000042 bool HasMessageSecurityAssist3;
Ulrich Weigand33a441a2017-05-10 12:42:00 +000043 bool HasMessageSecurityAssist4;
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000044 bool HasResetReferenceBitsMultiple;
Richard Sandiford9afe6132013-12-10 10:36:34 +000045 bool HasFastSerialization;
Richard Sandiford45645a22013-12-24 15:14:05 +000046 bool HasInterlockedAccess1;
Ulrich Weigand371d10a2015-03-31 12:58:17 +000047 bool HasMiscellaneousExtensions;
Ulrich Weigand84404f32016-11-28 14:01:51 +000048 bool HasExecutionHint;
Ulrich Weigand2d9e3d92016-11-28 13:59:22 +000049 bool HasLoadAndTrap;
Ulrich Weigand57c85f52015-04-01 12:51:43 +000050 bool HasTransactionalExecution;
51 bool HasProcessorAssist;
Ulrich Weigand3f484e62017-05-30 10:15:16 +000052 bool HasDFPZonedConversion;
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000053 bool HasEnhancedDAT2;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000054 bool HasVector;
Zhan Jun Liaudef708a2016-07-11 18:45:03 +000055 bool HasLoadStoreOnCond2;
Ulrich Weigand92c2c672016-11-11 12:46:28 +000056 bool HasLoadAndZeroRightmostByte;
Ulrich Weigand33a441a2017-05-10 12:42:00 +000057 bool HasMessageSecurityAssist5;
Ulrich Weigand3f484e62017-05-30 10:15:16 +000058 bool HasDFPPackedConversion;
Ulrich Weigand2b3482f2017-07-17 17:41:11 +000059 bool HasMiscellaneousExtensions2;
60 bool HasGuardedStorage;
61 bool HasMessageSecurityAssist7;
62 bool HasMessageSecurityAssist8;
63 bool HasVectorEnhancements1;
64 bool HasVectorPackedDecimal;
65 bool HasInsertReferenceBitsMultiple;
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000066
Ulrich Weigand5f613df2013-05-06 16:15:19 +000067private:
68 Triple TargetTriple;
Eric Christopher52349952014-07-01 20:19:02 +000069 SystemZInstrInfo InstrInfo;
70 SystemZTargetLowering TLInfo;
71 SystemZSelectionDAGInfo TSInfo;
72 SystemZFrameLowering FrameLowering;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000073
Eric Christopher52349952014-07-01 20:19:02 +000074 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
75 StringRef FS);
Ulrich Weigand5f613df2013-05-06 16:15:19 +000076public:
Daniel Sandersa73f1fd2015-06-10 12:11:26 +000077 SystemZSubtarget(const Triple &TT, const std::string &CPU,
Eric Christopher52349952014-07-01 20:19:02 +000078 const std::string &FS, const TargetMachine &TM);
79
Eric Christopherd9134482014-08-04 21:25:23 +000080 const TargetFrameLowering *getFrameLowering() const override {
81 return &FrameLowering;
82 }
83 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
Eric Christopherd9134482014-08-04 21:25:23 +000084 const SystemZRegisterInfo *getRegisterInfo() const override {
Eric Christopher52349952014-07-01 20:19:02 +000085 return &InstrInfo.getRegisterInfo();
86 }
Eric Christopherd9134482014-08-04 21:25:23 +000087 const SystemZTargetLowering *getTargetLowering() const override {
88 return &TLInfo;
89 }
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000090 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
Eric Christopherd9134482014-08-04 21:25:23 +000091 return &TSInfo;
92 }
Ulrich Weigand5f613df2013-05-06 16:15:19 +000093
Jonas Paulssonc63ed222017-10-06 13:59:28 +000094 // True if the subtarget should run MachineScheduler after aggressive
95 // coalescing. This currently replaces the SelectionDAG scheduler with the
96 // "source" order scheduler.
97 bool enableMachineScheduler() const override { return true; }
98
Richard Sandiford094e6092013-10-28 13:53:37 +000099 // This is important for reducing register pressure in vector code.
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000100 bool useAA() const override { return true; }
Richard Sandiford094e6092013-10-28 13:53:37 +0000101
Ulrich Weigand524f2762016-11-28 13:34:08 +0000102 // Always enable the early if-conversion pass.
103 bool enableEarlyIfConversion() const override { return true; }
104
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000105 // Automatically generated by tblgen.
106 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
107
Richard Sandiford27d1cfe2013-07-19 16:09:03 +0000108 // Return true if the target has the distinct-operands facility.
109 bool hasDistinctOps() const { return HasDistinctOps; }
110
Richard Sandiforda68e6f52013-07-25 08:57:02 +0000111 // Return true if the target has the load/store-on-condition facility.
112 bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
113
Zhan Jun Liaudef708a2016-07-11 18:45:03 +0000114 // Return true if the target has the load/store-on-condition facility 2.
115 bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
116
Richard Sandiford6cf80b32013-07-31 11:17:35 +0000117 // Return true if the target has the high-word facility.
118 bool hasHighWord() const { return HasHighWord; }
119
Richard Sandiford8e92c382013-08-21 08:58:08 +0000120 // Return true if the target has the floating-point extension facility.
121 bool hasFPExtension() const { return HasFPExtension; }
122
Ulrich Weigandb4012182015-03-31 12:56:33 +0000123 // Return true if the target has the population-count facility.
124 bool hasPopulationCount() const { return HasPopulationCount; }
125
Ulrich Weigand33a441a2017-05-10 12:42:00 +0000126 // Return true if the target has the message-security-assist
Ulrich Weigand03ab2e22017-06-30 20:43:40 +0000127 // extension facility 3.
128 bool hasMessageSecurityAssist3() const { return HasMessageSecurityAssist3; }
129
130 // Return true if the target has the message-security-assist
Ulrich Weigand33a441a2017-05-10 12:42:00 +0000131 // extension facility 4.
132 bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; }
133
Ulrich Weigand03ab2e22017-06-30 20:43:40 +0000134 // Return true if the target has the reset-reference-bits-multiple facility.
135 bool hasResetReferenceBitsMultiple() const {
136 return HasResetReferenceBitsMultiple;
137 }
138
Richard Sandiford9afe6132013-12-10 10:36:34 +0000139 // Return true if the target has the fast-serialization facility.
140 bool hasFastSerialization() const { return HasFastSerialization; }
141
Richard Sandiford45645a22013-12-24 15:14:05 +0000142 // Return true if the target has interlocked-access facility 1.
143 bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
144
Ulrich Weigand371d10a2015-03-31 12:58:17 +0000145 // Return true if the target has the miscellaneous-extensions facility.
146 bool hasMiscellaneousExtensions() const {
147 return HasMiscellaneousExtensions;
148 }
149
Ulrich Weigand84404f32016-11-28 14:01:51 +0000150 // Return true if the target has the execution-hint facility.
151 bool hasExecutionHint() const { return HasExecutionHint; }
152
Ulrich Weigand2d9e3d92016-11-28 13:59:22 +0000153 // Return true if the target has the load-and-trap facility.
154 bool hasLoadAndTrap() const { return HasLoadAndTrap; }
155
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000156 // Return true if the target has the transactional-execution facility.
157 bool hasTransactionalExecution() const { return HasTransactionalExecution; }
158
159 // Return true if the target has the processor-assist facility.
160 bool hasProcessorAssist() const { return HasProcessorAssist; }
161
Ulrich Weigand3f484e62017-05-30 10:15:16 +0000162 // Return true if the target has the DFP zoned-conversion facility.
163 bool hasDFPZonedConversion() const { return HasDFPZonedConversion; }
164
Ulrich Weigand03ab2e22017-06-30 20:43:40 +0000165 // Return true if the target has the enhanced-DAT facility 2.
166 bool hasEnhancedDAT2() const { return HasEnhancedDAT2; }
167
Ulrich Weigand92c2c672016-11-11 12:46:28 +0000168 // Return true if the target has the load-and-zero-rightmost-byte facility.
169 bool hasLoadAndZeroRightmostByte() const {
170 return HasLoadAndZeroRightmostByte;
171 }
172
Ulrich Weigand33a441a2017-05-10 12:42:00 +0000173 // Return true if the target has the message-security-assist
174 // extension facility 5.
175 bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; }
176
Ulrich Weigand3f484e62017-05-30 10:15:16 +0000177 // Return true if the target has the DFP packed-conversion facility.
178 bool hasDFPPackedConversion() const { return HasDFPPackedConversion; }
179
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000180 // Return true if the target has the vector facility.
181 bool hasVector() const { return HasVector; }
182
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000183 // Return true if the target has the miscellaneous-extensions facility 2.
184 bool hasMiscellaneousExtensions2() const {
185 return HasMiscellaneousExtensions2;
186 }
187
188 // Return true if the target has the guarded-storage facility.
189 bool hasGuardedStorage() const { return HasGuardedStorage; }
190
191 // Return true if the target has the message-security-assist
192 // extension facility 7.
193 bool hasMessageSecurityAssist7() const { return HasMessageSecurityAssist7; }
194
195 // Return true if the target has the message-security-assist
196 // extension facility 8.
197 bool hasMessageSecurityAssist8() const { return HasMessageSecurityAssist8; }
198
199 // Return true if the target has the vector-enhancements facility 1.
200 bool hasVectorEnhancements1() const { return HasVectorEnhancements1; }
201
202 // Return true if the target has the vector-packed-decimal facility.
203 bool hasVectorPackedDecimal() const { return HasVectorPackedDecimal; }
204
205 // Return true if the target has the insert-reference-bits-multiple facility.
206 bool hasInsertReferenceBitsMultiple() const {
207 return HasInsertReferenceBitsMultiple;
208 }
209
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000210 // Return true if GV can be accessed using LARL for reloc model RM
211 // and code model CM.
Rafael Espindola3beef8d2016-06-27 23:15:57 +0000212 bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000213
214 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
215};
216} // end namespace llvm
217
218#endif