1 //===--- CSKY.h - Declare CSKY target feature support -----------*- 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 CSKY TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H
16 #include "clang/Basic/MacroBuilder.h"
17 #include "clang/Basic/TargetInfo.h"
18 #include "llvm/TargetParser/CSKYTargetParser.h"
23 class LLVM_LIBRARY_VISIBILITY CSKYTargetInfo
: public TargetInfo
{
26 llvm::CSKY::ArchKind Arch
= llvm::CSKY::ArchKind::INVALID
;
29 bool HardFloat
= false;
30 bool HardFloatABI
= false;
31 bool FPUV2_SF
= false;
32 bool FPUV2_DF
= false;
33 bool FPUV3_SF
= false;
34 bool FPUV3_DF
= false;
41 CSKYTargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&Opts
)
42 : TargetInfo(Triple
) {
46 DoubleAlign
= LongDoubleAlign
= 32;
47 SizeType
= UnsignedInt
;
48 PtrDiffType
= SignedInt
;
49 IntPtrType
= SignedInt
;
50 WCharType
= SignedInt
;
51 WIntType
= UnsignedInt
;
53 UseZeroLengthBitfieldAlignment
= true;
54 MaxAtomicPromoteWidth
= MaxAtomicInlineWidth
= 32;
55 resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-"
56 "v64:32:32-v128:32:32-a:0:32-Fi32-n32");
61 StringRef
getABI() const override
{ return ABI
; }
62 bool setABI(const std::string
&Name
) override
{
63 if (Name
== "abiv2" || Name
== "abiv1") {
70 bool setCPU(const std::string
&Name
) override
;
72 bool isValidCPUName(StringRef Name
) const override
;
74 unsigned getMinGlobalAlign(uint64_t) const override
;
76 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
;
78 BuiltinVaListKind
getBuiltinVaListKind() const override
{
79 return VoidPtrBuiltinVaList
;
82 bool validateAsmConstraint(const char *&Name
,
83 TargetInfo::ConstraintInfo
&info
) const override
;
85 const char *getClobbers() const override
{ return ""; }
87 void getTargetDefines(const LangOptions
&Opts
,
88 MacroBuilder
&Builder
) const override
;
89 bool hasFeature(StringRef Feature
) const override
;
90 bool handleTargetFeatures(std::vector
<std::string
> &Features
,
91 DiagnosticsEngine
&Diags
) override
;
93 /// Whether target allows to overalign ABI-specified preferred alignment
94 bool allowsLargerPreferedTypeAlignment() const override
{ return false; }
96 bool hasBitIntType() const override
{ return true; }
99 ArrayRef
<const char *> getGCCRegNames() const override
;
101 ArrayRef
<GCCRegAlias
> getGCCRegAliases() const override
;
104 } // namespace targets
107 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H