Coverage Report

Created: 2018-07-20 23:04

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