/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/CSKY.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===--- CSKY.h - Declare CSKY target feature support -----------*- C++ -*-===// |
2 | | // |
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 |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file declares CSKY TargetInfo objects. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H |
14 | | #define LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H |
15 | | |
16 | | #include "clang/Basic/MacroBuilder.h" |
17 | | #include "clang/Basic/TargetInfo.h" |
18 | | #include "llvm/Support/CSKYTargetParser.h" |
19 | | |
20 | | namespace clang { |
21 | | namespace targets { |
22 | | |
23 | | class LLVM_LIBRARY_VISIBILITY CSKYTargetInfo : public TargetInfo { |
24 | | protected: |
25 | | std::string ABI; |
26 | | llvm::CSKY::ArchKind Arch = llvm::CSKY::ArchKind::INVALID; |
27 | | std::string CPU; |
28 | | |
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; |
35 | | bool VDSPV2 = false; |
36 | | bool VDSPV1 = false; |
37 | | bool DSPV2 = false; |
38 | | bool is3E3R1 = false; |
39 | | |
40 | | public: |
41 | | CSKYTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) |
42 | 8 | : TargetInfo(Triple) { |
43 | 8 | NoAsmVariants = true; |
44 | 8 | LongLongAlign = 32; |
45 | 8 | SuitableAlign = 32; |
46 | 8 | DoubleAlign = LongDoubleAlign = 32; |
47 | 8 | SizeType = UnsignedInt; |
48 | 8 | PtrDiffType = SignedInt; |
49 | 8 | IntPtrType = SignedInt; |
50 | 8 | WCharType = SignedInt; |
51 | 8 | WIntType = UnsignedInt; |
52 | | |
53 | 8 | UseZeroLengthBitfieldAlignment = true; |
54 | 8 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; |
55 | 8 | resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-" |
56 | 8 | "v64:32:32-v128:32:32-a:0:32-Fi32-n32"); |
57 | | |
58 | 8 | setABI("abiv2"); |
59 | 8 | } clang::targets::CSKYTargetInfo::CSKYTargetInfo(llvm::Triple const&, clang::TargetOptions const&) Line | Count | Source | 42 | 6 | : TargetInfo(Triple) { | 43 | 6 | NoAsmVariants = true; | 44 | 6 | LongLongAlign = 32; | 45 | 6 | SuitableAlign = 32; | 46 | 6 | DoubleAlign = LongDoubleAlign = 32; | 47 | 6 | SizeType = UnsignedInt; | 48 | 6 | PtrDiffType = SignedInt; | 49 | 6 | IntPtrType = SignedInt; | 50 | 6 | WCharType = SignedInt; | 51 | 6 | WIntType = UnsignedInt; | 52 | | | 53 | 6 | UseZeroLengthBitfieldAlignment = true; | 54 | 6 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; | 55 | 6 | resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-" | 56 | 6 | "v64:32:32-v128:32:32-a:0:32-Fi32-n32"); | 57 | | | 58 | 6 | setABI("abiv2"); | 59 | 6 | } |
clang::targets::CSKYTargetInfo::CSKYTargetInfo(llvm::Triple const&, clang::TargetOptions const&) Line | Count | Source | 42 | 2 | : TargetInfo(Triple) { | 43 | 2 | NoAsmVariants = true; | 44 | 2 | LongLongAlign = 32; | 45 | 2 | SuitableAlign = 32; | 46 | 2 | DoubleAlign = LongDoubleAlign = 32; | 47 | 2 | SizeType = UnsignedInt; | 48 | 2 | PtrDiffType = SignedInt; | 49 | 2 | IntPtrType = SignedInt; | 50 | 2 | WCharType = SignedInt; | 51 | 2 | WIntType = UnsignedInt; | 52 | | | 53 | 2 | UseZeroLengthBitfieldAlignment = true; | 54 | 2 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; | 55 | 2 | resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-" | 56 | 2 | "v64:32:32-v128:32:32-a:0:32-Fi32-n32"); | 57 | | | 58 | 2 | setABI("abiv2"); | 59 | 2 | } |
|
60 | | |
61 | 82 | StringRef getABI() const override { return ABI; } |
62 | 8 | bool setABI(const std::string &Name) override { |
63 | 8 | if (Name == "abiv2" || Name == "abiv1"0 ) { |
64 | 8 | ABI = Name; |
65 | 8 | return true; |
66 | 8 | } |
67 | 0 | return false; |
68 | 8 | } |
69 | | |
70 | | bool setCPU(const std::string &Name) override; |
71 | | |
72 | | bool isValidCPUName(StringRef Name) const override; |
73 | | |
74 | | virtual unsigned getMinGlobalAlign(uint64_t) const override; |
75 | | |
76 | | ArrayRef<Builtin::Info> getTargetBuiltins() const override; |
77 | | |
78 | 4 | BuiltinVaListKind getBuiltinVaListKind() const override { |
79 | 4 | return VoidPtrBuiltinVaList; |
80 | 4 | } |
81 | | |
82 | | bool validateAsmConstraint(const char *&Name, |
83 | | TargetInfo::ConstraintInfo &info) const override; |
84 | | |
85 | 0 | const char *getClobbers() const override { return ""; } |
86 | | |
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; |
92 | | |
93 | | /// Whether target allows to overalign ABI-specified preferred alignment |
94 | 386 | bool allowsLargerPreferedTypeAlignment() const override { return false; } |
95 | | |
96 | 0 | bool hasBitIntType() const override { return true; } |
97 | | |
98 | | protected: |
99 | | ArrayRef<const char *> getGCCRegNames() const override; |
100 | | |
101 | | ArrayRef<GCCRegAlias> getGCCRegAliases() const override; |
102 | | }; |
103 | | |
104 | | } // namespace targets |
105 | | } // namespace clang |
106 | | |
107 | | #endif // LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H |