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