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; |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 41 | bool HasFastSerialization; |
Richard Sandiford | 45645a2 | 2013-12-24 15:14:05 +0000 | [diff] [blame] | 42 | bool HasInterlockedAccess1; |
Richard Sandiford | 27d1cfe | 2013-07-19 16:09:03 +0000 | [diff] [blame] | 43 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 44 | private: |
| 45 | Triple TargetTriple; |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 46 | const DataLayout DL; |
| 47 | SystemZInstrInfo InstrInfo; |
| 48 | SystemZTargetLowering TLInfo; |
| 49 | SystemZSelectionDAGInfo TSInfo; |
| 50 | SystemZFrameLowering FrameLowering; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 51 | |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 52 | SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU, |
| 53 | StringRef FS); |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 54 | public: |
| 55 | SystemZSubtarget(const std::string &TT, const std::string &CPU, |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 56 | const std::string &FS, const TargetMachine &TM); |
| 57 | |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 58 | const TargetFrameLowering *getFrameLowering() const override { |
| 59 | return &FrameLowering; |
| 60 | } |
| 61 | const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
| 62 | const DataLayout *getDataLayout() const override { return &DL; } |
| 63 | const SystemZRegisterInfo *getRegisterInfo() const override { |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 64 | return &InstrInfo.getRegisterInfo(); |
| 65 | } |
Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 66 | const SystemZTargetLowering *getTargetLowering() const override { |
| 67 | return &TLInfo; |
| 68 | } |
| 69 | const TargetSelectionDAGInfo *getSelectionDAGInfo() const override { |
| 70 | return &TSInfo; |
| 71 | } |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 72 | |
Richard Sandiford | 094e609 | 2013-10-28 13:53:37 +0000 | [diff] [blame] | 73 | // This is important for reducing register pressure in vector code. |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 74 | bool useAA() const override { return true; } |
Richard Sandiford | 094e609 | 2013-10-28 13:53:37 +0000 | [diff] [blame] | 75 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 76 | // Automatically generated by tblgen. |
| 77 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
| 78 | |
Richard Sandiford | 27d1cfe | 2013-07-19 16:09:03 +0000 | [diff] [blame] | 79 | // Return true if the target has the distinct-operands facility. |
| 80 | bool hasDistinctOps() const { return HasDistinctOps; } |
| 81 | |
Richard Sandiford | a68e6f5 | 2013-07-25 08:57:02 +0000 | [diff] [blame] | 82 | // Return true if the target has the load/store-on-condition facility. |
| 83 | bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; } |
| 84 | |
Richard Sandiford | 6cf80b3 | 2013-07-31 11:17:35 +0000 | [diff] [blame] | 85 | // Return true if the target has the high-word facility. |
| 86 | bool hasHighWord() const { return HasHighWord; } |
| 87 | |
Richard Sandiford | 8e92c38 | 2013-08-21 08:58:08 +0000 | [diff] [blame] | 88 | // Return true if the target has the floating-point extension facility. |
| 89 | bool hasFPExtension() const { return HasFPExtension; } |
| 90 | |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 91 | // Return true if the target has the fast-serialization facility. |
| 92 | bool hasFastSerialization() const { return HasFastSerialization; } |
| 93 | |
Richard Sandiford | 45645a2 | 2013-12-24 15:14:05 +0000 | [diff] [blame] | 94 | // Return true if the target has interlocked-access facility 1. |
| 95 | bool hasInterlockedAccess1() const { return HasInterlockedAccess1; } |
| 96 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 97 | // Return true if GV can be accessed using LARL for reloc model RM |
| 98 | // and code model CM. |
| 99 | bool isPC32DBLSymbol(const GlobalValue *GV, Reloc::Model RM, |
| 100 | CodeModel::Model CM) const; |
| 101 | |
| 102 | bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } |
| 103 | }; |
| 104 | } // end namespace llvm |
| 105 | |
| 106 | #endif |