Builtins.def revision 263508
1178825Sdfr//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===//
2233294Sstas//
3233294Sstas//                     The LLVM Compiler Infrastructure
4233294Sstas//
5178825Sdfr// This file is distributed under the University of Illinois Open Source
6233294Sstas// License. See LICENSE.TXT for details.
7233294Sstas//
8233294Sstas//===----------------------------------------------------------------------===//
9178825Sdfr//
10233294Sstas// This file defines the standard builtin function database.  Users of this file
11233294Sstas// must define the BUILTIN macro to make use of this information.
12178825Sdfr//
13233294Sstas//===----------------------------------------------------------------------===//
14233294Sstas
15233294Sstas// FIXME: This should really be a .td file, but that requires modifying tblgen.
16178825Sdfr// Perhaps tblgen should have plugins.
17233294Sstas
18233294Sstas// The first value provided to the macro specifies the function name of the
19233294Sstas// builtin, and results in a clang::builtin::BIXX enum value for XX.
20178825Sdfr
21233294Sstas// The second value provided to the macro specifies the type of the function
22233294Sstas// (result value, then each argument) as follows:
23233294Sstas//  v -> void
24233294Sstas//  b -> boolean
25233294Sstas//  c -> char
26233294Sstas//  s -> short
27233294Sstas//  i -> int
28233294Sstas//  h -> half
29233294Sstas//  f -> float
30233294Sstas//  d -> double
31233294Sstas//  z -> size_t
32178825Sdfr//  F -> constant CFString
33178825Sdfr//  G -> id
34233294Sstas//  H -> SEL
35178825Sdfr//  M -> struct objc_super
36233294Sstas//  a -> __builtin_va_list
37178825Sdfr//  A -> "reference" to __builtin_va_list
38178825Sdfr//  V -> Vector, followed by the number of elements and the base type.
39178825Sdfr//  E -> ext_vector, followed by the number of elements and the base type.
40178825Sdfr//  X -> _Complex, followed by the base type.
41178825Sdfr//  Y -> ptrdiff_t
42178825Sdfr//  P -> FILE
43178825Sdfr//  J -> jmp_buf
44178825Sdfr//  SJ -> sigjmp_buf
45178825Sdfr//  K -> ucontext_t
46178825Sdfr//  p -> pid_t
47178825Sdfr//  . -> "...".  This may only occur at the end of the function list.
48178825Sdfr//
49178825Sdfr// Types may be prefixed with the following modifiers:
50178825Sdfr//  L   -> long (e.g. Li for 'long int')
51178825Sdfr//  LL  -> long long
52178825Sdfr//  LLL -> __int128_t (e.g. LLLi)
53178825Sdfr//  S   -> signed
54//  U   -> unsigned
55//  I   -> Required to constant fold to an integer constant expression.
56//
57// Types may be postfixed with the following modifiers:
58// * -> pointer (optionally followed by an address space number)
59// & -> reference (optionally followed by an address space number)
60// C -> const
61// D -> volatile
62
63// The third value provided to the macro specifies information about attributes
64// of the function.  These must be kept in sync with the predicates in the
65// Builtin::Context class.  Currently we have:
66//  n -> nothrow
67//  r -> noreturn
68//  c -> const
69//  t -> signature is meaningless, use custom typechecking
70//  F -> this is a libc/libm function with a '__builtin_' prefix added.
71//  f -> this is a libc/libm function without the '__builtin_' prefix. It can
72//       be followed by ':headername:' to state which header this function
73//       comes from.
74//  i -> this is a runtime library implemented function without the
75//       '__builtin_' prefix. It will be implemented in compiter-rt or libgcc.
76//  p:N: -> this is a printf-like function whose Nth argument is the format
77//          string.
78//  P:N: -> similar to the p:N: attribute, but the function is like vprintf
79//          in that it accepts its arguments as a va_list rather than
80//          through an ellipsis
81//  s:N: -> this is a scanf-like function whose Nth argument is the format
82//          string.
83//  S:N: -> similar to the s:N: attribute, but the function is like vscanf
84//          in that it accepts its arguments as a va_list rather than
85//          through an ellipsis
86//  e -> const, but only when -fmath-errno=0
87//  j -> returns_twice (like setjmp)
88//  u -> arguments are not evaluated for their side-effects
89//  FIXME: gcc has nonnull
90
91#if defined(BUILTIN) && !defined(LIBBUILTIN)
92#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
93#endif
94
95#if defined(BUILTIN) && !defined(LANGBUILTIN)
96#  define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
97#endif
98
99// Standard libc/libm functions:
100BUILTIN(__builtin_atan2 , "ddd"  , "Fnc")
101BUILTIN(__builtin_atan2f, "fff"  , "Fnc")
102BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc")
103BUILTIN(__builtin_abs  , "ii"  , "ncF")
104BUILTIN(__builtin_copysign, "ddd", "ncF")
105BUILTIN(__builtin_copysignf, "fff", "ncF")
106BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
107BUILTIN(__builtin_fabs , "dd"  , "ncF")
108BUILTIN(__builtin_fabsf, "ff"  , "ncF")
109BUILTIN(__builtin_fabsl, "LdLd", "ncF")
110BUILTIN(__builtin_fmod , "ddd"  , "Fnc")
111BUILTIN(__builtin_fmodf, "fff"  , "Fnc")
112BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc")
113BUILTIN(__builtin_frexp , "ddi*"  , "Fn")
114BUILTIN(__builtin_frexpf, "ffi*"  , "Fn")
115BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
116BUILTIN(__builtin_huge_val, "d", "nc")
117BUILTIN(__builtin_huge_valf, "f", "nc")
118BUILTIN(__builtin_huge_vall, "Ld", "nc")
119BUILTIN(__builtin_inf  , "d"   , "nc")
120BUILTIN(__builtin_inff , "f"   , "nc")
121BUILTIN(__builtin_infl , "Ld"  , "nc")
122BUILTIN(__builtin_labs , "LiLi"  , "Fnc")
123BUILTIN(__builtin_llabs, "LLiLLi", "Fnc")
124BUILTIN(__builtin_ldexp , "ddi"  , "Fnc")
125BUILTIN(__builtin_ldexpf, "ffi"  , "Fnc")
126BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc")
127BUILTIN(__builtin_modf , "ddd*"  , "Fn")
128BUILTIN(__builtin_modff, "fff*"  , "Fn")
129BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
130BUILTIN(__builtin_nan,  "dcC*" , "ncF")
131BUILTIN(__builtin_nanf, "fcC*" , "ncF")
132BUILTIN(__builtin_nanl, "LdcC*", "ncF")
133BUILTIN(__builtin_nans,  "dcC*" , "ncF")
134BUILTIN(__builtin_nansf, "fcC*" , "ncF")
135BUILTIN(__builtin_nansl, "LdcC*", "ncF")
136BUILTIN(__builtin_powi , "ddi"  , "Fnc")
137BUILTIN(__builtin_powif, "ffi"  , "Fnc")
138BUILTIN(__builtin_powil, "LdLdi", "Fnc")
139BUILTIN(__builtin_pow , "ddd"  , "Fnc")
140BUILTIN(__builtin_powf, "fff"  , "Fnc")
141BUILTIN(__builtin_powl, "LdLdLd", "Fnc")
142
143// Standard unary libc/libm functions with double/float/long double variants:
144BUILTIN(__builtin_acos , "dd"  , "Fnc")
145BUILTIN(__builtin_acosf, "ff"  , "Fnc")
146BUILTIN(__builtin_acosl, "LdLd", "Fnc")
147BUILTIN(__builtin_acosh , "dd"  , "Fnc")
148BUILTIN(__builtin_acoshf, "ff"  , "Fnc")
149BUILTIN(__builtin_acoshl, "LdLd", "Fnc")
150BUILTIN(__builtin_asin , "dd"  , "Fnc")
151BUILTIN(__builtin_asinf, "ff"  , "Fnc")
152BUILTIN(__builtin_asinl, "LdLd", "Fnc")
153BUILTIN(__builtin_asinh , "dd"  , "Fnc")
154BUILTIN(__builtin_asinhf, "ff"  , "Fnc")
155BUILTIN(__builtin_asinhl, "LdLd", "Fnc")
156BUILTIN(__builtin_atan , "dd"  , "Fnc")
157BUILTIN(__builtin_atanf, "ff"  , "Fnc")
158BUILTIN(__builtin_atanl, "LdLd", "Fnc")
159BUILTIN(__builtin_atanh , "dd", "Fnc")
160BUILTIN(__builtin_atanhf, "ff", "Fnc")
161BUILTIN(__builtin_atanhl, "LdLd", "Fnc")
162BUILTIN(__builtin_cbrt , "dd", "Fnc")
163BUILTIN(__builtin_cbrtf, "ff", "Fnc")
164BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
165BUILTIN(__builtin_ceil , "dd"  , "Fnc")
166BUILTIN(__builtin_ceilf, "ff"  , "Fnc")
167BUILTIN(__builtin_ceill, "LdLd", "Fnc")
168BUILTIN(__builtin_cos , "dd"  , "Fnc")
169BUILTIN(__builtin_cosf, "ff"  , "Fnc")
170BUILTIN(__builtin_cosh , "dd"  , "Fnc")
171BUILTIN(__builtin_coshf, "ff"  , "Fnc")
172BUILTIN(__builtin_coshl, "LdLd", "Fnc")
173BUILTIN(__builtin_cosl, "LdLd", "Fnc")
174BUILTIN(__builtin_erf , "dd", "Fnc")
175BUILTIN(__builtin_erff, "ff", "Fnc")
176BUILTIN(__builtin_erfl, "LdLd", "Fnc")
177BUILTIN(__builtin_erfc , "dd", "Fnc")
178BUILTIN(__builtin_erfcf, "ff", "Fnc")
179BUILTIN(__builtin_erfcl, "LdLd", "Fnc")
180BUILTIN(__builtin_exp , "dd"  , "Fnc")
181BUILTIN(__builtin_expf, "ff"  , "Fnc")
182BUILTIN(__builtin_expl, "LdLd", "Fnc")
183BUILTIN(__builtin_exp2 , "dd"  , "Fnc")
184BUILTIN(__builtin_exp2f, "ff"  , "Fnc")
185BUILTIN(__builtin_exp2l, "LdLd", "Fnc")
186BUILTIN(__builtin_expm1 , "dd", "Fnc")
187BUILTIN(__builtin_expm1f, "ff", "Fnc")
188BUILTIN(__builtin_expm1l, "LdLd", "Fnc")
189BUILTIN(__builtin_fdim, "ddd", "Fnc")
190BUILTIN(__builtin_fdimf, "fff", "Fnc")
191BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc")
192BUILTIN(__builtin_floor , "dd"  , "Fnc")
193BUILTIN(__builtin_floorf, "ff"  , "Fnc")
194BUILTIN(__builtin_floorl, "LdLd", "Fnc")
195BUILTIN(__builtin_fma, "dddd", "Fnc")
196BUILTIN(__builtin_fmaf, "ffff", "Fnc")
197BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc")
198BUILTIN(__builtin_fmax, "ddd", "Fnc")
199BUILTIN(__builtin_fmaxf, "fff", "Fnc")
200BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
201BUILTIN(__builtin_fmin, "ddd", "Fnc")
202BUILTIN(__builtin_fminf, "fff", "Fnc")
203BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
204BUILTIN(__builtin_hypot , "ddd"  , "Fnc")
205BUILTIN(__builtin_hypotf, "fff"  , "Fnc")
206BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc")
207BUILTIN(__builtin_ilogb , "id", "Fnc")
208BUILTIN(__builtin_ilogbf, "if", "Fnc")
209BUILTIN(__builtin_ilogbl, "iLd", "Fnc")
210BUILTIN(__builtin_lgamma , "dd", "Fnc")
211BUILTIN(__builtin_lgammaf, "ff", "Fnc")
212BUILTIN(__builtin_lgammal, "LdLd", "Fnc")
213BUILTIN(__builtin_llrint, "LLid", "Fnc")
214BUILTIN(__builtin_llrintf, "LLif", "Fnc")
215BUILTIN(__builtin_llrintl, "LLiLd", "Fnc")
216BUILTIN(__builtin_llround , "LLid", "Fnc")
217BUILTIN(__builtin_llroundf, "LLif", "Fnc")
218BUILTIN(__builtin_llroundl, "LLiLd", "Fnc")
219BUILTIN(__builtin_log , "dd"  , "Fnc")
220BUILTIN(__builtin_log10 , "dd"  , "Fnc")
221BUILTIN(__builtin_log10f, "ff"  , "Fnc")
222BUILTIN(__builtin_log10l, "LdLd", "Fnc")
223BUILTIN(__builtin_log1p , "dd"  , "Fnc")
224BUILTIN(__builtin_log1pf, "ff"  , "Fnc")
225BUILTIN(__builtin_log1pl, "LdLd", "Fnc")
226BUILTIN(__builtin_log2, "dd"  , "Fnc")
227BUILTIN(__builtin_log2f, "ff"  , "Fnc")
228BUILTIN(__builtin_log2l, "LdLd"  , "Fnc")
229BUILTIN(__builtin_logb , "dd", "Fnc")
230BUILTIN(__builtin_logbf, "ff", "Fnc")
231BUILTIN(__builtin_logbl, "LdLd", "Fnc")
232BUILTIN(__builtin_logf, "ff"  , "Fnc")
233BUILTIN(__builtin_logl, "LdLd", "Fnc")
234BUILTIN(__builtin_lrint , "Lid", "Fnc")
235BUILTIN(__builtin_lrintf, "Lif", "Fnc")
236BUILTIN(__builtin_lrintl, "LiLd", "Fnc")
237BUILTIN(__builtin_lround , "Lid", "Fnc")
238BUILTIN(__builtin_lroundf, "Lif", "Fnc")
239BUILTIN(__builtin_lroundl, "LiLd", "Fnc")
240BUILTIN(__builtin_nearbyint , "dd", "Fnc")
241BUILTIN(__builtin_nearbyintf, "ff", "Fnc")
242BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc")
243BUILTIN(__builtin_nextafter , "ddd", "Fnc")
244BUILTIN(__builtin_nextafterf, "fff", "Fnc")
245BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc")
246BUILTIN(__builtin_nexttoward , "ddLd", "Fnc")
247BUILTIN(__builtin_nexttowardf, "ffLd", "Fnc")
248BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc")
249BUILTIN(__builtin_remainder , "ddd", "Fnc")
250BUILTIN(__builtin_remainderf, "fff", "Fnc")
251BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc")
252BUILTIN(__builtin_remquo , "dddi*", "Fn")
253BUILTIN(__builtin_remquof, "fffi*", "Fn")
254BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
255BUILTIN(__builtin_rint , "dd", "Fnc")
256BUILTIN(__builtin_rintf, "ff", "Fnc")
257BUILTIN(__builtin_rintl, "LdLd", "Fnc")
258BUILTIN(__builtin_round, "dd"  , "Fnc")
259BUILTIN(__builtin_roundf, "ff"  , "Fnc")
260BUILTIN(__builtin_roundl, "LdLd"  , "Fnc")
261BUILTIN(__builtin_scalbln , "ddLi", "Fnc")
262BUILTIN(__builtin_scalblnf, "ffLi", "Fnc")
263BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc")
264BUILTIN(__builtin_scalbn , "ddi", "Fnc")
265BUILTIN(__builtin_scalbnf, "ffi", "Fnc")
266BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc")
267BUILTIN(__builtin_sin , "dd"  , "Fnc")
268BUILTIN(__builtin_sinf, "ff"  , "Fnc")
269BUILTIN(__builtin_sinh , "dd"  , "Fnc")
270BUILTIN(__builtin_sinhf, "ff"  , "Fnc")
271BUILTIN(__builtin_sinhl, "LdLd", "Fnc")
272BUILTIN(__builtin_sinl, "LdLd", "Fnc")
273BUILTIN(__builtin_sqrt , "dd"  , "Fnc")
274BUILTIN(__builtin_sqrtf, "ff"  , "Fnc")
275BUILTIN(__builtin_sqrtl, "LdLd", "Fnc")
276BUILTIN(__builtin_tan , "dd"  , "Fnc")
277BUILTIN(__builtin_tanf, "ff"  , "Fnc")
278BUILTIN(__builtin_tanh , "dd"  , "Fnc")
279BUILTIN(__builtin_tanhf, "ff"  , "Fnc")
280BUILTIN(__builtin_tanhl, "LdLd", "Fnc")
281BUILTIN(__builtin_tanl, "LdLd", "Fnc")
282BUILTIN(__builtin_tgamma , "dd", "Fnc")
283BUILTIN(__builtin_tgammaf, "ff", "Fnc")
284BUILTIN(__builtin_tgammal, "LdLd", "Fnc")
285BUILTIN(__builtin_trunc , "dd", "Fnc")
286BUILTIN(__builtin_truncf, "ff", "Fnc")
287BUILTIN(__builtin_truncl, "LdLd", "Fnc")
288
289// C99 complex builtins
290BUILTIN(__builtin_cabs, "dXd", "Fnc")
291BUILTIN(__builtin_cabsf, "fXf", "Fnc")
292BUILTIN(__builtin_cabsl, "LdXLd", "Fnc")
293BUILTIN(__builtin_cacos, "XdXd", "Fnc")
294BUILTIN(__builtin_cacosf, "XfXf", "Fnc")
295BUILTIN(__builtin_cacosh, "XdXd", "Fnc")
296BUILTIN(__builtin_cacoshf, "XfXf", "Fnc")
297BUILTIN(__builtin_cacoshl, "XLdXLd", "Fnc")
298BUILTIN(__builtin_cacosl, "XLdXLd", "Fnc")
299BUILTIN(__builtin_carg, "dXd", "Fnc")
300BUILTIN(__builtin_cargf, "fXf", "Fnc")
301BUILTIN(__builtin_cargl, "LdXLd", "Fnc")
302BUILTIN(__builtin_casin, "XdXd", "Fnc")
303BUILTIN(__builtin_casinf, "XfXf", "Fnc")
304BUILTIN(__builtin_casinh, "XdXd", "Fnc")
305BUILTIN(__builtin_casinhf, "XfXf", "Fnc")
306BUILTIN(__builtin_casinhl, "XLdXLd", "Fnc")
307BUILTIN(__builtin_casinl, "XLdXLd", "Fnc")
308BUILTIN(__builtin_catan, "XdXd", "Fnc")
309BUILTIN(__builtin_catanf, "XfXf", "Fnc")
310BUILTIN(__builtin_catanh, "XdXd", "Fnc")
311BUILTIN(__builtin_catanhf, "XfXf", "Fnc")
312BUILTIN(__builtin_catanhl, "XLdXLd", "Fnc")
313BUILTIN(__builtin_catanl, "XLdXLd", "Fnc")
314BUILTIN(__builtin_ccos, "XdXd", "Fnc")
315BUILTIN(__builtin_ccosf, "XfXf", "Fnc")
316BUILTIN(__builtin_ccosl, "XLdXLd", "Fnc")
317BUILTIN(__builtin_ccosh, "XdXd", "Fnc")
318BUILTIN(__builtin_ccoshf, "XfXf", "Fnc")
319BUILTIN(__builtin_ccoshl, "XLdXLd", "Fnc")
320BUILTIN(__builtin_cexp, "XdXd", "Fnc")
321BUILTIN(__builtin_cexpf, "XfXf", "Fnc")
322BUILTIN(__builtin_cexpl, "XLdXLd", "Fnc")
323BUILTIN(__builtin_cimag, "dXd", "Fnc")
324BUILTIN(__builtin_cimagf, "fXf", "Fnc")
325BUILTIN(__builtin_cimagl, "LdXLd", "Fnc")
326BUILTIN(__builtin_conj, "XdXd", "Fnc")
327BUILTIN(__builtin_conjf, "XfXf", "Fnc")
328BUILTIN(__builtin_conjl, "XLdXLd", "Fnc")
329BUILTIN(__builtin_clog, "XdXd", "Fnc")
330BUILTIN(__builtin_clogf, "XfXf", "Fnc")
331BUILTIN(__builtin_clogl, "XLdXLd", "Fnc")
332BUILTIN(__builtin_cproj, "XdXd", "Fnc")
333BUILTIN(__builtin_cprojf, "XfXf", "Fnc")
334BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc")
335BUILTIN(__builtin_cpow, "XdXdXd", "Fnc")
336BUILTIN(__builtin_cpowf, "XfXfXf", "Fnc")
337BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fnc")
338BUILTIN(__builtin_creal, "dXd", "Fnc")
339BUILTIN(__builtin_crealf, "fXf", "Fnc")
340BUILTIN(__builtin_creall, "LdXLd", "Fnc")
341BUILTIN(__builtin_csin, "XdXd", "Fnc")
342BUILTIN(__builtin_csinf, "XfXf", "Fnc")
343BUILTIN(__builtin_csinl, "XLdXLd", "Fnc")
344BUILTIN(__builtin_csinh, "XdXd", "Fnc")
345BUILTIN(__builtin_csinhf, "XfXf", "Fnc")
346BUILTIN(__builtin_csinhl, "XLdXLd", "Fnc")
347BUILTIN(__builtin_csqrt, "XdXd", "Fnc")
348BUILTIN(__builtin_csqrtf, "XfXf", "Fnc")
349BUILTIN(__builtin_csqrtl, "XLdXLd", "Fnc")
350BUILTIN(__builtin_ctan, "XdXd", "Fnc")
351BUILTIN(__builtin_ctanf, "XfXf", "Fnc")
352BUILTIN(__builtin_ctanl, "XLdXLd", "Fnc")
353BUILTIN(__builtin_ctanh, "XdXd", "Fnc")
354BUILTIN(__builtin_ctanhf, "XfXf", "Fnc")
355BUILTIN(__builtin_ctanhl, "XLdXLd", "Fnc")
356
357// FP Comparisons.
358BUILTIN(__builtin_isgreater     , "i.", "nc")
359BUILTIN(__builtin_isgreaterequal, "i.", "nc")
360BUILTIN(__builtin_isless        , "i.", "nc")
361BUILTIN(__builtin_islessequal   , "i.", "nc")
362BUILTIN(__builtin_islessgreater , "i.", "nc")
363BUILTIN(__builtin_isunordered   , "i.", "nc")
364
365// Unary FP classification
366BUILTIN(__builtin_fpclassify, "iiiii.", "nc")
367BUILTIN(__builtin_isfinite,   "i.", "nc")
368BUILTIN(__builtin_isinf,      "i.", "nc")
369BUILTIN(__builtin_isinf_sign, "i.", "nc")
370BUILTIN(__builtin_isnan,      "i.", "nc")
371BUILTIN(__builtin_isnormal,   "i.", "nc")
372
373// FP signbit builtins
374BUILTIN(__builtin_signbit, "id", "nc")
375BUILTIN(__builtin_signbitf, "if", "nc")
376BUILTIN(__builtin_signbitl, "iLd", "nc")
377
378// Builtins for arithmetic.
379BUILTIN(__builtin_clzs , "iUs"  , "nc")
380BUILTIN(__builtin_clz  , "iUi"  , "nc")
381BUILTIN(__builtin_clzl , "iULi" , "nc")
382BUILTIN(__builtin_clzll, "iULLi", "nc")
383// TODO: int clzimax(uintmax_t)
384BUILTIN(__builtin_ctzs , "iUs"  , "nc")
385BUILTIN(__builtin_ctz  , "iUi"  , "nc")
386BUILTIN(__builtin_ctzl , "iULi" , "nc")
387BUILTIN(__builtin_ctzll, "iULLi", "nc")
388// TODO: int ctzimax(uintmax_t)
389BUILTIN(__builtin_ffs  , "ii"  , "nc")
390BUILTIN(__builtin_ffsl , "iLi" , "nc")
391BUILTIN(__builtin_ffsll, "iLLi", "nc")
392BUILTIN(__builtin_parity  , "iUi"  , "nc")
393BUILTIN(__builtin_parityl , "iULi" , "nc")
394BUILTIN(__builtin_parityll, "iULLi", "nc")
395BUILTIN(__builtin_popcount  , "iUi"  , "nc")
396BUILTIN(__builtin_popcountl , "iULi" , "nc")
397BUILTIN(__builtin_popcountll, "iULLi", "nc")
398
399// FIXME: These type signatures are not correct for targets with int != 32-bits
400// or with ULL != 64-bits.
401BUILTIN(__builtin_bswap16, "UsUs", "nc")
402BUILTIN(__builtin_bswap32, "UiUi", "nc")
403BUILTIN(__builtin_bswap64, "ULLiULLi", "nc")
404
405// Random GCC builtins
406BUILTIN(__builtin_constant_p, "i.", "nctu")
407BUILTIN(__builtin_classify_type, "i.", "nctu")
408BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")
409BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc")
410BUILTIN(__builtin_va_start, "vA.", "nt")
411BUILTIN(__builtin_va_end, "vA", "n")
412BUILTIN(__builtin_va_copy, "vAA", "n")
413BUILTIN(__builtin_stdarg_start, "vA.", "n")
414BUILTIN(__builtin_bcmp, "iv*v*z", "n")
415BUILTIN(__builtin_bcopy, "vv*v*z", "n")
416BUILTIN(__builtin_bzero, "vv*z", "nF")
417BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:")
418BUILTIN(__builtin_memchr, "v*vC*iz", "nF")
419BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF")
420BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
421BUILTIN(__builtin_memmove, "v*v*vC*z", "nF")
422BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF")
423BUILTIN(__builtin_memset, "v*v*iz", "nF")
424BUILTIN(__builtin_printf, "icC*.", "Fp:0:")
425BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF")
426BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF")
427BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF")
428BUILTIN(__builtin_strcat, "c*c*cC*", "nF")
429BUILTIN(__builtin_strchr, "c*cC*i", "nF")
430BUILTIN(__builtin_strcmp, "icC*cC*", "nF")
431BUILTIN(__builtin_strcpy, "c*c*cC*", "nF")
432BUILTIN(__builtin_strcspn, "zcC*cC*", "nF")
433BUILTIN(__builtin_strdup, "c*cC*", "nF")
434BUILTIN(__builtin_strlen, "zcC*", "nF")
435BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF")
436BUILTIN(__builtin_strncat, "c*c*cC*z", "nF")
437BUILTIN(__builtin_strncmp, "icC*cC*z", "nF")
438BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF")
439BUILTIN(__builtin_strndup, "c*cC*z", "nF")
440BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF")
441BUILTIN(__builtin_strrchr, "c*cC*i", "nF")
442BUILTIN(__builtin_strspn, "zcC*cC*", "nF")
443BUILTIN(__builtin_strstr, "c*cC*cC*", "nF")
444BUILTIN(__builtin_return_address, "v*IUi", "n")
445BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
446BUILTIN(__builtin_frame_address, "v*IUi", "n")
447BUILTIN(__builtin_flt_rounds, "i", "nc")
448BUILTIN(__builtin_setjmp, "iv**", "j")
449BUILTIN(__builtin_longjmp, "vv**i", "r")
450BUILTIN(__builtin_unwind_init, "v", "")
451BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc")
452BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:")
453BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:")
454BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:")
455
456// GCC exception builtins
457BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t!
458BUILTIN(__builtin_frob_return_addr, "v*v*", "n")
459BUILTIN(__builtin_dwarf_cfa, "v*", "n")
460BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n")
461BUILTIN(__builtin_dwarf_sp_column, "Ui", "n")
462BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t
463
464// GCC Object size checking builtins
465BUILTIN(__builtin_object_size, "zvC*i", "nu")
466BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF")
467BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF")
468BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF")
469BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF")
470BUILTIN(__builtin___memset_chk, "v*v*izz", "nF")
471BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
472BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
473BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
474BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
475BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
476BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
477BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
478BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
479BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:")
480BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:")
481BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:")
482BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:")
483BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:")
484BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:")
485BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:")
486BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:")
487
488BUILTIN(__builtin_expect, "LiLiLi"   , "nc")
489BUILTIN(__builtin_prefetch, "vvC*.", "nc")
490BUILTIN(__builtin_readcyclecounter, "ULLi", "n")
491BUILTIN(__builtin_trap, "v", "nr")
492BUILTIN(__builtin_debugtrap, "v", "n")
493BUILTIN(__builtin_unreachable, "v", "nr")
494BUILTIN(__builtin_shufflevector, "v."   , "nc")
495BUILTIN(__builtin_convertvector, "v."   , "nct")
496BUILTIN(__builtin_alloca, "v*z"   , "n")
497
498// "Overloaded" Atomic operator builtins.  These are overloaded to support data
499// types of i8, i16, i32, i64, and i128.  The front-end sees calls to the
500// non-suffixed version of these (which has a bogus type) and transforms them to
501// the right overloaded version in Sema (plus casts).
502
503// FIXME: These assume that char -> i8, short -> i16, int -> i32,
504// long long -> i64.
505
506BUILTIN(__sync_fetch_and_add, "v.", "t")
507BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt")
508BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt")
509BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
510BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt")
511BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt")
512
513BUILTIN(__sync_fetch_and_sub, "v.", "t")
514BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt")
515BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt")
516BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt")
517BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt")
518BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt")
519
520BUILTIN(__sync_fetch_and_or, "v.", "t")
521BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt")
522BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt")
523BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt")
524BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt")
525BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt")
526
527BUILTIN(__sync_fetch_and_and, "v.", "t")
528BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn")
529BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn")
530BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn")
531BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn")
532BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn")
533
534BUILTIN(__sync_fetch_and_xor, "v.", "t")
535BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn")
536BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn")
537BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn")
538BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn")
539BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn")
540
541
542BUILTIN(__sync_add_and_fetch, "v.", "t")
543BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn")
544BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn")
545BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn")
546BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn")
547BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
548
549BUILTIN(__sync_sub_and_fetch, "v.", "t")
550BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn")
551BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn")
552BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn")
553BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn")
554BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
555
556BUILTIN(__sync_or_and_fetch, "v.", "t")
557BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn")
558BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn")
559BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn")
560BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn")
561BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
562
563BUILTIN(__sync_and_and_fetch, "v.", "t")
564BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn")
565BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn")
566BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn")
567BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn")
568BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
569
570BUILTIN(__sync_xor_and_fetch, "v.", "t")
571BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn")
572BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn")
573BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn")
574BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn")
575BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
576
577BUILTIN(__sync_bool_compare_and_swap, "v.", "t")
578BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn")
579BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn")
580BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn")
581BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn")
582BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn")
583
584BUILTIN(__sync_val_compare_and_swap, "v.", "t")
585BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn")
586BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn")
587BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn")
588BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn")
589BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn")
590
591BUILTIN(__sync_lock_test_and_set, "v.", "t")
592BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn")
593BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn")
594BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn")
595BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn")
596BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn")
597
598BUILTIN(__sync_lock_release, "v.", "t")
599BUILTIN(__sync_lock_release_1, "vcD*.", "tn")
600BUILTIN(__sync_lock_release_2, "vsD*.", "tn")
601BUILTIN(__sync_lock_release_4, "viD*.", "tn")
602BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn")
603BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn")
604
605BUILTIN(__sync_swap, "v.", "t")
606BUILTIN(__sync_swap_1, "ccD*c.", "tn")
607BUILTIN(__sync_swap_2, "ssD*s.", "tn")
608BUILTIN(__sync_swap_4, "iiD*i.", "tn")
609BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn")
610BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn")
611
612// Some of our atomics builtins are handled by AtomicExpr rather than
613// as normal builtin CallExprs. This macro is used for such builtins.
614#ifndef ATOMIC_BUILTIN
615#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)
616#endif
617
618// C11 _Atomic operations for <stdatomic.h>.
619ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t")
620ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t")
621ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t")
622ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t")
623ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t")
624ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t")
625ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t")
626ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t")
627ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t")
628ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t")
629ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t")
630BUILTIN(__c11_atomic_thread_fence, "vi", "n")
631BUILTIN(__c11_atomic_signal_fence, "vi", "n")
632BUILTIN(__c11_atomic_is_lock_free, "iz", "n")
633
634// GNU atomic builtins.
635ATOMIC_BUILTIN(__atomic_load, "v.", "t")
636ATOMIC_BUILTIN(__atomic_load_n, "v.", "t")
637ATOMIC_BUILTIN(__atomic_store, "v.", "t")
638ATOMIC_BUILTIN(__atomic_store_n, "v.", "t")
639ATOMIC_BUILTIN(__atomic_exchange, "v.", "t")
640ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t")
641ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t")
642ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t")
643ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t")
644ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t")
645ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t")
646ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t")
647ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t")
648ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t")
649ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t")
650ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t")
651ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t")
652ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t")
653ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t")
654ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t")
655BUILTIN(__atomic_test_and_set, "bvD*i", "n")
656BUILTIN(__atomic_clear, "vvD*i", "n")
657BUILTIN(__atomic_thread_fence, "vi", "n")
658BUILTIN(__atomic_signal_fence, "vi", "n")
659BUILTIN(__atomic_always_lock_free, "izvCD*", "n")
660BUILTIN(__atomic_is_lock_free, "izvCD*", "n")
661
662#undef ATOMIC_BUILTIN
663
664// Non-overloaded atomic builtins.
665BUILTIN(__sync_synchronize, "v.", "n")
666// GCC does not support these, they are a Clang extension.
667BUILTIN(__sync_fetch_and_min, "iiD*i", "n")
668BUILTIN(__sync_fetch_and_max, "iiD*i", "n")
669BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n")
670BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n")
671
672// Random libc builtins.
673BUILTIN(__builtin_abort, "v", "Fnr")
674BUILTIN(__builtin_index, "c*cC*i", "Fn")
675BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
676
677// Microsoft builtins.  These are only active with -fms-extensions.
678LANGBUILTIN(_alloca,      "v*z", "n", ALL_MS_LANGUAGES)
679LANGBUILTIN(__assume,     "vb",  "n", ALL_MS_LANGUAGES)
680LANGBUILTIN(__noop,       "v.",  "n", ALL_MS_LANGUAGES)
681LANGBUILTIN(__debugbreak, "v",   "n", ALL_MS_LANGUAGES)
682
683// C99 library functions
684// C99 stdlib.h
685LIBBUILTIN(abort, "v",            "fr",    "stdlib.h", ALL_LANGUAGES)
686LIBBUILTIN(calloc, "v*zz",        "f",     "stdlib.h", ALL_LANGUAGES)
687LIBBUILTIN(exit, "vi",            "fr",    "stdlib.h", ALL_LANGUAGES)
688LIBBUILTIN(_Exit, "vi",           "fr",    "stdlib.h", ALL_LANGUAGES)
689LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h", ALL_LANGUAGES)
690LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h", ALL_LANGUAGES)
691// C99 string.h
692LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h", ALL_LANGUAGES)
693LIBBUILTIN(memcmp, "ivC*vC*z",    "f",     "string.h", ALL_LANGUAGES)
694LIBBUILTIN(memmove, "v*v*vC*z",   "f",     "string.h", ALL_LANGUAGES)
695LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
696LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
697LIBBUILTIN(strcmp, "icC*cC*",     "f",     "string.h", ALL_LANGUAGES)
698LIBBUILTIN(strncmp, "icC*cC*z",   "f",     "string.h", ALL_LANGUAGES)
699LIBBUILTIN(strcat, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
700LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
701LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     "string.h", ALL_LANGUAGES)
702LIBBUILTIN(memchr, "v*vC*iz",     "f",     "string.h", ALL_LANGUAGES)
703LIBBUILTIN(strchr, "c*cC*i",      "f",     "string.h", ALL_LANGUAGES)
704LIBBUILTIN(strcspn, "zcC*cC*",    "f",     "string.h", ALL_LANGUAGES)
705LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     "string.h", ALL_LANGUAGES)
706LIBBUILTIN(strrchr, "c*cC*i",     "f",     "string.h", ALL_LANGUAGES)
707LIBBUILTIN(strspn, "zcC*cC*",     "f",     "string.h", ALL_LANGUAGES)
708LIBBUILTIN(strstr, "c*cC*cC*",    "f",     "string.h", ALL_LANGUAGES)
709LIBBUILTIN(strtok, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
710LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h", ALL_LANGUAGES)
711LIBBUILTIN(strerror, "c*i",       "f",     "string.h", ALL_LANGUAGES)
712LIBBUILTIN(strlen, "zcC*",        "f",     "string.h", ALL_LANGUAGES)
713// C99 stdio.h
714LIBBUILTIN(printf, "icC*.",       "fp:0:", "stdio.h", ALL_LANGUAGES)
715LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
716LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h", ALL_LANGUAGES)
717LIBBUILTIN(sprintf, "ic*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
718LIBBUILTIN(vprintf, "icC*a",      "fP:0:", "stdio.h", ALL_LANGUAGES)
719LIBBUILTIN(vfprintf, "i.",        "fP:1:", "stdio.h", ALL_LANGUAGES)
720LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES)
721LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
722LIBBUILTIN(scanf, "icC*R.",       "fs:0:", "stdio.h", ALL_LANGUAGES)
723LIBBUILTIN(fscanf, "iP*RcC*R.",   "fs:1:", "stdio.h", ALL_LANGUAGES)
724LIBBUILTIN(sscanf, "icC*RcC*R.",  "fs:1:", "stdio.h", ALL_LANGUAGES)
725LIBBUILTIN(vscanf, "icC*Ra",      "fS:0:", "stdio.h", ALL_LANGUAGES)
726LIBBUILTIN(vfscanf, "iP*RcC*Ra",  "fS:1:", "stdio.h", ALL_LANGUAGES)
727LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
728// C99
729#undef setjmp
730LIBBUILTIN(setjmp, "iJ",          "fj",    "setjmp.h", ALL_LANGUAGES)
731LIBBUILTIN(longjmp, "vJi",        "fr",    "setjmp.h", ALL_LANGUAGES)
732
733// Non-C library functions, active in GNU mode only.
734LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h", ALL_GNU_LANGUAGES)
735// POSIX string.h
736LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     "string.h", ALL_GNU_LANGUAGES)
737LIBBUILTIN(stpncpy, "c*c*cC*z",   "f",     "string.h", ALL_GNU_LANGUAGES)
738LIBBUILTIN(strdup, "c*cC*",       "f",     "string.h", ALL_GNU_LANGUAGES)
739LIBBUILTIN(strndup, "c*cC*z",     "f",     "string.h", ALL_GNU_LANGUAGES)
740// POSIX strings.h
741LIBBUILTIN(index, "c*cC*i",       "f",     "strings.h", ALL_GNU_LANGUAGES)
742LIBBUILTIN(rindex, "c*cC*i",      "f",     "strings.h", ALL_GNU_LANGUAGES)
743LIBBUILTIN(bzero, "vv*z",         "f",     "strings.h", ALL_GNU_LANGUAGES)
744// In some systems str[n]casejmp is a macro that expands to _str[n]icmp.
745// We undefine then here to avoid wrong name.
746#undef strcasecmp
747#undef strncasecmp
748LIBBUILTIN(strcasecmp, "icC*cC*", "f",     "strings.h", ALL_GNU_LANGUAGES)
749LIBBUILTIN(strncasecmp, "icC*cC*z", "f",   "strings.h", ALL_GNU_LANGUAGES)
750// POSIX unistd.h
751LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h", ALL_GNU_LANGUAGES)
752LIBBUILTIN(vfork, "p",            "fj",    "unistd.h", ALL_GNU_LANGUAGES)
753// POSIX setjmp.h
754
755// In some systems setjmp is a macro that expands to _setjmp. We undefine
756// it here to avoid having two identical LIBBUILTIN entries.
757LIBBUILTIN(_setjmp, "iJ",         "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
758LIBBUILTIN(__sigsetjmp, "iSJi",   "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
759LIBBUILTIN(sigsetjmp, "iSJi",     "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
760LIBBUILTIN(setjmp_syscall, "iJ",  "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
761LIBBUILTIN(savectx, "iJ",         "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
762LIBBUILTIN(qsetjmp, "iJ",         "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
763LIBBUILTIN(getcontext, "iK*",     "fj",   "setjmp.h", ALL_GNU_LANGUAGES)
764
765LIBBUILTIN(_longjmp, "vJi",       "fr",    "setjmp.h", ALL_GNU_LANGUAGES)
766LIBBUILTIN(siglongjmp, "vSJi",    "fr",    "setjmp.h", ALL_GNU_LANGUAGES)
767// non-standard but very common
768LIBBUILTIN(strlcpy, "zc*cC*z",    "f",     "string.h", ALL_GNU_LANGUAGES)
769LIBBUILTIN(strlcat, "zc*cC*z",    "f",     "string.h", ALL_GNU_LANGUAGES)
770//   id objc_msgSend(id, SEL, ...)
771LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h", OBJC_LANG)
772// long double objc_msgSend_fpret(id self, SEL op, ...) 
773LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG)
774// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...)
775LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG)
776// void objc_msgSend_stret (id, SEL, ...)
777LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG)
778// id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
779LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG)
780// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
781LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG)
782//   id objc_getClass(const char *name)
783LIBBUILTIN(objc_getClass, "GcC*",   "f",     "objc/runtime.h", OBJC_LANG)
784//   id objc_getMetaClass(const char *name)
785LIBBUILTIN(objc_getMetaClass, "GcC*",   "f", "objc/runtime.h", OBJC_LANG)
786// void objc_enumerationMutation(id)
787LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG)
788
789// id objc_read_weak(id *location)
790LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG)
791// id objc_assign_weak(id value, id *location)
792LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
793// id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
794LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG)
795// id objc_assign_global(id val, id *dest)
796LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
797// id objc_assign_strongCast(id val, id *dest
798LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
799
800// id objc_exception_extract(void *localExceptionData)
801LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG)
802// void objc_exception_try_enter(void *localExceptionData)
803LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
804// void objc_exception_try_exit(void *localExceptionData)
805LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
806// int objc_exception_match(Class exceptionClass, id exception)
807LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG)
808// void objc_exception_throw(id exception)
809LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG)
810
811// int objc_sync_enter(id obj)
812LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
813// int objc_sync_exit(id obj)
814LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
815
816BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
817
818// void NSLog(NSString *fmt, ...)
819LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
820// void NSLogv(NSString *fmt, va_list args)
821LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
822
823// Builtin math library functions
824LIBBUILTIN(atan2, "ddd", "fne", "math.h", ALL_LANGUAGES)
825LIBBUILTIN(atan2f, "fff", "fne", "math.h", ALL_LANGUAGES)
826LIBBUILTIN(atan2l, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
827
828LIBBUILTIN(abs, "ii", "fnc", "stdlib.h", ALL_LANGUAGES)
829LIBBUILTIN(labs, "LiLi", "fnc", "stdlib.h", ALL_LANGUAGES)
830LIBBUILTIN(llabs, "LLiLLi", "fnc", "stdlib.h", ALL_LANGUAGES)
831
832LIBBUILTIN(copysign, "ddd", "fnc", "math.h", ALL_LANGUAGES)
833LIBBUILTIN(copysignf, "fff", "fnc", "math.h", ALL_LANGUAGES)
834LIBBUILTIN(copysignl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
835
836LIBBUILTIN(fabs, "dd", "fnc", "math.h", ALL_LANGUAGES)
837LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES)
838LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
839
840LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES)
841LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES)
842LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
843
844LIBBUILTIN(frexp, "ddi*", "fn", "math.h", ALL_LANGUAGES)
845LIBBUILTIN(frexpf, "ffi*", "fn", "math.h", ALL_LANGUAGES)
846LIBBUILTIN(frexpl, "LdLdi*", "fn", "math.h", ALL_LANGUAGES)
847
848LIBBUILTIN(ldexp, "ddi", "fne", "math.h", ALL_LANGUAGES)
849LIBBUILTIN(ldexpf, "ffi", "fne", "math.h", ALL_LANGUAGES)
850LIBBUILTIN(ldexpl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
851
852LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES)
853LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES)
854LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES)
855
856LIBBUILTIN(nan,  "dcC*", "fnc", "math.h", ALL_LANGUAGES)
857LIBBUILTIN(nanf, "fcC*", "fnc", "math.h", ALL_LANGUAGES)
858LIBBUILTIN(nanl, "LdcC*", "fnc", "math.h", ALL_LANGUAGES)
859
860LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES)
861LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES)
862LIBBUILTIN(powl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
863
864LIBBUILTIN(acos, "dd", "fne", "math.h", ALL_LANGUAGES)
865LIBBUILTIN(acosf, "ff", "fne", "math.h", ALL_LANGUAGES)
866LIBBUILTIN(acosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
867
868LIBBUILTIN(acosh, "dd", "fne", "math.h", ALL_LANGUAGES)
869LIBBUILTIN(acoshf, "ff", "fne", "math.h", ALL_LANGUAGES)
870LIBBUILTIN(acoshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
871
872LIBBUILTIN(asin, "dd", "fne", "math.h", ALL_LANGUAGES)
873LIBBUILTIN(asinf, "ff", "fne", "math.h", ALL_LANGUAGES)
874LIBBUILTIN(asinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
875
876LIBBUILTIN(asinh, "dd", "fne", "math.h", ALL_LANGUAGES)
877LIBBUILTIN(asinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
878LIBBUILTIN(asinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
879
880LIBBUILTIN(atan, "dd", "fne", "math.h", ALL_LANGUAGES)
881LIBBUILTIN(atanf, "ff", "fne", "math.h", ALL_LANGUAGES)
882LIBBUILTIN(atanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
883
884LIBBUILTIN(atanh, "dd", "fne", "math.h", ALL_LANGUAGES)
885LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
886LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
887
888LIBBUILTIN(cbrt, "dd", "fne", "math.h", ALL_LANGUAGES)
889LIBBUILTIN(cbrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
890LIBBUILTIN(cbrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
891
892LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES)
893LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES)
894LIBBUILTIN(ceill, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
895
896LIBBUILTIN(cos, "dd", "fne", "math.h", ALL_LANGUAGES)
897LIBBUILTIN(cosf, "ff", "fne", "math.h", ALL_LANGUAGES)
898LIBBUILTIN(cosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
899
900LIBBUILTIN(cosh, "dd", "fne", "math.h", ALL_LANGUAGES)
901LIBBUILTIN(coshf, "ff", "fne", "math.h", ALL_LANGUAGES)
902LIBBUILTIN(coshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
903
904LIBBUILTIN(erf, "dd", "fne", "math.h", ALL_LANGUAGES)
905LIBBUILTIN(erff, "ff", "fne", "math.h", ALL_LANGUAGES)
906LIBBUILTIN(erfl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
907
908LIBBUILTIN(erfc, "dd", "fne", "math.h", ALL_LANGUAGES)
909LIBBUILTIN(erfcf, "ff", "fne", "math.h", ALL_LANGUAGES)
910LIBBUILTIN(erfcl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
911
912LIBBUILTIN(exp, "dd", "fne", "math.h", ALL_LANGUAGES)
913LIBBUILTIN(expf, "ff", "fne", "math.h", ALL_LANGUAGES)
914LIBBUILTIN(expl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
915
916LIBBUILTIN(exp2, "dd", "fne", "math.h", ALL_LANGUAGES)
917LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES)
918LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
919
920LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES)
921LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES)
922LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
923
924LIBBUILTIN(fdim, "ddd", "fne", "math.h", ALL_LANGUAGES)
925LIBBUILTIN(fdimf, "fff", "fne", "math.h", ALL_LANGUAGES)
926LIBBUILTIN(fdiml, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
927
928LIBBUILTIN(floor, "dd", "fnc", "math.h", ALL_LANGUAGES)
929LIBBUILTIN(floorf, "ff", "fnc", "math.h", ALL_LANGUAGES)
930LIBBUILTIN(floorl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
931
932LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES)
933LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES)
934LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES)
935
936LIBBUILTIN(fmax, "ddd", "fnc", "math.h", ALL_LANGUAGES)
937LIBBUILTIN(fmaxf, "fff", "fnc", "math.h", ALL_LANGUAGES)
938LIBBUILTIN(fmaxl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
939
940LIBBUILTIN(fmin, "ddd", "fnc", "math.h", ALL_LANGUAGES)
941LIBBUILTIN(fminf, "fff", "fnc", "math.h", ALL_LANGUAGES)
942LIBBUILTIN(fminl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
943
944LIBBUILTIN(hypot, "ddd", "fne", "math.h", ALL_LANGUAGES)
945LIBBUILTIN(hypotf, "fff", "fne", "math.h", ALL_LANGUAGES)
946LIBBUILTIN(hypotl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
947
948LIBBUILTIN(ilogb, "id", "fne", "math.h", ALL_LANGUAGES)
949LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES)
950LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES)
951
952LIBBUILTIN(lgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
953LIBBUILTIN(lgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
954LIBBUILTIN(lgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
955
956LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES)
957LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES)
958LIBBUILTIN(llrintl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
959
960LIBBUILTIN(llround, "LLid", "fne", "math.h", ALL_LANGUAGES)
961LIBBUILTIN(llroundf, "LLif", "fne", "math.h", ALL_LANGUAGES)
962LIBBUILTIN(llroundl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
963
964LIBBUILTIN(log, "dd", "fne", "math.h", ALL_LANGUAGES)
965LIBBUILTIN(logf, "ff", "fne", "math.h", ALL_LANGUAGES)
966LIBBUILTIN(logl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
967
968LIBBUILTIN(log10, "dd", "fne", "math.h", ALL_LANGUAGES)
969LIBBUILTIN(log10f, "ff", "fne", "math.h", ALL_LANGUAGES)
970LIBBUILTIN(log10l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
971
972LIBBUILTIN(log1p, "dd", "fne", "math.h", ALL_LANGUAGES)
973LIBBUILTIN(log1pf, "ff", "fne", "math.h", ALL_LANGUAGES)
974LIBBUILTIN(log1pl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
975
976LIBBUILTIN(log2, "dd", "fne", "math.h", ALL_LANGUAGES)
977LIBBUILTIN(log2f, "ff", "fne", "math.h", ALL_LANGUAGES)
978LIBBUILTIN(log2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
979
980LIBBUILTIN(logb, "dd", "fne", "math.h", ALL_LANGUAGES)
981LIBBUILTIN(logbf, "ff", "fne", "math.h", ALL_LANGUAGES)
982LIBBUILTIN(logbl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
983
984LIBBUILTIN(lrint, "Lid", "fne", "math.h", ALL_LANGUAGES)
985LIBBUILTIN(lrintf, "Lif", "fne", "math.h", ALL_LANGUAGES)
986LIBBUILTIN(lrintl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
987
988LIBBUILTIN(lround, "Lid", "fne", "math.h", ALL_LANGUAGES)
989LIBBUILTIN(lroundf, "Lif", "fne", "math.h", ALL_LANGUAGES)
990LIBBUILTIN(lroundl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
991
992LIBBUILTIN(nearbyint, "dd", "fnc", "math.h", ALL_LANGUAGES)
993LIBBUILTIN(nearbyintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
994LIBBUILTIN(nearbyintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
995
996LIBBUILTIN(nextafter, "ddd", "fne", "math.h", ALL_LANGUAGES)
997LIBBUILTIN(nextafterf, "fff", "fne", "math.h", ALL_LANGUAGES)
998LIBBUILTIN(nextafterl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
999
1000LIBBUILTIN(nexttoward, "ddLd", "fne", "math.h", ALL_LANGUAGES)
1001LIBBUILTIN(nexttowardf, "ffLd", "fne", "math.h", ALL_LANGUAGES)
1002LIBBUILTIN(nexttowardl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1003
1004LIBBUILTIN(remainder, "ddd", "fne", "math.h", ALL_LANGUAGES)
1005LIBBUILTIN(remainderf, "fff", "fne", "math.h", ALL_LANGUAGES)
1006LIBBUILTIN(remainderl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1007
1008LIBBUILTIN(rint, "dd", "fnc", "math.h", ALL_LANGUAGES)
1009LIBBUILTIN(rintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1010LIBBUILTIN(rintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1011
1012LIBBUILTIN(round, "dd", "fnc", "math.h", ALL_LANGUAGES)
1013LIBBUILTIN(roundf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1014LIBBUILTIN(roundl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1015
1016LIBBUILTIN(scalbln, "ddLi", "fne", "math.h", ALL_LANGUAGES)
1017LIBBUILTIN(scalblnf, "ffLi", "fne", "math.h", ALL_LANGUAGES)
1018LIBBUILTIN(scalblnl, "LdLdLi", "fne", "math.h", ALL_LANGUAGES)
1019
1020LIBBUILTIN(scalbn, "ddi", "fne", "math.h", ALL_LANGUAGES)
1021LIBBUILTIN(scalbnf, "ffi", "fne", "math.h", ALL_LANGUAGES)
1022LIBBUILTIN(scalbnl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
1023
1024LIBBUILTIN(sin, "dd", "fne", "math.h", ALL_LANGUAGES)
1025LIBBUILTIN(sinf, "ff", "fne", "math.h", ALL_LANGUAGES)
1026LIBBUILTIN(sinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1027
1028LIBBUILTIN(sinh, "dd", "fne", "math.h", ALL_LANGUAGES)
1029LIBBUILTIN(sinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1030LIBBUILTIN(sinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1031
1032LIBBUILTIN(sqrt, "dd", "fne", "math.h", ALL_LANGUAGES)
1033LIBBUILTIN(sqrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
1034LIBBUILTIN(sqrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1035
1036LIBBUILTIN(tan, "dd", "fne", "math.h", ALL_LANGUAGES)
1037LIBBUILTIN(tanf, "ff", "fne", "math.h", ALL_LANGUAGES)
1038LIBBUILTIN(tanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1039
1040LIBBUILTIN(tanh, "dd", "fne", "math.h", ALL_LANGUAGES)
1041LIBBUILTIN(tanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1042LIBBUILTIN(tanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1043
1044LIBBUILTIN(tgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
1045LIBBUILTIN(tgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
1046LIBBUILTIN(tgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1047
1048LIBBUILTIN(trunc, "dd", "fnc", "math.h", ALL_LANGUAGES)
1049LIBBUILTIN(truncf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1050LIBBUILTIN(truncl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1051
1052LIBBUILTIN(cabs, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1053LIBBUILTIN(cabsf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1054LIBBUILTIN(cabsl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1055
1056LIBBUILTIN(cacos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1057LIBBUILTIN(cacosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1058LIBBUILTIN(cacosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1059
1060LIBBUILTIN(cacosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1061LIBBUILTIN(cacoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1062LIBBUILTIN(cacoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1063
1064LIBBUILTIN(carg, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1065LIBBUILTIN(cargf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1066LIBBUILTIN(cargl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1067
1068LIBBUILTIN(casin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1069LIBBUILTIN(casinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1070LIBBUILTIN(casinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1071
1072LIBBUILTIN(casinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1073LIBBUILTIN(casinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1074LIBBUILTIN(casinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1075
1076LIBBUILTIN(catan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1077LIBBUILTIN(catanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1078LIBBUILTIN(catanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1079
1080LIBBUILTIN(catanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1081LIBBUILTIN(catanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1082LIBBUILTIN(catanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1083
1084LIBBUILTIN(ccos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1085LIBBUILTIN(ccosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1086LIBBUILTIN(ccosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1087
1088LIBBUILTIN(ccosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1089LIBBUILTIN(ccoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1090LIBBUILTIN(ccoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1091
1092LIBBUILTIN(cexp, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1093LIBBUILTIN(cexpf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1094LIBBUILTIN(cexpl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1095
1096LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1097LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1098LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1099
1100LIBBUILTIN(conj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1101LIBBUILTIN(conjf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1102LIBBUILTIN(conjl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1103
1104LIBBUILTIN(clog, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1105LIBBUILTIN(clogf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1106LIBBUILTIN(clogl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1107
1108LIBBUILTIN(cproj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1109LIBBUILTIN(cprojf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1110LIBBUILTIN(cprojl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1111
1112LIBBUILTIN(cpow, "XdXdXd", "fnc", "complex.h", ALL_LANGUAGES)
1113LIBBUILTIN(cpowf, "XfXfXf", "fnc", "complex.h", ALL_LANGUAGES)
1114LIBBUILTIN(cpowl, "XLdXLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1115
1116LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1117LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1118LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1119
1120LIBBUILTIN(csin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1121LIBBUILTIN(csinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1122LIBBUILTIN(csinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1123
1124LIBBUILTIN(csinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1125LIBBUILTIN(csinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1126LIBBUILTIN(csinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1127
1128LIBBUILTIN(csqrt, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1129LIBBUILTIN(csqrtf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1130LIBBUILTIN(csqrtl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1131
1132LIBBUILTIN(ctan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1133LIBBUILTIN(ctanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1134LIBBUILTIN(ctanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1135
1136LIBBUILTIN(ctanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1137LIBBUILTIN(ctanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1138LIBBUILTIN(ctanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1139
1140// Blocks runtime Builtin math library functions
1141LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
1142LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
1143// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
1144
1145// Annotation function
1146BUILTIN(__builtin_annotation, "v.", "tn")
1147
1148// Multiprecision Arithmetic Builtins.
1149BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n")
1150BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n")
1151BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n")
1152BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n")
1153BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n")
1154BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n")
1155BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n")
1156BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n")
1157BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n")
1158BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n")
1159
1160// Checked Arithmetic Builtins for Security.
1161BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "n")
1162BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "n")
1163BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "n")
1164BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "n")
1165BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "n")
1166BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "n")
1167BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "n")
1168BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "n")
1169BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "n")
1170BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "n")
1171BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "n")
1172BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "n")
1173BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "n")
1174BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "n")
1175BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "n")
1176BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "n")
1177BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "n")
1178BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "n")
1179
1180// Clang builtins (not available in GCC).
1181BUILTIN(__builtin_addressof, "v*v&", "nct")
1182
1183#undef BUILTIN
1184#undef LIBBUILTIN
1185#undef LANGBUILTIN
1186