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 66 private: 67 Triple TargetTriple; 68 SystemZInstrInfo InstrInfo; 69 SystemZTargetLowering TLInfo; 70 SystemZSelectionDAGInfo TSInfo; 71 SystemZFrameLowering FrameLowering; 72 73 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU, 74 StringRef FS); 75 public: 76 SystemZSubtarget(const Triple &TT, const std::string &CPU, 77 const std::string &FS, const TargetMachine &TM); 78 79 const TargetFrameLowering *getFrameLowering() const override { 80 return &FrameLowering; 81 } 82 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; } 83 const SystemZRegisterInfo *getRegisterInfo() const override { 84 return &InstrInfo.getRegisterInfo(); 85 } 86 const SystemZTargetLowering *getTargetLowering() const override { 87 return &TLInfo; 88 } 89 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 90 return &TSInfo; 91 } 92 93 // True if the subtarget should run MachineScheduler after aggressive 94 // coalescing. This currently replaces the SelectionDAG scheduler with the 95 // "source" order scheduler. 96 bool enableMachineScheduler() const override { return true; } 97 98 // This is important for reducing register pressure in vector code. 99 bool useAA() const override { return true; } 100 101 // Always enable the early if-conversion pass. 102 bool enableEarlyIfConversion() const override { return true; } 103 104 // Enable tracking of subregister liveness in register allocator. 105 bool enableSubRegLiveness() const override; 106 107 // Automatically generated by tblgen. 108 void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 109 110 // Return true if the target has the distinct-operands facility. 111 bool hasDistinctOps() const { return HasDistinctOps; } 112 113 // Return true if the target has the load/store-on-condition facility. 114 bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; } 115 116 // Return true if the target has the load/store-on-condition facility 2. 117 bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; } 118 119 // Return true if the target has the high-word facility. 120 bool hasHighWord() const { return HasHighWord; } 121 122 // Return true if the target has the floating-point extension facility. 123 bool hasFPExtension() const { return HasFPExtension; } 124 125 // Return true if the target has the population-count facility. 126 bool hasPopulationCount() const { return HasPopulationCount; } 127 128 // Return true if the target has the message-security-assist 129 // extension facility 3. 130 bool hasMessageSecurityAssist3() const { return HasMessageSecurityAssist3; } 131 132 // Return true if the target has the message-security-assist 133 // extension facility 4. 134 bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; } 135 136 // Return true if the target has the reset-reference-bits-multiple facility. 137 bool hasResetReferenceBitsMultiple() const { 138 return HasResetReferenceBitsMultiple; 139 } 140 141 // Return true if the target has the fast-serialization facility. 142 bool hasFastSerialization() const { return HasFastSerialization; } 143 144 // Return true if the target has interlocked-access facility 1. 145 bool hasInterlockedAccess1() const { return HasInterlockedAccess1; } 146 147 // Return true if the target has the miscellaneous-extensions facility. 148 bool hasMiscellaneousExtensions() const { 149 return HasMiscellaneousExtensions; 150 } 151 152 // Return true if the target has the execution-hint facility. 153 bool hasExecutionHint() const { return HasExecutionHint; } 154 155 // Return true if the target has the load-and-trap facility. 156 bool hasLoadAndTrap() const { return HasLoadAndTrap; } 157 158 // Return true if the target has the transactional-execution facility. 159 bool hasTransactionalExecution() const { return HasTransactionalExecution; } 160 161 // Return true if the target has the processor-assist facility. 162 bool hasProcessorAssist() const { return HasProcessorAssist; } 163 164 // Return true if the target has the DFP zoned-conversion facility. 165 bool hasDFPZonedConversion() const { return HasDFPZonedConversion; } 166 167 // Return true if the target has the enhanced-DAT facility 2. 168 bool hasEnhancedDAT2() const { return HasEnhancedDAT2; } 169 170 // Return true if the target has the load-and-zero-rightmost-byte facility. 171 bool hasLoadAndZeroRightmostByte() const { 172 return HasLoadAndZeroRightmostByte; 173 } 174 175 // Return true if the target has the message-security-assist 176 // extension facility 5. 177 bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; } 178 179 // Return true if the target has the DFP packed-conversion facility. 180 bool hasDFPPackedConversion() const { return HasDFPPackedConversion; } 181 182 // Return true if the target has the vector facility. 183 bool hasVector() const { return HasVector; } 184 185 // Return true if the target has the miscellaneous-extensions facility 2. 186 bool hasMiscellaneousExtensions2() const { 187 return HasMiscellaneousExtensions2; 188 } 189 190 // Return true if the target has the guarded-storage facility. 191 bool hasGuardedStorage() const { return HasGuardedStorage; } 192 193 // Return true if the target has the message-security-assist 194 // extension facility 7. 195 bool hasMessageSecurityAssist7() const { return HasMessageSecurityAssist7; } 196 197 // Return true if the target has the message-security-assist 198 // extension facility 8. 199 bool hasMessageSecurityAssist8() const { return HasMessageSecurityAssist8; } 200 201 // Return true if the target has the vector-enhancements facility 1. 202 bool hasVectorEnhancements1() const { return HasVectorEnhancements1; } 203 204 // Return true if the target has the vector-packed-decimal facility. 205 bool hasVectorPackedDecimal() const { return HasVectorPackedDecimal; } 206 207 // Return true if the target has the insert-reference-bits-multiple facility. 208 bool hasInsertReferenceBitsMultiple() const { 209 return HasInsertReferenceBitsMultiple; 210 } 211 212 // Return true if GV can be accessed using LARL for reloc model RM 213 // and code model CM. 214 bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const; 215 216 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } 217 }; 218 } // end namespace llvm 219 220 #endif 221