Coverage Report

Created: 2021-08-24 07:12

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/TCE.h
Line
Count
Source (jump to first uncovered line)
1
//===--- TCE.h - Declare TCE 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 TCE TargetInfo objects.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
14
#define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
15
16
#include "clang/Basic/TargetInfo.h"
17
#include "clang/Basic/TargetOptions.h"
18
#include "llvm/ADT/Triple.h"
19
#include "llvm/Support/Compiler.h"
20
21
namespace clang {
22
namespace targets {
23
24
// llvm and clang cannot be used directly to output native binaries for
25
// target, but is used to compile C code to llvm bitcode with correct
26
// type and alignment information.
27
//
28
// TCE uses the llvm bitcode as input and uses it for generating customized
29
// target processor and program binary. TCE co-design environment is
30
// publicly available in http://tce.cs.tut.fi
31
32
static const unsigned TCEOpenCLAddrSpaceMap[] = {
33
    0, // Default
34
    3, // opencl_global
35
    4, // opencl_local
36
    5, // opencl_constant
37
    0, // opencl_private
38
    1, // opencl_global_device
39
    1, // opencl_global_host
40
    // FIXME: generic has to be added to the target
41
    0, // opencl_generic
42
    0, // cuda_device
43
    0, // cuda_constant
44
    0, // cuda_shared
45
    0, // sycl_global
46
    0, // sycl_global_device
47
    0, // sycl_global_host
48
    0, // sycl_local
49
    0, // sycl_private
50
    0, // ptr32_sptr
51
    0, // ptr32_uptr
52
    0, // ptr64
53
};
54
55
class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
56
public:
57
  TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
58
6
      : TargetInfo(Triple) {
59
6
    TLSSupported = false;
60
6
    IntWidth = 32;
61
6
    LongWidth = LongLongWidth = 32;
62
6
    PointerWidth = 32;
63
6
    IntAlign = 32;
64
6
    LongAlign = LongLongAlign = 32;
65
6
    PointerAlign = 32;
66
6
    SuitableAlign = 32;
67
6
    SizeType = UnsignedInt;
68
6
    IntMaxType = SignedLong;
69
6
    IntPtrType = SignedInt;
70
6
    PtrDiffType = SignedInt;
71
6
    FloatWidth = 32;
72
6
    FloatAlign = 32;
73
6
    DoubleWidth = 32;
74
6
    DoubleAlign = 32;
75
6
    LongDoubleWidth = 32;
76
6
    LongDoubleAlign = 32;
77
6
    FloatFormat = &llvm::APFloat::IEEEsingle();
78
6
    DoubleFormat = &llvm::APFloat::IEEEsingle();
79
6
    LongDoubleFormat = &llvm::APFloat::IEEEsingle();
80
6
    resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
81
6
                    "i16:16:32-i32:32:32-i64:32:32-"
82
6
                    "f32:32:32-f64:32:32-v64:32:32-"
83
6
                    "v128:32:32-v256:32:32-v512:32:32-"
84
6
                    "v1024:32:32-a0:0:32-n32");
85
6
    AddrSpaceMap = &TCEOpenCLAddrSpaceMap;
86
6
    UseAddrSpaceMapMangling = true;
87
6
  }
clang::targets::TCETargetInfo::TCETargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
58
5
      : TargetInfo(Triple) {
59
5
    TLSSupported = false;
60
5
    IntWidth = 32;
61
5
    LongWidth = LongLongWidth = 32;
62
5
    PointerWidth = 32;
63
5
    IntAlign = 32;
64
5
    LongAlign = LongLongAlign = 32;
65
5
    PointerAlign = 32;
66
5
    SuitableAlign = 32;
67
5
    SizeType = UnsignedInt;
68
5
    IntMaxType = SignedLong;
69
5
    IntPtrType = SignedInt;
70
5
    PtrDiffType = SignedInt;
71
5
    FloatWidth = 32;
72
5
    FloatAlign = 32;
73
5
    DoubleWidth = 32;
74
5
    DoubleAlign = 32;
75
5
    LongDoubleWidth = 32;
76
5
    LongDoubleAlign = 32;
77
5
    FloatFormat = &llvm::APFloat::IEEEsingle();
78
5
    DoubleFormat = &llvm::APFloat::IEEEsingle();
79
5
    LongDoubleFormat = &llvm::APFloat::IEEEsingle();
80
5
    resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
81
5
                    "i16:16:32-i32:32:32-i64:32:32-"
82
5
                    "f32:32:32-f64:32:32-v64:32:32-"
83
5
                    "v128:32:32-v256:32:32-v512:32:32-"
84
5
                    "v1024:32:32-a0:0:32-n32");
85
5
    AddrSpaceMap = &TCEOpenCLAddrSpaceMap;
86
5
    UseAddrSpaceMapMangling = true;
87
5
  }
clang::targets::TCETargetInfo::TCETargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
58
1
      : TargetInfo(Triple) {
59
1
    TLSSupported = false;
60
1
    IntWidth = 32;
61
1
    LongWidth = LongLongWidth = 32;
62
1
    PointerWidth = 32;
63
1
    IntAlign = 32;
64
1
    LongAlign = LongLongAlign = 32;
65
1
    PointerAlign = 32;
66
1
    SuitableAlign = 32;
67
1
    SizeType = UnsignedInt;
68
1
    IntMaxType = SignedLong;
69
1
    IntPtrType = SignedInt;
70
1
    PtrDiffType = SignedInt;
71
1
    FloatWidth = 32;
72
1
    FloatAlign = 32;
73
1
    DoubleWidth = 32;
74
1
    DoubleAlign = 32;
75
1
    LongDoubleWidth = 32;
76
1
    LongDoubleAlign = 32;
77
1
    FloatFormat = &llvm::APFloat::IEEEsingle();
78
1
    DoubleFormat = &llvm::APFloat::IEEEsingle();
79
1
    LongDoubleFormat = &llvm::APFloat::IEEEsingle();
80
1
    resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
81
1
                    "i16:16:32-i32:32:32-i64:32:32-"
82
1
                    "f32:32:32-f64:32:32-v64:32:32-"
83
1
                    "v128:32:32-v256:32:32-v512:32:32-"
84
1
                    "v1024:32:32-a0:0:32-n32");
85
1
    AddrSpaceMap = &TCEOpenCLAddrSpaceMap;
86
1
    UseAddrSpaceMapMangling = true;
87
1
  }
88
89
  void getTargetDefines(const LangOptions &Opts,
90
                        MacroBuilder &Builder) const override;
91
92
0
  bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }
93
94
6
  ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
95
96
0
  const char *getClobbers() const override { return ""; }
97
98
3
  BuiltinVaListKind getBuiltinVaListKind() const override {
99
3
    return TargetInfo::VoidPtrBuiltinVaList;
100
3
  }
101
102
0
  ArrayRef<const char *> getGCCRegNames() const override { return None; }
103
104
  bool validateAsmConstraint(const char *&Name,
105
0
                             TargetInfo::ConstraintInfo &info) const override {
106
0
    return true;
107
0
  }
108
109
0
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
110
0
    return None;
111
0
  }
112
};
113
114
class LLVM_LIBRARY_VISIBILITY TCELETargetInfo : public TCETargetInfo {
115
public:
116
  TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
117
1
      : TCETargetInfo(Triple, Opts) {
118
1
    BigEndian = false;
119
120
1
    resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"
121
1
                    "i16:16:32-i32:32:32-i64:32:32-"
122
1
                    "f32:32:32-f64:32:32-v64:32:32-"
123
1
                    "v128:32:32-v256:32:32-v512:32:32-"
124
1
                    "v1024:32:32-a0:0:32-n32");
125
1
  }
clang::targets::TCELETargetInfo::TCELETargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
117
1
      : TCETargetInfo(Triple, Opts) {
118
1
    BigEndian = false;
119
120
1
    resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"
121
1
                    "i16:16:32-i32:32:32-i64:32:32-"
122
1
                    "f32:32:32-f64:32:32-v64:32:32-"
123
1
                    "v128:32:32-v256:32:32-v512:32:32-"
124
1
                    "v1024:32:32-a0:0:32-n32");
125
1
  }
Unexecuted instantiation: clang::targets::TCELETargetInfo::TCELETargetInfo(llvm::Triple const&, clang::TargetOptions const&)
126
127
  void getTargetDefines(const LangOptions &Opts,
128
                        MacroBuilder &Builder) const override;
129
};
130
} // namespace targets
131
} // namespace clang
132
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H