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