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