xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
1*349cc55cSDimitry Andric //===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- C++ -*-===//
2*349cc55cSDimitry Andric //
3*349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*349cc55cSDimitry Andric //
7*349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
8*349cc55cSDimitry Andric //
9*349cc55cSDimitry Andric // This file declares the CSKY specific subclass of TargetSubtargetInfo.
10*349cc55cSDimitry Andric //
11*349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
12*349cc55cSDimitry Andric 
13*349cc55cSDimitry Andric #ifndef LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
14*349cc55cSDimitry Andric #define LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
15*349cc55cSDimitry Andric 
16*349cc55cSDimitry Andric #include "CSKYFrameLowering.h"
17*349cc55cSDimitry Andric #include "CSKYISelLowering.h"
18*349cc55cSDimitry Andric #include "CSKYInstrInfo.h"
19*349cc55cSDimitry Andric #include "CSKYRegisterInfo.h"
20*349cc55cSDimitry Andric #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
21*349cc55cSDimitry Andric #include "llvm/CodeGen/TargetSubtargetInfo.h"
22*349cc55cSDimitry Andric #include "llvm/Target/TargetMachine.h"
23*349cc55cSDimitry Andric 
24*349cc55cSDimitry Andric #define GET_SUBTARGETINFO_HEADER
25*349cc55cSDimitry Andric #include "CSKYGenSubtargetInfo.inc"
26*349cc55cSDimitry Andric 
27*349cc55cSDimitry Andric namespace llvm {
28*349cc55cSDimitry Andric class StringRef;
29*349cc55cSDimitry Andric 
30*349cc55cSDimitry Andric class CSKYSubtarget : public CSKYGenSubtargetInfo {
31*349cc55cSDimitry Andric   virtual void anchor();
32*349cc55cSDimitry Andric 
33*349cc55cSDimitry Andric   CSKYFrameLowering FrameLowering;
34*349cc55cSDimitry Andric   CSKYInstrInfo InstrInfo;
35*349cc55cSDimitry Andric   CSKYRegisterInfo RegInfo;
36*349cc55cSDimitry Andric   CSKYTargetLowering TLInfo;
37*349cc55cSDimitry Andric   SelectionDAGTargetInfo TSInfo;
38*349cc55cSDimitry Andric 
39*349cc55cSDimitry Andric   bool UseHardFloat;
40*349cc55cSDimitry Andric   bool UseHardFloatABI;
41*349cc55cSDimitry Andric   bool HasFPUv2SingleFloat;
42*349cc55cSDimitry Andric   bool HasFPUv2DoubleFloat;
43*349cc55cSDimitry Andric   bool HasFPUv3SingleFloat;
44*349cc55cSDimitry Andric   bool HasFPUv3DoubleFloat;
45*349cc55cSDimitry Andric 
46*349cc55cSDimitry Andric   bool HasBTST16;
47*349cc55cSDimitry Andric   bool HasJAVA;
48*349cc55cSDimitry Andric   bool HasExtendLrw;
49*349cc55cSDimitry Andric   bool HasDoloop;
50*349cc55cSDimitry Andric   bool HasHighRegisters;
51*349cc55cSDimitry Andric 
52*349cc55cSDimitry Andric   bool HasE1;
53*349cc55cSDimitry Andric   bool HasE2;
54*349cc55cSDimitry Andric   bool Has2E3;
55*349cc55cSDimitry Andric   bool HasMP;
56*349cc55cSDimitry Andric   bool Has3E3r1;
57*349cc55cSDimitry Andric   bool Has3r1E3r2;
58*349cc55cSDimitry Andric   bool Has3r2E3r3;
59*349cc55cSDimitry Andric   bool Has3E7;
60*349cc55cSDimitry Andric   bool HasMP1E2;
61*349cc55cSDimitry Andric   bool Has7E10;
62*349cc55cSDimitry Andric   bool Has10E60;
63*349cc55cSDimitry Andric 
64*349cc55cSDimitry Andric public:
65*349cc55cSDimitry Andric   CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
66*349cc55cSDimitry Andric                 StringRef FS, const TargetMachine &TM);
67*349cc55cSDimitry Andric 
68*349cc55cSDimitry Andric   const CSKYFrameLowering *getFrameLowering() const override {
69*349cc55cSDimitry Andric     return &FrameLowering;
70*349cc55cSDimitry Andric   }
71*349cc55cSDimitry Andric   const CSKYInstrInfo *getInstrInfo() const override { return &InstrInfo; }
72*349cc55cSDimitry Andric   const CSKYRegisterInfo *getRegisterInfo() const override { return &RegInfo; }
73*349cc55cSDimitry Andric   const CSKYTargetLowering *getTargetLowering() const override {
74*349cc55cSDimitry Andric     return &TLInfo;
75*349cc55cSDimitry Andric   }
76*349cc55cSDimitry Andric   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
77*349cc55cSDimitry Andric     return &TSInfo;
78*349cc55cSDimitry Andric   }
79*349cc55cSDimitry Andric 
80*349cc55cSDimitry Andric   /// Initializes using the passed in CPU and feature strings so that we can
81*349cc55cSDimitry Andric   /// use initializer lists for subtarget initialization.
82*349cc55cSDimitry Andric   CSKYSubtarget &initializeSubtargetDependencies(const Triple &TT,
83*349cc55cSDimitry Andric                                                  StringRef CPU,
84*349cc55cSDimitry Andric                                                  StringRef TuneCPU,
85*349cc55cSDimitry Andric                                                  StringRef FS);
86*349cc55cSDimitry Andric 
87*349cc55cSDimitry Andric   // Generated by inc file
88*349cc55cSDimitry Andric   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
89*349cc55cSDimitry Andric 
90*349cc55cSDimitry Andric   bool useHardFloatABI() const;
91*349cc55cSDimitry Andric   bool useHardFloat() const { return UseHardFloat; }
92*349cc55cSDimitry Andric   bool hasFPUv2SingleFloat() const { return HasFPUv2SingleFloat; }
93*349cc55cSDimitry Andric   bool hasFPUv2DoubleFloat() const { return HasFPUv2DoubleFloat; }
94*349cc55cSDimitry Andric   bool hasFPUv2() const { return HasFPUv2SingleFloat || HasFPUv2DoubleFloat; }
95*349cc55cSDimitry Andric   bool hasFPUv3SingleFloat() const { return HasFPUv3SingleFloat; }
96*349cc55cSDimitry Andric   bool hasFPUv3DoubleFloat() const { return HasFPUv3DoubleFloat; }
97*349cc55cSDimitry Andric   bool hasFPUv3() const { return HasFPUv3SingleFloat || HasFPUv3DoubleFloat; }
98*349cc55cSDimitry Andric   bool hasAnyFloatExt() const { return hasFPUv2() || hasFPUv3(); };
99*349cc55cSDimitry Andric 
100*349cc55cSDimitry Andric   bool hasBTST16() const { return HasBTST16; }
101*349cc55cSDimitry Andric   bool hasJAVA() const { return HasJAVA; }
102*349cc55cSDimitry Andric   bool hasExtendLrw() const { return HasExtendLrw; }
103*349cc55cSDimitry Andric   bool hasDoloop() const { return HasDoloop; }
104*349cc55cSDimitry Andric   bool hasHighRegisters() const { return HasHighRegisters; }
105*349cc55cSDimitry Andric 
106*349cc55cSDimitry Andric   bool hasE1() const { return HasE1; }
107*349cc55cSDimitry Andric   bool hasE2() const { return HasE2; }
108*349cc55cSDimitry Andric   bool has2E3() const { return Has2E3; }
109*349cc55cSDimitry Andric   bool has3r1E3r2() const { return Has3r1E3r2; }
110*349cc55cSDimitry Andric   bool has3r2E3r3() const { return Has3r2E3r3; }
111*349cc55cSDimitry Andric   bool has3E3r1() const { return Has3E3r1; }
112*349cc55cSDimitry Andric   bool has3E7() const { return Has3E7; }
113*349cc55cSDimitry Andric   bool hasMP() const { return HasMP; }
114*349cc55cSDimitry Andric   bool hasMP1E2() const { return HasMP1E2; }
115*349cc55cSDimitry Andric   bool has7E10() const { return Has7E10; }
116*349cc55cSDimitry Andric   bool has10E60() const { return Has10E60; }
117*349cc55cSDimitry Andric };
118*349cc55cSDimitry Andric } // namespace llvm
119*349cc55cSDimitry Andric 
120*349cc55cSDimitry Andric #endif // LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H
121