1 //===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file declares the CSKY specific subclass of TargetSubtargetInfo.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
14 #define LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
16 #include "CSKYFrameLowering.h"
17 #include "CSKYISelLowering.h"
18 #include "CSKYInstrInfo.h"
19 #include "CSKYRegisterInfo.h"
20 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
21 #include "llvm/CodeGen/TargetSubtargetInfo.h"
22 #include "llvm/Target/TargetMachine.h"
24 #define GET_SUBTARGETINFO_HEADER
25 #include "CSKYGenSubtargetInfo.inc"
30 class CSKYSubtarget
: public CSKYGenSubtargetInfo
{
31 virtual void anchor();
33 CSKYFrameLowering FrameLowering
;
34 CSKYInstrInfo InstrInfo
;
35 CSKYRegisterInfo RegInfo
;
36 CSKYTargetLowering TLInfo
;
37 SelectionDAGTargetInfo TSInfo
;
39 enum CSKYProcFamilyEnum
{
55 /// CSKYProcFamily - CSKY processor family: CK801, CK802, and others.
56 CSKYProcFamilyEnum CSKYProcFamily
= Others
;
60 bool HasFPUv2SingleFloat
;
61 bool HasFPUv2DoubleFloat
;
62 bool HasFPUv3HalfWord
;
63 bool HasFPUv3HalfFloat
;
64 bool HasFPUv3SingleFloat
;
65 bool HasFPUv3DoubleFloat
;
84 bool HasHardwareDivide
;
85 bool HasHighRegisters
;
93 bool EnableInterruptAttribute
;
112 CSKYSubtarget(const Triple
&TT
, StringRef CPU
, StringRef TuneCPU
,
113 StringRef FS
, const TargetMachine
&TM
);
115 const CSKYFrameLowering
*getFrameLowering() const override
{
116 return &FrameLowering
;
118 const CSKYInstrInfo
*getInstrInfo() const override
{ return &InstrInfo
; }
119 const CSKYRegisterInfo
*getRegisterInfo() const override
{ return &RegInfo
; }
120 const CSKYTargetLowering
*getTargetLowering() const override
{
123 const SelectionDAGTargetInfo
*getSelectionDAGInfo() const override
{
127 /// Initializes using the passed in CPU and feature strings so that we can
128 /// use initializer lists for subtarget initialization.
129 CSKYSubtarget
&initializeSubtargetDependencies(const Triple
&TT
,
134 // Generated by inc file
135 void ParseSubtargetFeatures(StringRef CPU
, StringRef TuneCPU
, StringRef FS
);
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
;
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
;
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
; }
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
; }
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
; }
210 const unsigned XLen
= 32;
214 #endif // LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H