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 #include "CSKYSubtarget.h"
14 #include "llvm/CodeGen/MachineFrameInfo.h"
18 #define DEBUG_TYPE "csky-subtarget"
19 #define GET_SUBTARGETINFO_TARGET_DESC
20 #define GET_SUBTARGETINFO_CTOR
21 #include "CSKYGenSubtargetInfo.inc"
23 void CSKYSubtarget::anchor() {}
25 CSKYSubtarget
&CSKYSubtarget::initializeSubtargetDependencies(
26 const Triple
&TT
, StringRef CPUName
, StringRef TuneCPUName
, StringRef FS
) {
30 if (TuneCPUName
.empty())
31 TuneCPUName
= CPUName
;
34 UseHardFloatABI
= false;
35 HasFPUv2SingleFloat
= false;
36 HasFPUv2DoubleFloat
= false;
37 HasFPUv3HalfWord
= false;
38 HasFPUv3HalfFloat
= false;
39 HasFPUv3SingleFloat
= false;
40 HasFPUv3DoubleFloat
= false;
59 HasHardwareDivide
= false;
60 HasHighRegisters
= false;
65 HasVDSPV1_128
= false;
67 DumpConstPool
= false;
68 EnableInterruptAttribute
= false;
72 EnableStackSize
= false;
86 ParseSubtargetFeatures(CPUName
, TuneCPUName
, FS
);
90 CSKYSubtarget::CSKYSubtarget(const Triple
&TT
, StringRef CPU
, StringRef TuneCPU
,
91 StringRef FS
, const TargetMachine
&TM
)
92 : CSKYGenSubtargetInfo(TT
, CPU
, TuneCPU
, FS
),
93 FrameLowering(initializeSubtargetDependencies(TT
, CPU
, TuneCPU
, FS
)),
94 InstrInfo(*this), RegInfo(), TLInfo(TM
, *this) {}
96 bool CSKYSubtarget::useHardFloatABI() const {
97 auto FloatABI
= getTargetLowering()->getTargetMachine().Options
.FloatABIType
;
99 if (FloatABI
== FloatABI::Default
)
100 return UseHardFloatABI
;
102 return FloatABI
== FloatABI::Hard
;