Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H |
| 15 | #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 16 | |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 17 | #include "SystemZFrameLowering.h" |
| 18 | #include "SystemZISelLowering.h" |
| 19 | #include "SystemZInstrInfo.h" |
| 20 | #include "SystemZRegisterInfo.h" |
| 21 | #include "SystemZSelectionDAGInfo.h" |
| 22 | #include "llvm/IR/DataLayout.h" |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/Triple.h" |
| 24 | #include "llvm/Target/TargetSubtargetInfo.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 { |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 35 | virtual void anchor(); |
Richard Sandiford | 27d1cfe | 2013-07-19 16:09:03 +0000 | [diff] [blame] | 36 | protected: |
| 37 | bool HasDistinctOps; |
Richard Sandiford | a68e6f5 | 2013-07-25 08:57:02 +0000 | [diff] [blame] | 38 | bool HasLoadStoreOnCond; |
Richard Sandiford | 6cf80b3 | 2013-07-31 11:17:35 +0000 | [diff] [blame] | 39 | bool HasHighWord; |
Richard Sandiford | 8e92c38 | 2013-08-21 08:58:08 +0000 | [diff] [blame] | 40 | bool HasFPExtension; |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 41 | bool HasPopulationCount; |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 42 | bool HasMessageSecurityAssist4; |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 43 | bool HasFastSerialization; |
Richard Sandiford | 45645a2 | 2013-12-24 15:14:05 +0000 | [diff] [blame] | 44 | bool HasInterlockedAccess1; |
Ulrich Weigand | 371d10a | 2015-03-31 12:58:17 +0000 | [diff] [blame] | 45 | bool HasMiscellaneousExtensions; |
Ulrich Weigand | 84404f3 | 2016-11-28 14:01:51 +0000 | [diff] [blame] | 46 | bool HasExecutionHint; |
Ulrich Weigand | 2d9e3d9 | 2016-11-28 13:59:22 +0000 | [diff] [blame] | 47 | bool HasLoadAndTrap; |
Ulrich Weigand | 57c85f5 | 2015-04-01 12:51:43 +0000 | [diff] [blame] | 48 | bool HasTransactionalExecution; |
| 49 | bool HasProcessorAssist; |
Ulrich Weigand | 3f484e6 | 2017-05-30 10:15:16 +0000 | [diff] [blame] | 50 | bool HasDFPZonedConversion; |
Ulrich Weigand | a8b04e1 | 2015-05-05 19:23:40 +0000 | [diff] [blame] | 51 | bool HasVector; |
Zhan Jun Liau | def708a | 2016-07-11 18:45:03 +0000 | [diff] [blame] | 52 | bool HasLoadStoreOnCond2; |
Ulrich Weigand | 92c2c67 | 2016-11-11 12:46:28 +0000 | [diff] [blame] | 53 | bool HasLoadAndZeroRightmostByte; |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 54 | bool HasMessageSecurityAssist5; |
Ulrich Weigand | 3f484e6 | 2017-05-30 10:15:16 +0000 | [diff] [blame] | 55 | bool HasDFPPackedConversion; |
Richard Sandiford | 27d1cfe | 2013-07-19 16:09:03 +0000 | [diff] [blame] | 56 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 57 | private: |
| 58 | Triple TargetTriple; |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 59 | SystemZInstrInfo InstrInfo; |
| 60 | SystemZTargetLowering TLInfo; |
| 61 | SystemZSelectionDAGInfo TSInfo; |
| 62 | SystemZFrameLowering FrameLowering; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 63 | |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 64 | SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU, |
| 65 | StringRef FS); |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 66 | public: |
Daniel Sanders | a73f1fd | 2015-06-10 12:11:26 +0000 | [diff] [blame] | 67 | SystemZSubtarget(const Triple &TT, const std::string &CPU, |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 68 | const std::string &FS, const TargetMachine &TM); |
| 69 | |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 70 | const TargetFrameLowering *getFrameLowering() const override { |
| 71 | return &FrameLowering; |
| 72 | } |
| 73 | const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 74 | const SystemZRegisterInfo *getRegisterInfo() const override { |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 75 | return &InstrInfo.getRegisterInfo(); |
| 76 | } |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 77 | const SystemZTargetLowering *getTargetLowering() const override { |
| 78 | return &TLInfo; |
| 79 | } |
Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 80 | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 81 | return &TSInfo; |
| 82 | } |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 83 | |
Richard Sandiford | 094e609 | 2013-10-28 13:53:37 +0000 | [diff] [blame] | 84 | // This is important for reducing register pressure in vector code. |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 85 | bool useAA() const override { return true; } |
Richard Sandiford | 094e609 | 2013-10-28 13:53:37 +0000 | [diff] [blame] | 86 | |
Ulrich Weigand | 524f276 | 2016-11-28 13:34:08 +0000 | [diff] [blame] | 87 | // Always enable the early if-conversion pass. |
| 88 | bool enableEarlyIfConversion() const override { return true; } |
| 89 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 90 | // Automatically generated by tblgen. |
| 91 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
| 92 | |
Richard Sandiford | 27d1cfe | 2013-07-19 16:09:03 +0000 | [diff] [blame] | 93 | // Return true if the target has the distinct-operands facility. |
| 94 | bool hasDistinctOps() const { return HasDistinctOps; } |
| 95 | |
Richard Sandiford | a68e6f5 | 2013-07-25 08:57:02 +0000 | [diff] [blame] | 96 | // Return true if the target has the load/store-on-condition facility. |
| 97 | bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; } |
| 98 | |
Zhan Jun Liau | def708a | 2016-07-11 18:45:03 +0000 | [diff] [blame] | 99 | // Return true if the target has the load/store-on-condition facility 2. |
| 100 | bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; } |
| 101 | |
Richard Sandiford | 6cf80b3 | 2013-07-31 11:17:35 +0000 | [diff] [blame] | 102 | // Return true if the target has the high-word facility. |
| 103 | bool hasHighWord() const { return HasHighWord; } |
| 104 | |
Richard Sandiford | 8e92c38 | 2013-08-21 08:58:08 +0000 | [diff] [blame] | 105 | // Return true if the target has the floating-point extension facility. |
| 106 | bool hasFPExtension() const { return HasFPExtension; } |
| 107 | |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 108 | // Return true if the target has the population-count facility. |
| 109 | bool hasPopulationCount() const { return HasPopulationCount; } |
| 110 | |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 111 | // Return true if the target has the message-security-assist |
| 112 | // extension facility 4. |
| 113 | bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; } |
| 114 | |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 115 | // Return true if the target has the fast-serialization facility. |
| 116 | bool hasFastSerialization() const { return HasFastSerialization; } |
| 117 | |
Richard Sandiford | 45645a2 | 2013-12-24 15:14:05 +0000 | [diff] [blame] | 118 | // Return true if the target has interlocked-access facility 1. |
| 119 | bool hasInterlockedAccess1() const { return HasInterlockedAccess1; } |
| 120 | |
Ulrich Weigand | 371d10a | 2015-03-31 12:58:17 +0000 | [diff] [blame] | 121 | // Return true if the target has the miscellaneous-extensions facility. |
| 122 | bool hasMiscellaneousExtensions() const { |
| 123 | return HasMiscellaneousExtensions; |
| 124 | } |
| 125 | |
Ulrich Weigand | 84404f3 | 2016-11-28 14:01:51 +0000 | [diff] [blame] | 126 | // Return true if the target has the execution-hint facility. |
| 127 | bool hasExecutionHint() const { return HasExecutionHint; } |
| 128 | |
Ulrich Weigand | 2d9e3d9 | 2016-11-28 13:59:22 +0000 | [diff] [blame] | 129 | // Return true if the target has the load-and-trap facility. |
| 130 | bool hasLoadAndTrap() const { return HasLoadAndTrap; } |
| 131 | |
Ulrich Weigand | 57c85f5 | 2015-04-01 12:51:43 +0000 | [diff] [blame] | 132 | // Return true if the target has the transactional-execution facility. |
| 133 | bool hasTransactionalExecution() const { return HasTransactionalExecution; } |
| 134 | |
| 135 | // Return true if the target has the processor-assist facility. |
| 136 | bool hasProcessorAssist() const { return HasProcessorAssist; } |
| 137 | |
Ulrich Weigand | 3f484e6 | 2017-05-30 10:15:16 +0000 | [diff] [blame] | 138 | // Return true if the target has the DFP zoned-conversion facility. |
| 139 | bool hasDFPZonedConversion() const { return HasDFPZonedConversion; } |
| 140 | |
Ulrich Weigand | 92c2c67 | 2016-11-11 12:46:28 +0000 | [diff] [blame] | 141 | // Return true if the target has the load-and-zero-rightmost-byte facility. |
| 142 | bool hasLoadAndZeroRightmostByte() const { |
| 143 | return HasLoadAndZeroRightmostByte; |
| 144 | } |
| 145 | |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 146 | // Return true if the target has the message-security-assist |
| 147 | // extension facility 5. |
| 148 | bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; } |
| 149 | |
Ulrich Weigand | 3f484e6 | 2017-05-30 10:15:16 +0000 | [diff] [blame] | 150 | // Return true if the target has the DFP packed-conversion facility. |
| 151 | bool hasDFPPackedConversion() const { return HasDFPPackedConversion; } |
| 152 | |
Ulrich Weigand | a8b04e1 | 2015-05-05 19:23:40 +0000 | [diff] [blame] | 153 | // Return true if the target has the vector facility. |
| 154 | bool hasVector() const { return HasVector; } |
| 155 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 156 | // Return true if GV can be accessed using LARL for reloc model RM |
| 157 | // and code model CM. |
Rafael Espindola | 3beef8d | 2016-06-27 23:15:57 +0000 | [diff] [blame] | 158 | bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 159 | |
| 160 | bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } |
| 161 | }; |
| 162 | } // end namespace llvm |
| 163 | |
| 164 | #endif |