Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/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
  /// PPC builtins
56
  namespace PPC {
57
    enum {
58
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
59
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60
#include "clang/Basic/BuiltinsPPC.def"
61
        LastTSBuiltin
62
    };
63
  }
64
65
  /// NVPTX builtins
66
  namespace NVPTX {
67
    enum {
68
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
69
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70
#include "clang/Basic/BuiltinsNVPTX.def"
71
        LastTSBuiltin
72
    };
73
  }
74
75
  /// AMDGPU builtins
76
  namespace AMDGPU {
77
  enum {
78
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
79
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80
  #include "clang/Basic/BuiltinsAMDGPU.def"
81
    LastTSBuiltin
82
  };
83
  }
84
85
  /// X86 builtins
86
  namespace X86 {
87
  enum {
88
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
89
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90
#include "clang/Basic/BuiltinsX86.def"
91
    FirstX86_64Builtin,
92
    LastX86CommonBuiltin = FirstX86_64Builtin - 1,
93
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
94
#include "clang/Basic/BuiltinsX86_64.def"
95
    LastTSBuiltin
96
  };
97
  }
98
99
  /// Flags to identify the types for overloaded Neon builtins.
100
  ///
101
  /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
102
  class NeonTypeFlags {
103
    enum {
104
      EltTypeMask = 0xf,
105
      UnsignedFlag = 0x10,
106
      QuadFlag = 0x20
107
    };
108
    uint32_t Flags;
109
110
  public:
111
    enum EltType {
112
      Int8,
113
      Int16,
114
      Int32,
115
      Int64,
116
      Poly8,
117
      Poly16,
118
      Poly64,
119
      Poly128,
120
      Float16,
121
      Float32,
122
      Float64
123
    };
124
125
27.6k
    NeonTypeFlags(unsigned F) : Flags(F) {}
126
41
    NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
127
41
      if (IsUnsigned)
128
0
        Flags |= UnsignedFlag;
129
41
      if (IsQuad)
130
23
        Flags |= QuadFlag;
131
41
    }
132
133
12.4k
    EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
134
37
    bool isPoly() const {
135
37
      EltType ET = getEltType();
136
37
      return ET == Poly8 || ET == Poly16;
137
37
    }
138
15.1k
    bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
139
23.1k
    bool isQuad() const { return (Flags & QuadFlag) != 0; }
140
  };
141
142
  /// Hexagon builtins
143
  namespace Hexagon {
144
    enum {
145
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
146
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
147
#include "clang/Basic/BuiltinsHexagon.def"
148
        LastTSBuiltin
149
    };
150
  }
151
152
  /// MIPS builtins
153
  namespace Mips {
154
    enum {
155
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
156
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
157
#include "clang/Basic/BuiltinsMips.def"
158
        LastTSBuiltin
159
    };
160
  }
161
162
  /// XCore builtins
163
  namespace XCore {
164
    enum {
165
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
166
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
167
#include "clang/Basic/BuiltinsXCore.def"
168
        LastTSBuiltin
169
    };
170
  }
171
172
  /// Le64 builtins
173
  namespace Le64 {
174
  enum {
175
    LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
176
  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
177
  #include "clang/Basic/BuiltinsLe64.def"
178
    LastTSBuiltin
179
  };
180
  }
181
182
  /// SystemZ builtins
183
  namespace SystemZ {
184
    enum {
185
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
186
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
187
#include "clang/Basic/BuiltinsSystemZ.def"
188
        LastTSBuiltin
189
    };
190
  }
191
192
  /// WebAssembly builtins
193
  namespace WebAssembly {
194
    enum {
195
      LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
196
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
197
#include "clang/Basic/BuiltinsWebAssembly.def"
198
      LastTSBuiltin
199
    };
200
  }
201
202
} // end namespace clang.
203
204
#endif