diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:43:05 +0000 |
| commit | 349cc55c9796c4596a5b9904cd3281af295f878f (patch) | |
| tree | 410c5a785075730a35f1272ca6a7adf72222ad03 /contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp | |
| parent | cb2ae6163174b90e999326ecec3699ee093a5d43 (diff) | |
| parent | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp new file mode 100644 index 000000000000..963c2ede9c44 --- /dev/null +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp @@ -0,0 +1,74 @@ +//===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the CSKY specific subclass of TargetSubtargetInfo. +// +//===----------------------------------------------------------------------===// + +#include "CSKYSubtarget.h" + +using namespace llvm; + +#define DEBUG_TYPE "csky-subtarget" +#define GET_SUBTARGETINFO_TARGET_DESC +#define GET_SUBTARGETINFO_CTOR +#include "CSKYGenSubtargetInfo.inc" + +void CSKYSubtarget::anchor() {} + +CSKYSubtarget &CSKYSubtarget::initializeSubtargetDependencies( + const Triple &TT, StringRef CPUName, StringRef TuneCPUName, StringRef FS) { + + if (CPUName.empty()) + CPUName = "generic"; + if (TuneCPUName.empty()) + TuneCPUName = CPUName; + + UseHardFloat = false; + UseHardFloatABI = false; + HasFPUv2SingleFloat = false; + HasFPUv2DoubleFloat = false; + HasFPUv3SingleFloat = false; + HasFPUv3DoubleFloat = false; + + HasBTST16 = false; + HasJAVA = false; + HasExtendLrw = false; + HasDoloop = false; + HasHighRegisters = false; + + HasE1 = false; + HasE2 = false; + Has2E3 = false; + HasMP = false; + Has3E3r1 = false; + Has3r1E3r2 = false; + Has3r2E3r3 = false; + Has3E7 = false; + HasMP1E2 = false; + Has7E10 = false; + Has10E60 = false; + + ParseSubtargetFeatures(CPUName, TuneCPUName, FS); + return *this; +} + +CSKYSubtarget::CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, + StringRef FS, const TargetMachine &TM) + : CSKYGenSubtargetInfo(TT, CPU, TuneCPU, FS), + FrameLowering(initializeSubtargetDependencies(TT, CPU, TuneCPU, FS)), + InstrInfo(*this), RegInfo(), TLInfo(TM, *this) {} + +bool CSKYSubtarget::useHardFloatABI() const { + auto FloatABI = getTargetLowering()->getTargetMachine().Options.FloatABIType; + + if (FloatABI == FloatABI::Default) + return UseHardFloatABI; + else + return FloatABI == FloatABI::Hard; +} |
