Coverage Report

Created: 2022-05-14 11:35

/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;
30
  bool VDSPV2;
31
  bool VDSPV1;
32
  bool DSPV2;
33
  bool is3E3R1;
34
35
public:
36
  CSKYTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
37
4
      : TargetInfo(Triple) {
38
4
    NoAsmVariants = true;
39
4
    LongLongAlign = 32;
40
4
    SuitableAlign = 32;
41
4
    DoubleAlign = LongDoubleAlign = 32;
42
4
    SizeType = UnsignedInt;
43
4
    PtrDiffType = SignedInt;
44
4
    IntPtrType = SignedInt;
45
4
    WCharType = SignedInt;
46
4
    WIntType = UnsignedInt;
47
48
4
    UseZeroLengthBitfieldAlignment = true;
49
4
    MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
50
4
    resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-"
51
4
                    "v64:32:32-v128:32:32-a:0:32-Fi32-n32");
52
53
4
    setABI("abiv2");
54
4
  }
clang::targets::CSKYTargetInfo::CSKYTargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
37
2
      : TargetInfo(Triple) {
38
2
    NoAsmVariants = true;
39
2
    LongLongAlign = 32;
40
2
    SuitableAlign = 32;
41
2
    DoubleAlign = LongDoubleAlign = 32;
42
2
    SizeType = UnsignedInt;
43
2
    PtrDiffType = SignedInt;
44
2
    IntPtrType = SignedInt;
45
2
    WCharType = SignedInt;
46
2
    WIntType = UnsignedInt;
47
48
2
    UseZeroLengthBitfieldAlignment = true;
49
2
    MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
50
2
    resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-"
51
2
                    "v64:32:32-v128:32:32-a:0:32-Fi32-n32");
52
53
2
    setABI("abiv2");
54
2
  }
clang::targets::CSKYTargetInfo::CSKYTargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
37
2
      : TargetInfo(Triple) {
38
2
    NoAsmVariants = true;
39
2
    LongLongAlign = 32;
40
2
    SuitableAlign = 32;
41
2
    DoubleAlign = LongDoubleAlign = 32;
42
2
    SizeType = UnsignedInt;
43
2
    PtrDiffType = SignedInt;
44
2
    IntPtrType = SignedInt;
45
2
    WCharType = SignedInt;
46
2
    WIntType = UnsignedInt;
47
48
2
    UseZeroLengthBitfieldAlignment = true;
49
2
    MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
50
2
    resetDataLayout("e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-"
51
2
                    "v64:32:32-v128:32:32-a:0:32-Fi32-n32");
52
53
2
    setABI("abiv2");
54
2
  }
55
56
0
  StringRef getABI() const override { return ABI; }
57
4
  bool setABI(const std::string &Name) override {
58
4
    if (Name == "abiv2" || 
Name == "abiv1"0
) {
59
4
      ABI = Name;
60
4
      return true;
61
4
    }
62
0
    return false;
63
4
  }
64
65
  bool setCPU(const std::string &Name) override;
66
67
  bool isValidCPUName(StringRef Name) const override;
68
69
  virtual unsigned getMinGlobalAlign(uint64_t) const override;
70
71
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
72
73
0
  BuiltinVaListKind getBuiltinVaListKind() const override {
74
0
    return VoidPtrBuiltinVaList;
75
0
  }
76
77
  bool validateAsmConstraint(const char *&Name,
78
                             TargetInfo::ConstraintInfo &info) const override;
79
80
0
  const char *getClobbers() const override { return ""; }
81
82
  void getTargetDefines(const LangOptions &Opts,
83
                        MacroBuilder &Builder) const override;
84
  bool handleTargetFeatures(std::vector<std::string> &Features,
85
                            DiagnosticsEngine &Diags) override;
86
87
  /// Whether target allows to overalign ABI-specified preferred alignment
88
0
  bool allowsLargerPreferedTypeAlignment() const override { return false; }
89
90
0
  bool hasBitIntType() const override { return true; }
91
92
protected:
93
  ArrayRef<const char *> getGCCRegNames() const override;
94
95
  ArrayRef<GCCRegAlias> getGCCRegAliases() const override;
96
};
97
98
} // namespace targets
99
} // namespace clang
100
101
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H