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