blob: c99e552abb1be54fd4430620a3cdbef974f5e061 [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 Weigand57c85f52015-04-01 12:51:43 +000045 bool HasTransactionalExecution;
46 bool HasProcessorAssist;
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000047
Ulrich Weigand5f613df2013-05-06 16:15:19 +000048private:
49 Triple TargetTriple;
Eric Christopher52349952014-07-01 20:19:02 +000050 SystemZInstrInfo InstrInfo;
51 SystemZTargetLowering TLInfo;
52 SystemZSelectionDAGInfo TSInfo;
53 SystemZFrameLowering FrameLowering;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000054
Eric Christopher52349952014-07-01 20:19:02 +000055 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
56 StringRef FS);
Ulrich Weigand5f613df2013-05-06 16:15:19 +000057public:
58 SystemZSubtarget(const std::string &TT, const std::string &CPU,
Eric Christopher52349952014-07-01 20:19:02 +000059 const std::string &FS, const TargetMachine &TM);
60
Eric Christopherd9134482014-08-04 21:25:23 +000061 const TargetFrameLowering *getFrameLowering() const override {
62 return &FrameLowering;
63 }
64 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
Eric Christopherd9134482014-08-04 21:25:23 +000065 const SystemZRegisterInfo *getRegisterInfo() const override {
Eric Christopher52349952014-07-01 20:19:02 +000066 return &InstrInfo.getRegisterInfo();
67 }
Eric Christopherd9134482014-08-04 21:25:23 +000068 const SystemZTargetLowering *getTargetLowering() const override {
69 return &TLInfo;
70 }
71 const TargetSelectionDAGInfo *getSelectionDAGInfo() const override {
72 return &TSInfo;
73 }
Ulrich Weigand5f613df2013-05-06 16:15:19 +000074
Richard Sandiford094e6092013-10-28 13:53:37 +000075 // This is important for reducing register pressure in vector code.
Richard Sandifordb4d67b52014-03-06 12:03:36 +000076 bool useAA() const override { return true; }
Richard Sandiford094e6092013-10-28 13:53:37 +000077
Ulrich Weigand5f613df2013-05-06 16:15:19 +000078 // Automatically generated by tblgen.
79 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
80
Richard Sandiford27d1cfe2013-07-19 16:09:03 +000081 // Return true if the target has the distinct-operands facility.
82 bool hasDistinctOps() const { return HasDistinctOps; }
83
Richard Sandiforda68e6f52013-07-25 08:57:02 +000084 // Return true if the target has the load/store-on-condition facility.
85 bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
86
Richard Sandiford6cf80b32013-07-31 11:17:35 +000087 // Return true if the target has the high-word facility.
88 bool hasHighWord() const { return HasHighWord; }
89
Richard Sandiford8e92c382013-08-21 08:58:08 +000090 // Return true if the target has the floating-point extension facility.
91 bool hasFPExtension() const { return HasFPExtension; }
92
Ulrich Weigandb4012182015-03-31 12:56:33 +000093 // Return true if the target has the population-count facility.
94 bool hasPopulationCount() const { return HasPopulationCount; }
95
Richard Sandiford9afe6132013-12-10 10:36:34 +000096 // Return true if the target has the fast-serialization facility.
97 bool hasFastSerialization() const { return HasFastSerialization; }
98
Richard Sandiford45645a22013-12-24 15:14:05 +000099 // Return true if the target has interlocked-access facility 1.
100 bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
101
Ulrich Weigand371d10a2015-03-31 12:58:17 +0000102 // Return true if the target has the miscellaneous-extensions facility.
103 bool hasMiscellaneousExtensions() const {
104 return HasMiscellaneousExtensions;
105 }
106
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000107 // Return true if the target has the transactional-execution facility.
108 bool hasTransactionalExecution() const { return HasTransactionalExecution; }
109
110 // Return true if the target has the processor-assist facility.
111 bool hasProcessorAssist() const { return HasProcessorAssist; }
112
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000113 // 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
118 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
119};
120} // end namespace llvm
121
122#endif