LLVM  15.0.0git
CSKYSubtarget.h
Go to the documentation of this file.
1 //===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the CSKY specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
14 #define LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
15 
16 #include "CSKYFrameLowering.h"
17 #include "CSKYISelLowering.h"
18 #include "CSKYInstrInfo.h"
19 #include "CSKYRegisterInfo.h"
23 
24 #define GET_SUBTARGETINFO_HEADER
25 #include "CSKYGenSubtargetInfo.inc"
26 
27 namespace llvm {
28 class StringRef;
29 
31  virtual void anchor();
32 
33  CSKYFrameLowering FrameLowering;
34  CSKYInstrInfo InstrInfo;
36  CSKYTargetLowering TLInfo;
38 
39  enum CSKYProcFamilyEnum {
40  Others,
41 
42  CK801,
43  CK802,
44  CK803,
45  CK803S,
46  CK804,
47  CK805,
48  CK807,
49  CK810,
50  CK810V,
51  CK860,
52  CK860V
53  };
54 
55  /// CSKYProcFamily - CSKY processor family: CK801, CK802, and others.
56  CSKYProcFamilyEnum CSKYProcFamily = Others;
57 
58  bool UseHardFloat;
59  bool UseHardFloatABI;
60  bool HasFPUv2SingleFloat;
61  bool HasFPUv2DoubleFloat;
62  bool HasFPUv3HalfWord;
63  bool HasFPUv3HalfFloat;
64  bool HasFPUv3SingleFloat;
65  bool HasFPUv3DoubleFloat;
66  bool HasFdivdu;
67  bool HasFLOATE1;
68  bool HasFLOAT1E2;
69  bool HasFLOAT1E3;
70  bool HasFLOAT3E4;
71  bool HasFLOAT7E60;
72  bool HasBTST16;
73  bool HasExtendLrw;
74  bool HasTrust;
75  bool HasJAVA;
76  bool HasCache;
77  bool HasNVIC;
78  bool HasDSP;
79  bool HasDSP1E2;
80  bool HasDSPE60;
81  bool HasDSPV2;
82  bool HasDSP_Silan;
83  bool HasDoloop;
84  bool HasHardwareDivide;
85  bool HasHighRegisters;
86  bool HasVDSPV2;
87  bool HasVDSP2E3;
88  bool HasVDSP2E60F;
89  bool ReadTPHard;
90  bool HasVDSPV1_128;
91  bool UseCCRT;
92  bool DumpConstPool;
93  bool EnableInterruptAttribute;
94  bool HasPushPop;
95  bool HasSTM;
96  bool SmartMode;
97  bool EnableStackSize;
98 
99  bool HasE1;
100  bool HasE2;
101  bool Has2E3;
102  bool HasMP;
103  bool Has3E3r1;
104  bool Has3r1E3r2;
105  bool Has3r2E3r3;
106  bool Has3E7;
107  bool HasMP1E2;
108  bool Has7E10;
109  bool Has10E60;
110 
111 public:
112  CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
113  StringRef FS, const TargetMachine &TM);
114 
115  const CSKYFrameLowering *getFrameLowering() const override {
116  return &FrameLowering;
117  }
118  const CSKYInstrInfo *getInstrInfo() const override { return &InstrInfo; }
119  const CSKYRegisterInfo *getRegisterInfo() const override { return &RegInfo; }
120  const CSKYTargetLowering *getTargetLowering() const override {
121  return &TLInfo;
122  }
123  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
124  return &TSInfo;
125  }
126 
127  /// Initializes using the passed in CPU and feature strings so that we can
128  /// use initializer lists for subtarget initialization.
130  StringRef CPU,
131  StringRef TuneCPU,
132  StringRef FS);
133 
134  // Generated by inc file
136 
137  bool useHardFloatABI() const;
138  bool useHardFloat() const { return UseHardFloat; }
139  bool hasFPUv2SingleFloat() const { return HasFPUv2SingleFloat; }
140  bool hasFPUv2DoubleFloat() const { return HasFPUv2DoubleFloat; }
141  bool hasFPUv2() const { return HasFPUv2SingleFloat || HasFPUv2DoubleFloat; }
142  bool hasFPUv3HalfWord() const { return HasFPUv3HalfWord; }
143  bool hasFPUv3HalfFloat() const { return HasFPUv3HalfFloat; }
144  bool hasFPUv3SingleFloat() const { return HasFPUv3SingleFloat; }
145  bool hasFPUv3DoubleFloat() const { return HasFPUv3DoubleFloat; }
146  bool hasFPUv3() const {
147  return HasFPUv3HalfFloat || HasFPUv3SingleFloat || HasFPUv3DoubleFloat;
148  }
149  bool hasAnyFloatExt() const { return hasFPUv2() || hasFPUv3(); };
150  bool hasFdivdu() const { return HasFdivdu; }
151  bool hasFLOATE1() const { return HasFLOATE1; }
152  bool hasFLOAT1E2() const { return HasFLOAT1E2; }
153  bool hasFLOAT1E3() const { return HasFLOAT1E3; }
154  bool hasFLOAT3E4() const { return HasFLOAT3E4; }
155  bool hasFLOAT7E60() const { return HasFLOAT7E60; }
156  bool hasExtendLrw() const { return HasExtendLrw; }
157  bool hasBTST16() const { return HasBTST16; }
158  bool hasTrust() const { return HasTrust; }
159  bool hasJAVA() const { return HasJAVA; }
160  bool hasCache() const { return HasCache; }
161  bool hasNVIC() const { return HasNVIC; }
162  bool hasDSP() const { return HasDSP; }
163  bool hasDSP1E2() const { return HasDSP1E2; }
164  bool hasDSPE60() const { return HasDSPE60; }
165  bool hasDSPV2() const { return HasDSPV2; }
166  bool hasDSP_Silan() const { return HasDSP_Silan; }
167  bool hasDoloop() const { return HasDoloop; }
168  bool hasHighRegisters() const { return HasHighRegisters; }
169  bool hasVDSPV2() const { return HasVDSPV2; }
170  bool hasVDSPV2_FLOAT() const { return HasVDSPV2 && UseHardFloat; }
171  bool hasVDSPV2_HALF() const {
172  return HasVDSPV2 && UseHardFloat && HasFPUv3HalfFloat;
173  }
174  bool hasVDSP2E3() const { return HasVDSP2E3; }
175  bool hasVDSP2E60F() const { return HasVDSP2E60F; }
176  bool readTPHard() const { return ReadTPHard; }
177  bool hasVDSPV1_128() const { return HasVDSPV1_128; }
178  bool useCCRT() const { return UseCCRT; }
179  bool dumpConstPool() const { return DumpConstPool; }
180  bool enableInterruptAttribute() const { return EnableInterruptAttribute; }
181  bool hasPushPop() const { return HasPushPop; }
182  bool hasSTM() const { return HasSTM; }
183  bool smartMode() const { return SmartMode; }
184  bool enableStackSize() const { return EnableStackSize; }
185 
186  bool hasE1() const { return HasE1; }
187  bool hasE2() const { return HasE2; }
188  bool has2E3() const { return Has2E3; }
189  bool has3r1E3r2() const { return Has3r1E3r2; }
190  bool has3r2E3r3() const { return Has3r2E3r3; }
191  bool has3E3r1() const { return Has3E3r1; }
192  bool has3E7() const { return Has3E7; }
193  bool hasMP() const { return HasMP; }
194  bool hasMP1E2() const { return HasMP1E2; }
195  bool has7E10() const { return Has7E10; }
196  bool has10E60() const { return Has10E60; }
197 
198  bool isCK801() const { return CSKYProcFamily == CK801; }
199  bool isCK802() const { return CSKYProcFamily == CK802; }
200  bool isCK803() const { return CSKYProcFamily == CK803; }
201  bool isCK803S() const { return CSKYProcFamily == CK803S; }
202  bool isCK804() const { return CSKYProcFamily == CK804; }
203  bool isCK805() const { return CSKYProcFamily == CK805; }
204  bool isCK807() const { return CSKYProcFamily == CK807; }
205  bool isCK810() const { return CSKYProcFamily == CK810; }
206  bool isCK810V() const { return CSKYProcFamily == CK810V; }
207  bool isCK860() const { return CSKYProcFamily == CK860; }
208  bool isCK860V() const { return CSKYProcFamily == CK860V; }
209 };
210 } // namespace llvm
211 
212 #endif // LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
llvm::CSKYFrameLowering
Definition: CSKYFrameLowering.h:21
llvm::CSKYSubtarget::hasMP
bool hasMP() const
Definition: CSKYSubtarget.h:193
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::CSKYSubtarget::hasDSP
bool hasDSP() const
Definition: CSKYSubtarget.h:162
llvm::CSKYSubtarget::has7E10
bool has7E10() const
Definition: CSKYSubtarget.h:195
CSKYRegisterInfo.h
llvm::CSKYSubtarget::hasJAVA
bool hasJAVA() const
Definition: CSKYSubtarget.h:159
llvm::CSKYSubtarget::hasVDSPV2_HALF
bool hasVDSPV2_HALF() const
Definition: CSKYSubtarget.h:171
llvm::CSKYSubtarget::has3E7
bool has3E7() const
Definition: CSKYSubtarget.h:192
llvm::CSKYInstrInfo
Definition: CSKYInstrInfo.h:26
llvm::CSKYSubtarget::isCK803
bool isCK803() const
Definition: CSKYSubtarget.h:200
llvm::CSKYSubtarget::hasSTM
bool hasSTM() const
Definition: CSKYSubtarget.h:182
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::CSKYSubtarget::hasDoloop
bool hasDoloop() const
Definition: CSKYSubtarget.h:167
llvm::CSKYRegisterInfo
Definition: CSKYRegisterInfo.h:24
llvm::CSKYSubtarget::hasFLOAT7E60
bool hasFLOAT7E60() const
Definition: CSKYSubtarget.h:155
llvm::CSKYSubtarget::CSKYSubtarget
CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, const TargetMachine &TM)
Definition: CSKYSubtarget.cpp:90
llvm::CSKYSubtarget::hasVDSPV1_128
bool hasVDSPV1_128() const
Definition: CSKYSubtarget.h:177
llvm::CSKYSubtarget::hasFPUv3HalfWord
bool hasFPUv3HalfWord() const
Definition: CSKYSubtarget.h:142
llvm::CSKYSubtarget::hasDSP_Silan
bool hasDSP_Silan() const
Definition: CSKYSubtarget.h:166
llvm::CSKYSubtarget::hasDSP1E2
bool hasDSP1E2() const
Definition: CSKYSubtarget.h:163
llvm::CSKYSubtarget::readTPHard
bool readTPHard() const
Definition: CSKYSubtarget.h:176
llvm::CSKYSubtarget::getTargetLowering
const CSKYTargetLowering * getTargetLowering() const override
Definition: CSKYSubtarget.h:120
llvm::CSKYSubtarget::hasDSPE60
bool hasDSPE60() const
Definition: CSKYSubtarget.h:164
llvm::CSKYSubtarget::isCK810
bool isCK810() const
Definition: CSKYSubtarget.h:205
llvm::CSKYSubtarget::has3r1E3r2
bool has3r1E3r2() const
Definition: CSKYSubtarget.h:189
llvm::CSKYSubtarget::hasTrust
bool hasTrust() const
Definition: CSKYSubtarget.h:158
TargetMachine.h
llvm::CSKYSubtarget::hasFPUv2SingleFloat
bool hasFPUv2SingleFloat() const
Definition: CSKYSubtarget.h:139
llvm::CSKYSubtarget::hasMP1E2
bool hasMP1E2() const
Definition: CSKYSubtarget.h:194
CSKYInstrInfo.h
llvm::SelectionDAGTargetInfo
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Definition: SelectionDAGTargetInfo.h:31
llvm::CSKYSubtarget::isCK860V
bool isCK860V() const
Definition: CSKYSubtarget.h:208
llvm::CSKYSubtarget::getRegisterInfo
const CSKYRegisterInfo * getRegisterInfo() const override
Definition: CSKYSubtarget.h:119
llvm::CSKYSubtarget::getSelectionDAGInfo
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Definition: CSKYSubtarget.h:123
llvm::CSKYSubtarget
Definition: CSKYSubtarget.h:30
llvm::CSKYSubtarget::hasBTST16
bool hasBTST16() const
Definition: CSKYSubtarget.h:157
llvm::CSKYSubtarget::hasCache
bool hasCache() const
Definition: CSKYSubtarget.h:160
llvm::CSKYSubtarget::hasFLOAT3E4
bool hasFLOAT3E4() const
Definition: CSKYSubtarget.h:154
llvm::CSKYSubtarget::isCK803S
bool isCK803S() const
Definition: CSKYSubtarget.h:201
llvm::CSKYSubtarget::hasVDSPV2
bool hasVDSPV2() const
Definition: CSKYSubtarget.h:169
llvm::CSKYSubtarget::getInstrInfo
const CSKYInstrInfo * getInstrInfo() const override
Definition: CSKYSubtarget.h:118
llvm::CSKYSubtarget::hasFLOAT1E2
bool hasFLOAT1E2() const
Definition: CSKYSubtarget.h:152
llvm::CSKYSubtarget::enableInterruptAttribute
bool enableInterruptAttribute() const
Definition: CSKYSubtarget.h:180
llvm::CSKYSubtarget::isCK860
bool isCK860() const
Definition: CSKYSubtarget.h:207
llvm::CSKYSubtarget::dumpConstPool
bool dumpConstPool() const
Definition: CSKYSubtarget.h:179
llvm::CSKYSubtarget::hasVDSPV2_FLOAT
bool hasVDSPV2_FLOAT() const
Definition: CSKYSubtarget.h:170
llvm::CSKYSubtarget::useHardFloat
bool useHardFloat() const
Definition: CSKYSubtarget.h:138
llvm::CSKYSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm::CSKYSubtarget::has3E3r1
bool has3E3r1() const
Definition: CSKYSubtarget.h:191
llvm::CSKYSubtarget::isCK804
bool isCK804() const
Definition: CSKYSubtarget.h:202
llvm::CSKYSubtarget::useCCRT
bool useCCRT() const
Definition: CSKYSubtarget.h:178
llvm::CSKYSubtarget::isCK802
bool isCK802() const
Definition: CSKYSubtarget.h:199
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::CSKYSubtarget::hasNVIC
bool hasNVIC() const
Definition: CSKYSubtarget.h:161
llvm::X86AS::FS
@ FS
Definition: X86.h:192
CSKYFrameLowering.h
llvm::CSKYSubtarget::hasVDSP2E60F
bool hasVDSP2E60F() const
Definition: CSKYSubtarget.h:175
llvm::CSKYSubtarget::initializeSubtargetDependencies
CSKYSubtarget & initializeSubtargetDependencies(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS)
Initializes using the passed in CPU and feature strings so that we can use initializer lists for subt...
Definition: CSKYSubtarget.cpp:25
llvm::CSKYSubtarget::useHardFloatABI
bool useHardFloatABI() const
Definition: CSKYSubtarget.cpp:96
llvm::CSKYSubtarget::isCK810V
bool isCK810V() const
Definition: CSKYSubtarget.h:206
llvm::CSKYSubtarget::hasAnyFloatExt
bool hasAnyFloatExt() const
Definition: CSKYSubtarget.h:149
RegInfo
Definition: AMDGPUAsmParser.cpp:2542
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::CSKYSubtarget::hasFdivdu
bool hasFdivdu() const
Definition: CSKYSubtarget.h:150
CSKYGenSubtargetInfo
TargetSubtargetInfo.h
CSKYISelLowering.h
llvm::CSKYSubtarget::hasPushPop
bool hasPushPop() const
Definition: CSKYSubtarget.h:181
llvm::CSKYSubtarget::hasFLOATE1
bool hasFLOATE1() const
Definition: CSKYSubtarget.h:151
llvm::CSKYSubtarget::smartMode
bool smartMode() const
Definition: CSKYSubtarget.h:183
llvm::CSKYSubtarget::isCK807
bool isCK807() const
Definition: CSKYSubtarget.h:204
llvm::CSKYSubtarget::hasFPUv3
bool hasFPUv3() const
Definition: CSKYSubtarget.h:146
llvm::CSKYSubtarget::hasVDSP2E3
bool hasVDSP2E3() const
Definition: CSKYSubtarget.h:174
llvm::CSKYSubtarget::hasFPUv3SingleFloat
bool hasFPUv3SingleFloat() const
Definition: CSKYSubtarget.h:144
llvm::CSKYSubtarget::hasFPUv2DoubleFloat
bool hasFPUv2DoubleFloat() const
Definition: CSKYSubtarget.h:140
llvm::CSKYSubtarget::hasFPUv3DoubleFloat
bool hasFPUv3DoubleFloat() const
Definition: CSKYSubtarget.h:145
llvm::CSKYSubtarget::isCK805
bool isCK805() const
Definition: CSKYSubtarget.h:203
SelectionDAGTargetInfo.h
llvm::CSKYSubtarget::hasE2
bool hasE2() const
Definition: CSKYSubtarget.h:187
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::CSKYSubtarget::has2E3
bool has2E3() const
Definition: CSKYSubtarget.h:188
llvm::CSKYSubtarget::hasDSPV2
bool hasDSPV2() const
Definition: CSKYSubtarget.h:165
llvm::CSKYSubtarget::hasFLOAT1E3
bool hasFLOAT1E3() const
Definition: CSKYSubtarget.h:153
llvm::CSKYSubtarget::hasFPUv2
bool hasFPUv2() const
Definition: CSKYSubtarget.h:141
llvm::CSKYSubtarget::hasE1
bool hasE1() const
Definition: CSKYSubtarget.h:186
llvm::CSKYSubtarget::enableStackSize
bool enableStackSize() const
Definition: CSKYSubtarget.h:184
llvm::CSKYSubtarget::isCK801
bool isCK801() const
Definition: CSKYSubtarget.h:198
llvm::CSKYSubtarget::has10E60
bool has10E60() const
Definition: CSKYSubtarget.h:196
llvm::CSKYSubtarget::hasHighRegisters
bool hasHighRegisters() const
Definition: CSKYSubtarget.h:168
llvm::CSKYSubtarget::has3r2E3r3
bool has3r2E3r3() const
Definition: CSKYSubtarget.h:190
llvm::CSKYSubtarget::hasFPUv3HalfFloat
bool hasFPUv3HalfFloat() const
Definition: CSKYSubtarget.h:143
llvm::CSKYSubtarget::hasExtendLrw
bool hasExtendLrw() const
Definition: CSKYSubtarget.h:156
llvm::CSKYSubtarget::getFrameLowering
const CSKYFrameLowering * getFrameLowering() const override
Definition: CSKYSubtarget.h:115
llvm::CSKYTargetLowering
Definition: CSKYISelLowering.h:42