blob: cdb61327a16af6d0c30cbbd8a8e7a0889017bb8b [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- 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 Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
15#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
Ulrich Weigand5f613df2013-05-06 16:15:19 +000016
Eric Christopher52349952014-07-01 20:19:02 +000017#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 Weigand5f613df2013-05-06 16:15:19 +000023#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
30namespace llvm {
31class GlobalValue;
32class StringRef;
33
34class SystemZSubtarget : public SystemZGenSubtargetInfo {
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000035 virtual void anchor();
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000036protected:
37 bool HasDistinctOps;
Richard Sandiforda68e6f52013-07-25 08:57:02 +000038 bool HasLoadStoreOnCond;
Richard Sandiford6cf80b32013-07-31 11:17:35 +000039 bool HasHighWord;
Richard Sandiford8e92c382013-08-21 08:58:08 +000040 bool HasFPExtension;
Ulrich Weigandb4012182015-03-31 12:56:33 +000041 bool HasPopulationCount;
Richard Sandiford9afe6132013-12-10 10:36:34 +000042 bool HasFastSerialization;
Richard Sandiford45645a22013-12-24 15:14:05 +000043 bool HasInterlockedAccess1;
Ulrich Weigand371d10a2015-03-31 12:58:17 +000044 bool HasMiscellaneousExtensions;
Ulrich Weigand84404f32016-11-28 14:01:51 +000045 bool HasExecutionHint;
Ulrich Weigand2d9e3d92016-11-28 13:59:22 +000046 bool HasLoadAndTrap;
Ulrich Weigand57c85f52015-04-01 12:51:43 +000047 bool HasTransactionalExecution;
48 bool HasProcessorAssist;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000049 bool HasVector;
Zhan Jun Liaudef708a2016-07-11 18:45:03 +000050 bool HasLoadStoreOnCond2;
Ulrich Weigand92c2c672016-11-11 12:46:28 +000051 bool HasLoadAndZeroRightmostByte;
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000052
Ulrich Weigand5f613df2013-05-06 16:15:19 +000053private:
54 Triple TargetTriple;
Eric Christopher52349952014-07-01 20:19:02 +000055 SystemZInstrInfo InstrInfo;
56 SystemZTargetLowering TLInfo;
57 SystemZSelectionDAGInfo TSInfo;
58 SystemZFrameLowering FrameLowering;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000059
Eric Christopher52349952014-07-01 20:19:02 +000060 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
61 StringRef FS);
Ulrich Weigand5f613df2013-05-06 16:15:19 +000062public:
Daniel Sandersa73f1fd2015-06-10 12:11:26 +000063 SystemZSubtarget(const Triple &TT, const std::string &CPU,
Eric Christopher52349952014-07-01 20:19:02 +000064 const std::string &FS, const TargetMachine &TM);
65
Eric Christopherd9134482014-08-04 21:25:23 +000066 const TargetFrameLowering *getFrameLowering() const override {
67 return &FrameLowering;
68 }
69 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
Eric Christopherd9134482014-08-04 21:25:23 +000070 const SystemZRegisterInfo *getRegisterInfo() const override {
Eric Christopher52349952014-07-01 20:19:02 +000071 return &InstrInfo.getRegisterInfo();
72 }
Eric Christopherd9134482014-08-04 21:25:23 +000073 const SystemZTargetLowering *getTargetLowering() const override {
74 return &TLInfo;
75 }
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000076 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
Eric Christopherd9134482014-08-04 21:25:23 +000077 return &TSInfo;
78 }
Ulrich Weigand5f613df2013-05-06 16:15:19 +000079
Richard Sandiford094e6092013-10-28 13:53:37 +000080 // This is important for reducing register pressure in vector code.
Richard Sandifordb4d67b52014-03-06 12:03:36 +000081 bool useAA() const override { return true; }
Richard Sandiford094e6092013-10-28 13:53:37 +000082
Ulrich Weigand524f2762016-11-28 13:34:08 +000083 // Always enable the early if-conversion pass.
84 bool enableEarlyIfConversion() const override { return true; }
85
Ulrich Weigand5f613df2013-05-06 16:15:19 +000086 // Automatically generated by tblgen.
87 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
88
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000089 // Return true if the target has the distinct-operands facility.
90 bool hasDistinctOps() const { return HasDistinctOps; }
91
Richard Sandiforda68e6f52013-07-25 08:57:02 +000092 // Return true if the target has the load/store-on-condition facility.
93 bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
94
Zhan Jun Liaudef708a2016-07-11 18:45:03 +000095 // Return true if the target has the load/store-on-condition facility 2.
96 bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
97
Richard Sandiford6cf80b32013-07-31 11:17:35 +000098 // Return true if the target has the high-word facility.
99 bool hasHighWord() const { return HasHighWord; }
100
Richard Sandiford8e92c382013-08-21 08:58:08 +0000101 // Return true if the target has the floating-point extension facility.
102 bool hasFPExtension() const { return HasFPExtension; }
103
Ulrich Weigandb4012182015-03-31 12:56:33 +0000104 // Return true if the target has the population-count facility.
105 bool hasPopulationCount() const { return HasPopulationCount; }
106
Richard Sandiford9afe6132013-12-10 10:36:34 +0000107 // Return true if the target has the fast-serialization facility.
108 bool hasFastSerialization() const { return HasFastSerialization; }
109
Richard Sandiford45645a22013-12-24 15:14:05 +0000110 // Return true if the target has interlocked-access facility 1.
111 bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
112
Ulrich Weigand371d10a2015-03-31 12:58:17 +0000113 // Return true if the target has the miscellaneous-extensions facility.
114 bool hasMiscellaneousExtensions() const {
115 return HasMiscellaneousExtensions;
116 }
117
Ulrich Weigand84404f32016-11-28 14:01:51 +0000118 // Return true if the target has the execution-hint facility.
119 bool hasExecutionHint() const { return HasExecutionHint; }
120
Ulrich Weigand2d9e3d92016-11-28 13:59:22 +0000121 // Return true if the target has the load-and-trap facility.
122 bool hasLoadAndTrap() const { return HasLoadAndTrap; }
123
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000124 // Return true if the target has the transactional-execution facility.
125 bool hasTransactionalExecution() const { return HasTransactionalExecution; }
126
127 // Return true if the target has the processor-assist facility.
128 bool hasProcessorAssist() const { return HasProcessorAssist; }
129
Ulrich Weigand92c2c672016-11-11 12:46:28 +0000130 // Return true if the target has the load-and-zero-rightmost-byte facility.
131 bool hasLoadAndZeroRightmostByte() const {
132 return HasLoadAndZeroRightmostByte;
133 }
134
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000135 // Return true if the target has the vector facility.
136 bool hasVector() const { return HasVector; }
137
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000138 // Return true if GV can be accessed using LARL for reloc model RM
139 // and code model CM.
Rafael Espindola3beef8d2016-06-27 23:15:57 +0000140 bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000141
142 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
143};
144} // end namespace llvm
145
146#endif