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/IR/DataLayout.h" 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 { 35 virtual void anchor(); 36 protected: 37 bool HasDistinctOps; 38 bool HasLoadStoreOnCond; 39 bool HasHighWord; 40 bool HasFPExtension; 41 bool HasPopulationCount; 42 bool HasFastSerialization; 43 bool HasInterlockedAccess1; 44 bool HasMiscellaneousExtensions; 45 bool HasTransactionalExecution; 46 bool HasProcessorAssist; 47 bool HasVector; 48 bool HasLoadStoreOnCond2; 49 bool HasLoadAndZeroRightmostByte; 50 51 private: 52 Triple TargetTriple; 53 SystemZInstrInfo InstrInfo; 54 SystemZTargetLowering TLInfo; 55 SystemZSelectionDAGInfo TSInfo; 56 SystemZFrameLowering FrameLowering; 57 58 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU, 59 StringRef FS); 60 public: 61 SystemZSubtarget(const Triple &TT, const std::string &CPU, 62 const std::string &FS, const TargetMachine &TM); 63 64 const TargetFrameLowering *getFrameLowering() const override { 65 return &FrameLowering; 66 } 67 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; } 68 const SystemZRegisterInfo *getRegisterInfo() const override { 69 return &InstrInfo.getRegisterInfo(); 70 } 71 const SystemZTargetLowering *getTargetLowering() const override { 72 return &TLInfo; 73 } 74 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 75 return &TSInfo; 76 } 77 78 // This is important for reducing register pressure in vector code. 79 bool useAA() const override { return true; } 80 81 // Automatically generated by tblgen. 82 void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 83 84 // Return true if the target has the distinct-operands facility. 85 bool hasDistinctOps() const { return HasDistinctOps; } 86 87 // Return true if the target has the load/store-on-condition facility. 88 bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; } 89 90 // Return true if the target has the load/store-on-condition facility 2. 91 bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; } 92 93 // Return true if the target has the high-word facility. 94 bool hasHighWord() const { return HasHighWord; } 95 96 // Return true if the target has the floating-point extension facility. 97 bool hasFPExtension() const { return HasFPExtension; } 98 99 // Return true if the target has the population-count facility. 100 bool hasPopulationCount() const { return HasPopulationCount; } 101 102 // Return true if the target has the fast-serialization facility. 103 bool hasFastSerialization() const { return HasFastSerialization; } 104 105 // Return true if the target has interlocked-access facility 1. 106 bool hasInterlockedAccess1() const { return HasInterlockedAccess1; } 107 108 // Return true if the target has the miscellaneous-extensions facility. 109 bool hasMiscellaneousExtensions() const { 110 return HasMiscellaneousExtensions; 111 } 112 113 // Return true if the target has the transactional-execution facility. 114 bool hasTransactionalExecution() const { return HasTransactionalExecution; } 115 116 // Return true if the target has the processor-assist facility. 117 bool hasProcessorAssist() const { return HasProcessorAssist; } 118 119 // Return true if the target has the load-and-zero-rightmost-byte facility. 120 bool hasLoadAndZeroRightmostByte() const { 121 return HasLoadAndZeroRightmostByte; 122 } 123 124 // Return true if the target has the vector facility. 125 bool hasVector() const { return HasVector; } 126 127 // Return true if GV can be accessed using LARL for reloc model RM 128 // and code model CM. 129 bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const; 130 131 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } 132 }; 133 } // end namespace llvm 134 135 #endif 136