Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Basic/TargetBuiltins.h
Line
Count
Source (jump to first uncovered line)
1
//===--- TargetBuiltins.h - Target specific builtin IDs ---------*- 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
/// \file
10
/// Enumerates target-specific builtins in their own namespaces within
11
/// namespace ::clang.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H
16
#define LLVM_CLANG_BASIC_TARGETBUILTINS_H
17
18
#include <stdint.h>
19
#include "clang/Basic/Builtins.h"
20
#undef PPC
21
22
namespace clang {
23
24
  namespace NEON {
25
  enum {
26
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
27
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
28
#include "clang/Basic/BuiltinsNEON.def"
29
    FirstTSBuiltin
30
  };
31
  }
32
33
  /// ARM builtins
34
  namespace ARM {
35
    enum {
36
      LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
37
      LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
38
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
39
#include "clang/Basic/BuiltinsARM.def"
40
      LastTSBuiltin
41
    };
42
  }
43
44
  /// AArch64 builtins
45
  namespace AArch64 {
46
  enum {
47
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
48
    LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
49
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
50
  #include "clang/Basic/BuiltinsAArch64.def"
51
    LastTSBuiltin
52
  };
53
  }
54
55
  /// BPF builtins
56
  namespace BPF {
57
  enum {
58
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
59
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60
  #include "clang/Basic/BuiltinsBPF.def"
61
    LastTSBuiltin
62
  };
63
  }
64
65
  /// PPC builtins
66
  namespace PPC {
67
    enum {
68
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
69
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70
#include "clang/Basic/BuiltinsPPC.def"
71
        LastTSBuiltin
72
    };
73
  }
74
75
  /// NVPTX builtins
76
  namespace NVPTX {
77
    enum {
78
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
79
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80
#include "clang/Basic/BuiltinsNVPTX.def"
81
        LastTSBuiltin
82
    };
83
  }
84
85
  /// AMDGPU builtins
86
  namespace AMDGPU {
87
  enum {
88
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
89
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90
  #include "clang/Basic/BuiltinsAMDGPU.def"
91
    LastTSBuiltin
92
  };
93
  }
94
95
  /// X86 builtins
96
  namespace X86 {
97
  enum {
98
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
99
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
100
#include "clang/Basic/BuiltinsX86.def"
101
    FirstX86_64Builtin,
102
    LastX86CommonBuiltin = FirstX86_64Builtin - 1,
103
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
104
#include "clang/Basic/BuiltinsX86_64.def"
105
    LastTSBuiltin
106
  };
107
  }
108
109
  /// Flags to identify the types for overloaded Neon builtins.
110
  ///
111
  /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
112
  class NeonTypeFlags {
113
    enum {
114
      EltTypeMask = 0xf,
115
      UnsignedFlag = 0x10,
116
      QuadFlag = 0x20
117
    };
118
    uint32_t Flags;
119
120
  public:
121
    enum EltType {
122
      Int8,
123
      Int16,
124
      Int32,
125
      Int64,
126
      Poly8,
127
      Poly16,
128
      Poly64,
129
      Poly128,
130
      Float16,
131
      Float32,
132
      Float64
133
    };
134
135
11.8k
    NeonTypeFlags(unsigned F) : Flags(F) {}
136
59
    NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
137
59
      if (IsUnsigned)
138
0
        Flags |= UnsignedFlag;
139
59
      if (IsQuad)
140
31
        Flags |= QuadFlag;
141
59
    }
142
143
9.18k
    EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
144
18
    bool isPoly() const {
145
18
      EltType ET = getEltType();
146
18
      return ET == Poly8 || ET == Poly16;
147
18
    }
148
7.21k
    bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
149
12.6k
    bool isQuad() const { return (Flags & QuadFlag) != 0; }
150
  };
151
152
  /// Hexagon builtins
153
  namespace Hexagon {
154
    enum {
155
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
156
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
157
#include "clang/Basic/BuiltinsHexagon.def"
158
        LastTSBuiltin
159
    };
160
  }
161
162
  /// MIPS builtins
163
  namespace Mips {
164
    enum {
165
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
166
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
167
#include "clang/Basic/BuiltinsMips.def"
168
        LastTSBuiltin
169
    };
170
  }
171
172
  /// XCore builtins
173
  namespace XCore {
174
    enum {
175
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
176
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
177
#include "clang/Basic/BuiltinsXCore.def"
178
        LastTSBuiltin
179
    };
180
  }
181
182
  /// Le64 builtins
183
  namespace Le64 {
184
  enum {
185
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
186
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
187
  #include "clang/Basic/BuiltinsLe64.def"
188
    LastTSBuiltin
189
  };
190
  }
191
192
  /// SystemZ builtins
193
  namespace SystemZ {
194
    enum {
195
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
196
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
197
#include "clang/Basic/BuiltinsSystemZ.def"
198
        LastTSBuiltin
199
    };
200
  }
201
202
  /// WebAssembly builtins
203
  namespace WebAssembly {
204
    enum {
205
      LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
206
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
207
#include "clang/Basic/BuiltinsWebAssembly.def"
208
      LastTSBuiltin
209
    };
210
  }
211
212
} // end namespace clang.
213
214
#endif