Index: clang/include/clang/AST/Expr.h =================================================================== --- clang/include/clang/AST/Expr.h +++ clang/include/clang/AST/Expr.h @@ -6036,7 +6036,7 @@ enum AtomicOp { #define BUILTIN(ID, TYPE, ATTRS) #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID, -#include "clang/Basic/Builtins.def" +#include "clang/Basic/Builtins.inc" // Avoid trailing comma BI_First = 0 }; Index: clang/include/clang/Basic/BuiltinTableGenDefs.inc =================================================================== --- /dev/null +++ clang/include/clang/Basic/BuiltinTableGenDefs.inc @@ -0,0 +1,53 @@ +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef BUILTIN_TABLEGEN_DEFS +#define BUILTIN_TABLEGEN_DEFS + +// These must be kept in sync with LanguageID in Builtins.h. +class Language { + string Name = name; +} + +def GnuLang : Language<"GNU_LANG">; +def CLang : Language<"C_LANG">; +def CxxLang : Language<"CXX_LANG">; +def ObjcLang : Language<"OBJC_LANG">; +def MsLang : Language<"MS_LANG">; +def OCLC20Lang : Language<"OCLC20_LANG">; +def OCLC1xLang : Language<"OCLC1X_LANG">; +def OMPLang : Language<"OMP_LANG">; +def AllLanguages : Language<"ALL_LANGUAGES">; +def AllGnuLanguages : Language<"ALL_GNU_LANGUAGES">; +def AllMSLanguages : Language<"ALL_MS_LANGUAGES">; +def AllOCLCLanguages : Language<"ALL_OCLC_LANGUAGES">; + +class BuiltinBase { + string Type = type; + string Attributes = attributes; + string Header = headerName; + Language Lang = langs; + string Features = features; + // Some of our atomics builtins are handled by AtomicExpr rather than as + // normal builtin CallExprs. This bit is used for such builtins. + bit Atomic = 0; +} + +class Builtin : + BuiltinBase { +} + +class LibraryBuiltin : + BuiltinBase { +} + +class LangBuiltin : + BuiltinBase { +} + +#endif // BUILTIN_TABLEGEN_DEFS Index: clang/include/clang/Basic/Builtins.h =================================================================== --- clang/include/clang/Basic/Builtins.h +++ clang/include/clang/Basic/Builtins.h @@ -44,9 +44,9 @@ namespace Builtin { enum ID { - NotBuiltin = 0, // This is not a builtin function. + NotBuiltin = 0, // This is not a builtin function. #define BUILTIN(ID, TYPE, ATTRS) BI##ID, -#include "clang/Basic/Builtins.def" +#include "clang/Basic/Builtins.inc" FirstTSBuiltin }; Index: clang/include/clang/Basic/Builtins.def =================================================================== --- clang/include/clang/Basic/Builtins.def +++ /dev/null @@ -1,1586 +0,0 @@ -//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the standard builtin function database. Users of this file -// must define the BUILTIN macro to make use of this information. -// -//===----------------------------------------------------------------------===// - -// FIXME: This should really be a .td file, but that requires modifying tblgen. -// Perhaps tblgen should have plugins. - -// The first value provided to the macro specifies the function name of the -// builtin, and results in a clang::builtin::BIXX enum value for XX. - -// The second value provided to the macro specifies the type of the function -// (result value, then each argument) as follows: -// v -> void -// b -> boolean -// c -> char -// s -> short -// i -> int -// h -> half -// f -> float -// d -> double -// z -> size_t -// w -> wchar_t -// F -> constant CFString -// G -> id -// H -> SEL -// M -> struct objc_super -// a -> __builtin_va_list -// A -> "reference" to __builtin_va_list -// V -> Vector, followed by the number of elements and the base type. -// q -> Scalable vector, followed by the number of elements and the base type. -// E -> ext_vector, followed by the number of elements and the base type. -// X -> _Complex, followed by the base type. -// Y -> ptrdiff_t -// P -> FILE -// J -> jmp_buf -// SJ -> sigjmp_buf -// K -> ucontext_t -// p -> pid_t -// . -> "...". This may only occur at the end of the function list. -// -// Types may be prefixed with the following modifiers: -// L -> long (e.g. Li for 'long int', Ld for 'long double') -// LL -> long long (e.g. LLi for 'long long int', LLd for __float128) -// LLL -> __int128_t (e.g. LLLi) -// Z -> int32_t (require a native 32-bit integer type on the target) -// W -> int64_t (require a native 64-bit integer type on the target) -// N -> 'int' size if target is LP64, 'L' otherwise. -// O -> long for OpenCL targets, long long otherwise. -// S -> signed -// U -> unsigned -// I -> Required to constant fold to an integer constant expression. -// -// Types may be postfixed with the following modifiers: -// * -> pointer (optionally followed by an address space number, if no address -// space is specified than any address space will be accepted) -// & -> reference (optionally followed by an address space number) -// C -> const -// D -> volatile - -// The third value provided to the macro specifies information about attributes -// of the function. These must be kept in sync with the predicates in the -// Builtin::Context class. Currently we have: -// n -> nothrow -// r -> noreturn -// U -> pure -// c -> const -// t -> signature is meaningless, use custom typechecking -// F -> this is a libc/libm function with a '__builtin_' prefix added. -// f -> this is a libc/libm function without the '__builtin_' prefix. It can -// be followed by ':headername:' to state which header this function -// comes from. -// h -> this function requires a specific header or an explicit declaration. -// i -> this is a runtime library implemented function without the -// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc. -// p:N: -> this is a printf-like function whose Nth argument is the format -// string. -// P:N: -> similar to the p:N: attribute, but the function is like vprintf -// in that it accepts its arguments as a va_list rather than -// through an ellipsis -// s:N: -> this is a scanf-like function whose Nth argument is the format -// string. -// S:N: -> similar to the s:N: attribute, but the function is like vscanf -// in that it accepts its arguments as a va_list rather than -// through an ellipsis -// e -> const, but only when -fno-math-errno -// j -> returns_twice (like setjmp) -// u -> arguments are not evaluated for their side-effects -// V:N: -> requires vectors of at least N bits to be legal -// C -> callback behavior: argument N is called with argument -// M_0, ..., M_k as payload -// FIXME: gcc has nonnull - -#if defined(BUILTIN) && !defined(LIBBUILTIN) -# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) -#endif - -#if defined(BUILTIN) && !defined(LANGBUILTIN) -# define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) -#endif - -// Standard libc/libm functions: -BUILTIN(__builtin_atan2 , "ddd" , "Fne") -BUILTIN(__builtin_atan2f, "fff" , "Fne") -BUILTIN(__builtin_atan2l, "LdLdLd", "Fne") -BUILTIN(__builtin_abs , "ii" , "ncF") -BUILTIN(__builtin_copysign, "ddd", "ncF") -BUILTIN(__builtin_copysignf, "fff", "ncF") -BUILTIN(__builtin_copysignf16, "hhh", "ncF") -BUILTIN(__builtin_copysignl, "LdLdLd", "ncF") -BUILTIN(__builtin_copysignf128, "LLdLLdLLd", "ncF") -BUILTIN(__builtin_fabs , "dd" , "ncF") -BUILTIN(__builtin_fabsf, "ff" , "ncF") -BUILTIN(__builtin_fabsl, "LdLd", "ncF") -BUILTIN(__builtin_fabsf16, "hh" , "ncF") -BUILTIN(__builtin_fabsf128, "LLdLLd", "ncF") -BUILTIN(__builtin_fmod , "ddd" , "Fne") -BUILTIN(__builtin_fmodf, "fff" , "Fne") -BUILTIN(__builtin_fmodf16, "hhh" , "Fne") -BUILTIN(__builtin_fmodl, "LdLdLd", "Fne") -BUILTIN(__builtin_frexp , "ddi*" , "Fn") -BUILTIN(__builtin_frexpf, "ffi*" , "Fn") -BUILTIN(__builtin_frexpl, "LdLdi*", "Fn") -BUILTIN(__builtin_huge_val, "d", "nc") -BUILTIN(__builtin_huge_valf, "f", "nc") -BUILTIN(__builtin_huge_vall, "Ld", "nc") -BUILTIN(__builtin_huge_valf128, "LLd", "nc") -BUILTIN(__builtin_inf , "d" , "nc") -BUILTIN(__builtin_inff , "f" , "nc") -BUILTIN(__builtin_infl , "Ld" , "nc") -BUILTIN(__builtin_inff128 , "LLd" , "nc") -BUILTIN(__builtin_labs , "LiLi" , "Fnc") -BUILTIN(__builtin_llabs, "LLiLLi", "Fnc") -BUILTIN(__builtin_ldexp , "ddi" , "Fne") -BUILTIN(__builtin_ldexpf, "ffi" , "Fne") -BUILTIN(__builtin_ldexpl, "LdLdi", "Fne") -BUILTIN(__builtin_modf , "ddd*" , "Fn") -BUILTIN(__builtin_modff, "fff*" , "Fn") -BUILTIN(__builtin_modfl, "LdLdLd*", "Fn") -BUILTIN(__builtin_nan, "dcC*" , "FnU") -BUILTIN(__builtin_nanf, "fcC*" , "FnU") -BUILTIN(__builtin_nanl, "LdcC*", "FnU") -BUILTIN(__builtin_nanf128, "LLdcC*", "FnU") -BUILTIN(__builtin_nans, "dcC*" , "FnU") -BUILTIN(__builtin_nansf, "fcC*" , "FnU") -BUILTIN(__builtin_nansl, "LdcC*", "FnU") -BUILTIN(__builtin_nansf128, "LLdcC*", "FnU") -BUILTIN(__builtin_powi , "ddi" , "Fnc") -BUILTIN(__builtin_powif, "ffi" , "Fnc") -BUILTIN(__builtin_powil, "LdLdi", "Fnc") -BUILTIN(__builtin_pow , "ddd" , "Fne") -BUILTIN(__builtin_powf, "fff" , "Fne") -BUILTIN(__builtin_powf16, "hhh" , "Fne") -BUILTIN(__builtin_powl, "LdLdLd", "Fne") - -// Standard unary libc/libm functions with double/float/long double variants: -BUILTIN(__builtin_acos , "dd" , "Fne") -BUILTIN(__builtin_acosf, "ff" , "Fne") -BUILTIN(__builtin_acosl, "LdLd", "Fne") -BUILTIN(__builtin_acosh , "dd" , "Fne") -BUILTIN(__builtin_acoshf, "ff" , "Fne") -BUILTIN(__builtin_acoshl, "LdLd", "Fne") -BUILTIN(__builtin_asin , "dd" , "Fne") -BUILTIN(__builtin_asinf, "ff" , "Fne") -BUILTIN(__builtin_asinl, "LdLd", "Fne") -BUILTIN(__builtin_asinh , "dd" , "Fne") -BUILTIN(__builtin_asinhf, "ff" , "Fne") -BUILTIN(__builtin_asinhl, "LdLd", "Fne") -BUILTIN(__builtin_atan , "dd" , "Fne") -BUILTIN(__builtin_atanf, "ff" , "Fne") -BUILTIN(__builtin_atanl, "LdLd", "Fne") -BUILTIN(__builtin_atanh , "dd", "Fne") -BUILTIN(__builtin_atanhf, "ff", "Fne") -BUILTIN(__builtin_atanhl, "LdLd", "Fne") -BUILTIN(__builtin_cbrt , "dd", "Fnc") -BUILTIN(__builtin_cbrtf, "ff", "Fnc") -BUILTIN(__builtin_cbrtl, "LdLd", "Fnc") -BUILTIN(__builtin_ceil , "dd" , "Fnc") -BUILTIN(__builtin_ceilf, "ff" , "Fnc") -BUILTIN(__builtin_ceilf16, "hh" , "Fnc") -BUILTIN(__builtin_ceill, "LdLd", "Fnc") -BUILTIN(__builtin_cos , "dd" , "Fne") -BUILTIN(__builtin_cosf, "ff" , "Fne") -BUILTIN(__builtin_cosf16, "hh" , "Fne") -BUILTIN(__builtin_cosh , "dd" , "Fne") -BUILTIN(__builtin_coshf, "ff" , "Fne") -BUILTIN(__builtin_coshl, "LdLd", "Fne") -BUILTIN(__builtin_cosl, "LdLd", "Fne") -BUILTIN(__builtin_erf , "dd", "Fne") -BUILTIN(__builtin_erff, "ff", "Fne") -BUILTIN(__builtin_erfl, "LdLd", "Fne") -BUILTIN(__builtin_erfc , "dd", "Fne") -BUILTIN(__builtin_erfcf, "ff", "Fne") -BUILTIN(__builtin_erfcl, "LdLd", "Fne") -BUILTIN(__builtin_exp , "dd" , "Fne") -BUILTIN(__builtin_expf, "ff" , "Fne") -BUILTIN(__builtin_expf16, "hh" , "Fne") -BUILTIN(__builtin_expl, "LdLd", "Fne") -BUILTIN(__builtin_exp2 , "dd" , "Fne") -BUILTIN(__builtin_exp2f, "ff" , "Fne") -BUILTIN(__builtin_exp2f16, "hh" , "Fne") -BUILTIN(__builtin_exp2l, "LdLd", "Fne") -BUILTIN(__builtin_expm1 , "dd", "Fne") -BUILTIN(__builtin_expm1f, "ff", "Fne") -BUILTIN(__builtin_expm1l, "LdLd", "Fne") -BUILTIN(__builtin_fdim, "ddd", "Fne") -BUILTIN(__builtin_fdimf, "fff", "Fne") -BUILTIN(__builtin_fdiml, "LdLdLd", "Fne") -BUILTIN(__builtin_floor , "dd" , "Fnc") -BUILTIN(__builtin_floorf, "ff" , "Fnc") -BUILTIN(__builtin_floorf16, "hh" , "Fnc") -BUILTIN(__builtin_floorl, "LdLd", "Fnc") -BUILTIN(__builtin_fma, "dddd", "Fne") -BUILTIN(__builtin_fmaf, "ffff", "Fne") -BUILTIN(__builtin_fmaf16, "hhhh", "Fne") -BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne") -BUILTIN(__builtin_fmax, "ddd", "Fnc") -BUILTIN(__builtin_fmaxf, "fff", "Fnc") -BUILTIN(__builtin_fmaxf16, "hhh", "Fnc") -BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc") -BUILTIN(__builtin_fmin, "ddd", "Fnc") -BUILTIN(__builtin_fminf, "fff", "Fnc") -BUILTIN(__builtin_fminf16, "hhh", "Fnc") -BUILTIN(__builtin_fminl, "LdLdLd", "Fnc") -BUILTIN(__builtin_hypot , "ddd" , "Fne") -BUILTIN(__builtin_hypotf, "fff" , "Fne") -BUILTIN(__builtin_hypotl, "LdLdLd", "Fne") -BUILTIN(__builtin_ilogb , "id", "Fne") -BUILTIN(__builtin_ilogbf, "if", "Fne") -BUILTIN(__builtin_ilogbl, "iLd", "Fne") -BUILTIN(__builtin_lgamma , "dd", "Fn") -BUILTIN(__builtin_lgammaf, "ff", "Fn") -BUILTIN(__builtin_lgammal, "LdLd", "Fn") -BUILTIN(__builtin_llrint, "LLid", "Fne") -BUILTIN(__builtin_llrintf, "LLif", "Fne") -BUILTIN(__builtin_llrintl, "LLiLd", "Fne") -BUILTIN(__builtin_llround , "LLid", "Fne") -BUILTIN(__builtin_llroundf, "LLif", "Fne") -BUILTIN(__builtin_llroundl, "LLiLd", "Fne") -BUILTIN(__builtin_log , "dd" , "Fne") -BUILTIN(__builtin_log10 , "dd" , "Fne") -BUILTIN(__builtin_log10f, "ff" , "Fne") -BUILTIN(__builtin_log10f16, "hh" , "Fne") -BUILTIN(__builtin_log10l, "LdLd", "Fne") -BUILTIN(__builtin_log1p , "dd" , "Fne") -BUILTIN(__builtin_log1pf, "ff" , "Fne") -BUILTIN(__builtin_log1pl, "LdLd", "Fne") -BUILTIN(__builtin_log2, "dd" , "Fne") -BUILTIN(__builtin_log2f, "ff" , "Fne") -BUILTIN(__builtin_log2f16, "hh" , "Fne") -BUILTIN(__builtin_log2l, "LdLd" , "Fne") -BUILTIN(__builtin_logb , "dd", "Fne") -BUILTIN(__builtin_logbf, "ff", "Fne") -BUILTIN(__builtin_logbl, "LdLd", "Fne") -BUILTIN(__builtin_logf, "ff" , "Fne") -BUILTIN(__builtin_logf16, "hh" , "Fne") -BUILTIN(__builtin_logl, "LdLd", "Fne") -BUILTIN(__builtin_lrint , "Lid", "Fne") -BUILTIN(__builtin_lrintf, "Lif", "Fne") -BUILTIN(__builtin_lrintl, "LiLd", "Fne") -BUILTIN(__builtin_lround , "Lid", "Fne") -BUILTIN(__builtin_lroundf, "Lif", "Fne") -BUILTIN(__builtin_lroundl, "LiLd", "Fne") -BUILTIN(__builtin_nearbyint , "dd", "Fnc") -BUILTIN(__builtin_nearbyintf, "ff", "Fnc") -BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc") -BUILTIN(__builtin_nextafter , "ddd", "Fne") -BUILTIN(__builtin_nextafterf, "fff", "Fne") -BUILTIN(__builtin_nextafterl, "LdLdLd", "Fne") -BUILTIN(__builtin_nexttoward , "ddLd", "Fne") -BUILTIN(__builtin_nexttowardf, "ffLd", "Fne") -BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fne") -BUILTIN(__builtin_remainder , "ddd", "Fne") -BUILTIN(__builtin_remainderf, "fff", "Fne") -BUILTIN(__builtin_remainderl, "LdLdLd", "Fne") -BUILTIN(__builtin_remquo , "dddi*", "Fn") -BUILTIN(__builtin_remquof, "fffi*", "Fn") -BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn") -BUILTIN(__builtin_rint , "dd", "Fnc") -BUILTIN(__builtin_rintf, "ff", "Fnc") -BUILTIN(__builtin_rintf16, "hh", "Fnc") -BUILTIN(__builtin_rintl, "LdLd", "Fnc") -BUILTIN(__builtin_round, "dd" , "Fnc") -BUILTIN(__builtin_roundf, "ff" , "Fnc") -BUILTIN(__builtin_roundf16, "hh" , "Fnc") -BUILTIN(__builtin_roundl, "LdLd" , "Fnc") -BUILTIN(__builtin_scalbln , "ddLi", "Fne") -BUILTIN(__builtin_scalblnf, "ffLi", "Fne") -BUILTIN(__builtin_scalblnl, "LdLdLi", "Fne") -BUILTIN(__builtin_scalbn , "ddi", "Fne") -BUILTIN(__builtin_scalbnf, "ffi", "Fne") -BUILTIN(__builtin_scalbnl, "LdLdi", "Fne") -BUILTIN(__builtin_sin , "dd" , "Fne") -BUILTIN(__builtin_sinf, "ff" , "Fne") -BUILTIN(__builtin_sinf16, "hh" , "Fne") -BUILTIN(__builtin_sinh , "dd" , "Fne") -BUILTIN(__builtin_sinhf, "ff" , "Fne") -BUILTIN(__builtin_sinhl, "LdLd", "Fne") -BUILTIN(__builtin_sinl, "LdLd", "Fne") -BUILTIN(__builtin_sqrt , "dd" , "Fne") -BUILTIN(__builtin_sqrtf, "ff" , "Fne") -BUILTIN(__builtin_sqrtf16, "hh" , "Fne") -BUILTIN(__builtin_sqrtl, "LdLd", "Fne") -BUILTIN(__builtin_tan , "dd" , "Fne") -BUILTIN(__builtin_tanf, "ff" , "Fne") -BUILTIN(__builtin_tanh , "dd" , "Fne") -BUILTIN(__builtin_tanhf, "ff" , "Fne") -BUILTIN(__builtin_tanhl, "LdLd", "Fne") -BUILTIN(__builtin_tanl, "LdLd", "Fne") -BUILTIN(__builtin_tgamma , "dd", "Fne") -BUILTIN(__builtin_tgammaf, "ff", "Fne") -BUILTIN(__builtin_tgammal, "LdLd", "Fne") -BUILTIN(__builtin_trunc , "dd", "Fnc") -BUILTIN(__builtin_truncf, "ff", "Fnc") -BUILTIN(__builtin_truncl, "LdLd", "Fnc") -BUILTIN(__builtin_truncf16, "hh", "Fnc") - -// Access to floating point environment -BUILTIN(__builtin_flt_rounds, "i", "n") - -// C99 complex builtins -BUILTIN(__builtin_cabs, "dXd", "Fne") -BUILTIN(__builtin_cabsf, "fXf", "Fne") -BUILTIN(__builtin_cabsl, "LdXLd", "Fne") -BUILTIN(__builtin_cacos, "XdXd", "Fne") -BUILTIN(__builtin_cacosf, "XfXf", "Fne") -BUILTIN(__builtin_cacosh, "XdXd", "Fne") -BUILTIN(__builtin_cacoshf, "XfXf", "Fne") -BUILTIN(__builtin_cacoshl, "XLdXLd", "Fne") -BUILTIN(__builtin_cacosl, "XLdXLd", "Fne") -BUILTIN(__builtin_carg, "dXd", "Fne") -BUILTIN(__builtin_cargf, "fXf", "Fne") -BUILTIN(__builtin_cargl, "LdXLd", "Fne") -BUILTIN(__builtin_casin, "XdXd", "Fne") -BUILTIN(__builtin_casinf, "XfXf", "Fne") -BUILTIN(__builtin_casinh, "XdXd", "Fne") -BUILTIN(__builtin_casinhf, "XfXf", "Fne") -BUILTIN(__builtin_casinhl, "XLdXLd", "Fne") -BUILTIN(__builtin_casinl, "XLdXLd", "Fne") -BUILTIN(__builtin_catan, "XdXd", "Fne") -BUILTIN(__builtin_catanf, "XfXf", "Fne") -BUILTIN(__builtin_catanh, "XdXd", "Fne") -BUILTIN(__builtin_catanhf, "XfXf", "Fne") -BUILTIN(__builtin_catanhl, "XLdXLd", "Fne") -BUILTIN(__builtin_catanl, "XLdXLd", "Fne") -BUILTIN(__builtin_ccos, "XdXd", "Fne") -BUILTIN(__builtin_ccosf, "XfXf", "Fne") -BUILTIN(__builtin_ccosl, "XLdXLd", "Fne") -BUILTIN(__builtin_ccosh, "XdXd", "Fne") -BUILTIN(__builtin_ccoshf, "XfXf", "Fne") -BUILTIN(__builtin_ccoshl, "XLdXLd", "Fne") -BUILTIN(__builtin_cexp, "XdXd", "Fne") -BUILTIN(__builtin_cexpf, "XfXf", "Fne") -BUILTIN(__builtin_cexpl, "XLdXLd", "Fne") -BUILTIN(__builtin_cimag, "dXd", "Fnc") -BUILTIN(__builtin_cimagf, "fXf", "Fnc") -BUILTIN(__builtin_cimagl, "LdXLd", "Fnc") -BUILTIN(__builtin_conj, "XdXd", "Fnc") -BUILTIN(__builtin_conjf, "XfXf", "Fnc") -BUILTIN(__builtin_conjl, "XLdXLd", "Fnc") -BUILTIN(__builtin_clog, "XdXd", "Fne") -BUILTIN(__builtin_clogf, "XfXf", "Fne") -BUILTIN(__builtin_clogl, "XLdXLd", "Fne") -BUILTIN(__builtin_cproj, "XdXd", "Fnc") -BUILTIN(__builtin_cprojf, "XfXf", "Fnc") -BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc") -BUILTIN(__builtin_cpow, "XdXdXd", "Fne") -BUILTIN(__builtin_cpowf, "XfXfXf", "Fne") -BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fne") -BUILTIN(__builtin_creal, "dXd", "Fnc") -BUILTIN(__builtin_crealf, "fXf", "Fnc") -BUILTIN(__builtin_creall, "LdXLd", "Fnc") -BUILTIN(__builtin_csin, "XdXd", "Fne") -BUILTIN(__builtin_csinf, "XfXf", "Fne") -BUILTIN(__builtin_csinl, "XLdXLd", "Fne") -BUILTIN(__builtin_csinh, "XdXd", "Fne") -BUILTIN(__builtin_csinhf, "XfXf", "Fne") -BUILTIN(__builtin_csinhl, "XLdXLd", "Fne") -BUILTIN(__builtin_csqrt, "XdXd", "Fne") -BUILTIN(__builtin_csqrtf, "XfXf", "Fne") -BUILTIN(__builtin_csqrtl, "XLdXLd", "Fne") -BUILTIN(__builtin_ctan, "XdXd", "Fne") -BUILTIN(__builtin_ctanf, "XfXf", "Fne") -BUILTIN(__builtin_ctanl, "XLdXLd", "Fne") -BUILTIN(__builtin_ctanh, "XdXd", "Fne") -BUILTIN(__builtin_ctanhf, "XfXf", "Fne") -BUILTIN(__builtin_ctanhl, "XLdXLd", "Fne") - -// FP Comparisons. -BUILTIN(__builtin_isgreater , "i.", "Fnct") -BUILTIN(__builtin_isgreaterequal, "i.", "Fnct") -BUILTIN(__builtin_isless , "i.", "Fnct") -BUILTIN(__builtin_islessequal , "i.", "Fnct") -BUILTIN(__builtin_islessgreater , "i.", "Fnct") -BUILTIN(__builtin_isunordered , "i.", "Fnct") - -// Unary FP classification -BUILTIN(__builtin_fpclassify, "iiiiii.", "Fnct") -BUILTIN(__builtin_isfinite, "i.", "Fnct") -BUILTIN(__builtin_isinf, "i.", "Fnct") -BUILTIN(__builtin_isinf_sign, "i.", "Fnct") -BUILTIN(__builtin_isnan, "i.", "Fnct") -BUILTIN(__builtin_isnormal, "i.", "Fnct") - -// FP signbit builtins -BUILTIN(__builtin_signbit, "i.", "Fnct") -BUILTIN(__builtin_signbitf, "if", "Fnc") -BUILTIN(__builtin_signbitl, "iLd", "Fnc") - -// Special FP builtins. -BUILTIN(__builtin_canonicalize, "dd", "nc") -BUILTIN(__builtin_canonicalizef, "ff", "nc") -BUILTIN(__builtin_canonicalizef16, "hh", "nc") -BUILTIN(__builtin_canonicalizel, "LdLd", "nc") - -// Builtins for arithmetic. -BUILTIN(__builtin_clzs , "iUs" , "nc") -BUILTIN(__builtin_clz , "iUi" , "nc") -BUILTIN(__builtin_clzl , "iULi" , "nc") -BUILTIN(__builtin_clzll, "iULLi", "nc") -// TODO: int clzimax(uintmax_t) -BUILTIN(__builtin_ctzs , "iUs" , "nc") -BUILTIN(__builtin_ctz , "iUi" , "nc") -BUILTIN(__builtin_ctzl , "iULi" , "nc") -BUILTIN(__builtin_ctzll, "iULLi", "nc") -// TODO: int ctzimax(uintmax_t) -BUILTIN(__builtin_ffs , "ii" , "Fnc") -BUILTIN(__builtin_ffsl , "iLi" , "Fnc") -BUILTIN(__builtin_ffsll, "iLLi", "Fnc") -BUILTIN(__builtin_parity , "iUi" , "nc") -BUILTIN(__builtin_parityl , "iULi" , "nc") -BUILTIN(__builtin_parityll, "iULLi", "nc") -BUILTIN(__builtin_popcount , "iUi" , "nc") -BUILTIN(__builtin_popcountl , "iULi" , "nc") -BUILTIN(__builtin_popcountll, "iULLi", "nc") -BUILTIN(__builtin_clrsb , "ii" , "nc") -BUILTIN(__builtin_clrsbl , "iLi" , "nc") -BUILTIN(__builtin_clrsbll, "iLLi", "nc") - -// The following builtins rely on that char == 8 bits, short == 16 bits and that -// there exists native types on the target that are 32- and 64-bits wide, unless -// these conditions are fulfilled these builtins will operate on a not intended -// bitwidth. -BUILTIN(__builtin_bswap16, "UsUs", "nc") -BUILTIN(__builtin_bswap32, "UZiUZi", "nc") -BUILTIN(__builtin_bswap64, "UWiUWi", "nc") - -BUILTIN(__builtin_bitreverse8, "UcUc", "nc") -BUILTIN(__builtin_bitreverse16, "UsUs", "nc") -BUILTIN(__builtin_bitreverse32, "UZiUZi", "nc") -BUILTIN(__builtin_bitreverse64, "UWiUWi", "nc") - -BUILTIN(__builtin_rotateleft8, "UcUcUc", "nc") -BUILTIN(__builtin_rotateleft16, "UsUsUs", "nc") -BUILTIN(__builtin_rotateleft32, "UZiUZiUZi", "nc") -BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "nc") -BUILTIN(__builtin_rotateright8, "UcUcUc", "nc") -BUILTIN(__builtin_rotateright16, "UsUsUs", "nc") -BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc") -BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "nc") - -// Random GCC builtins -BUILTIN(__builtin_constant_p, "i.", "nctu") -BUILTIN(__builtin_classify_type, "i.", "nctu") -BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc") -BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc") -BUILTIN(__builtin_va_start, "vA.", "nt") -BUILTIN(__builtin_va_end, "vA", "n") -BUILTIN(__builtin_va_copy, "vAA", "n") -BUILTIN(__builtin_stdarg_start, "vA.", "nt") -BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc") -BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn") -BUILTIN(__builtin_bcopy, "vv*v*z", "n") -BUILTIN(__builtin_bzero, "vv*z", "nF") -BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:") -BUILTIN(__builtin_memchr, "v*vC*iz", "nF") -BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF") -BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF") -BUILTIN(__builtin_memcpy_inline, "vv*vC*Iz", "nt") -BUILTIN(__builtin_memmove, "v*v*vC*z", "nF") -BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF") -BUILTIN(__builtin_memset, "v*v*iz", "nF") -BUILTIN(__builtin_printf, "icC*.", "Fp:0:") -BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF") -BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF") -BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF") -BUILTIN(__builtin_strcat, "c*c*cC*", "nF") -BUILTIN(__builtin_strchr, "c*cC*i", "nF") -BUILTIN(__builtin_strcmp, "icC*cC*", "nF") -BUILTIN(__builtin_strcpy, "c*c*cC*", "nF") -BUILTIN(__builtin_strcspn, "zcC*cC*", "nF") -BUILTIN(__builtin_strdup, "c*cC*", "nF") -BUILTIN(__builtin_strlen, "zcC*", "nF") -BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF") -BUILTIN(__builtin_strncat, "c*c*cC*z", "nF") -BUILTIN(__builtin_strncmp, "icC*cC*z", "nF") -BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF") -BUILTIN(__builtin_strndup, "c*cC*z", "nF") -BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF") -BUILTIN(__builtin_strrchr, "c*cC*i", "nF") -BUILTIN(__builtin_strspn, "zcC*cC*", "nF") -BUILTIN(__builtin_strstr, "c*cC*cC*", "nF") -BUILTIN(__builtin_wcschr, "w*wC*w", "nF") -BUILTIN(__builtin_wcscmp, "iwC*wC*", "nF") -BUILTIN(__builtin_wcslen, "zwC*", "nF") -BUILTIN(__builtin_wcsncmp, "iwC*wC*z", "nF") -BUILTIN(__builtin_wmemchr, "w*wC*wz", "nF") -BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nF") -BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nF") -BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nF") -BUILTIN(__builtin_return_address, "v*IUi", "n") -BUILTIN(__builtin_extract_return_addr, "v*v*", "n") -BUILTIN(__builtin_frame_address, "v*IUi", "n") -BUILTIN(__builtin___clear_cache, "vc*c*", "n") -BUILTIN(__builtin_setjmp, "iv**", "j") -BUILTIN(__builtin_longjmp, "vv**i", "r") -BUILTIN(__builtin_unwind_init, "v", "") -BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc") -BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") -BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") -BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") -BUILTIN(__builtin_thread_pointer, "v*", "nc") -BUILTIN(__builtin_launder, "v*v*", "nt") -LANGBUILTIN(__builtin_is_constant_evaluated, "b", "n", CXX_LANG) - -// GCC exception builtins -BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! -BUILTIN(__builtin_frob_return_addr, "v*v*", "n") -BUILTIN(__builtin_dwarf_cfa, "v*", "n") -BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n") -BUILTIN(__builtin_dwarf_sp_column, "Ui", "n") -BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t - -// GCC Object size checking builtins -BUILTIN(__builtin_object_size, "zvC*i", "nu") -BUILTIN(__builtin_dynamic_object_size, "zvC*i", "nu") // Clang only. -BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF") -BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF") -BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF") -BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF") -BUILTIN(__builtin___memset_chk, "v*v*izz", "nF") -BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF") -BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF") -BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF") -BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF") -BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF") -BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF") -BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF") -BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF") -BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:") -BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:") -BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:") -BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:") -BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:") -BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:") -BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:") -BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:") - -BUILTIN(__builtin_unpredictable, "LiLi" , "nc") -BUILTIN(__builtin_expect, "LiLiLi" , "nc") -BUILTIN(__builtin_prefetch, "vvC*.", "nc") -BUILTIN(__builtin_readcyclecounter, "ULLi", "n") -BUILTIN(__builtin_trap, "v", "nr") -BUILTIN(__builtin_debugtrap, "v", "n") -BUILTIN(__builtin_unreachable, "v", "nr") -BUILTIN(__builtin_shufflevector, "v." , "nct") -BUILTIN(__builtin_convertvector, "v." , "nct") -BUILTIN(__builtin_alloca, "v*z" , "Fn") -BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn") -BUILTIN(__builtin_call_with_static_chain, "v.", "nt") - -BUILTIN(__builtin_matrix_transpose, "v.", "nFt") - -// "Overloaded" Atomic operator builtins. These are overloaded to support data -// types of i8, i16, i32, i64, and i128. The front-end sees calls to the -// non-suffixed version of these (which has a bogus type) and transforms them to -// the right overloaded version in Sema (plus casts). - -// FIXME: These assume that char -> i8, short -> i16, int -> i32, -// long long -> i64. - -BUILTIN(__sync_fetch_and_add, "v.", "t") -BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt") -BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt") -BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt") -BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt") -BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt") - -BUILTIN(__sync_fetch_and_sub, "v.", "t") -BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt") -BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt") -BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt") -BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt") -BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt") - -BUILTIN(__sync_fetch_and_or, "v.", "t") -BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt") -BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt") -BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt") -BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt") -BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt") - -BUILTIN(__sync_fetch_and_and, "v.", "t") -BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn") -BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn") -BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn") -BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_fetch_and_xor, "v.", "t") -BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn") -BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn") -BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn") -BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_fetch_and_nand, "v.", "t") -BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn") -BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn") -BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn") -BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_add_and_fetch, "v.", "t") -BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_sub_and_fetch, "v.", "t") -BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_or_and_fetch, "v.", "t") -BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_and_and_fetch, "v.", "t") -BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_xor_and_fetch, "v.", "t") -BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_nand_and_fetch, "v.", "t") -BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn") -BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn") -BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn") -BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_bool_compare_and_swap, "v.", "t") -BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn") -BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn") -BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn") -BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn") -BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn") - -BUILTIN(__sync_val_compare_and_swap, "v.", "t") -BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn") -BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn") -BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn") -BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn") -BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn") - -BUILTIN(__sync_lock_test_and_set, "v.", "t") -BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn") -BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn") -BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn") -BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn") - -BUILTIN(__sync_lock_release, "v.", "t") -BUILTIN(__sync_lock_release_1, "vcD*.", "tn") -BUILTIN(__sync_lock_release_2, "vsD*.", "tn") -BUILTIN(__sync_lock_release_4, "viD*.", "tn") -BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn") -BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn") - -BUILTIN(__sync_swap, "v.", "t") -BUILTIN(__sync_swap_1, "ccD*c.", "tn") -BUILTIN(__sync_swap_2, "ssD*s.", "tn") -BUILTIN(__sync_swap_4, "iiD*i.", "tn") -BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn") -BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn") - -// Some of our atomics builtins are handled by AtomicExpr rather than -// as normal builtin CallExprs. This macro is used for such builtins. -#ifndef ATOMIC_BUILTIN -#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS) -#endif - -// C11 _Atomic operations for . -ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_max, "v.", "t") -ATOMIC_BUILTIN(__c11_atomic_fetch_min, "v.", "t") -BUILTIN(__c11_atomic_thread_fence, "vi", "n") -BUILTIN(__c11_atomic_signal_fence, "vi", "n") -BUILTIN(__c11_atomic_is_lock_free, "bz", "n") - -// GNU atomic builtins. -ATOMIC_BUILTIN(__atomic_load, "v.", "t") -ATOMIC_BUILTIN(__atomic_load_n, "v.", "t") -ATOMIC_BUILTIN(__atomic_store, "v.", "t") -ATOMIC_BUILTIN(__atomic_store_n, "v.", "t") -ATOMIC_BUILTIN(__atomic_exchange, "v.", "t") -ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t") -ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t") -ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t") -ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_max_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_min_fetch, "v.", "t") -ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t") -BUILTIN(__atomic_test_and_set, "bvD*i", "n") -BUILTIN(__atomic_clear, "vvD*i", "n") -BUILTIN(__atomic_thread_fence, "vi", "n") -BUILTIN(__atomic_signal_fence, "vi", "n") -BUILTIN(__atomic_always_lock_free, "bzvCD*", "n") -BUILTIN(__atomic_is_lock_free, "bzvCD*", "n") - -// OpenCL 2.0 atomic builtins. -ATOMIC_BUILTIN(__opencl_atomic_init, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_load, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_store, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_exchange, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_strong, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_weak, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_add, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_sub, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_and, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_or, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_xor, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_min, "v.", "t") -ATOMIC_BUILTIN(__opencl_atomic_fetch_max, "v.", "t") - -// GCC does not support these, they are a Clang extension. -ATOMIC_BUILTIN(__atomic_fetch_min, "v.", "t") -ATOMIC_BUILTIN(__atomic_fetch_max, "v.", "t") - -#undef ATOMIC_BUILTIN - -// Non-overloaded atomic builtins. -BUILTIN(__sync_synchronize, "v", "n") -// GCC does not support these, they are a Clang extension. -BUILTIN(__sync_fetch_and_min, "iiD*i", "n") -BUILTIN(__sync_fetch_and_max, "iiD*i", "n") -BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n") -BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n") - -// Random libc builtins. -BUILTIN(__builtin_abort, "v", "Fnr") -BUILTIN(__builtin_index, "c*cC*i", "Fn") -BUILTIN(__builtin_rindex, "c*cC*i", "Fn") - -// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399 -BUILTIN(__warn_memset_zero_len, "v", "nU") - -// Microsoft builtins. These are only active with -fms-extensions. -LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES) -LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittest, "UcNiC*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandcomplement, "UcNi*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandreset, "UcNi*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandset, "UcNi*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittest64, "UcWiC*Wi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandcomplement64, "UcWi*Wi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandreset64, "UcWi*Wi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_bittestandset64, "UcWi*Wi", "n", ALL_MS_LANGUAGES) -LIBBUILTIN(_byteswap_ushort, "UsUs", "fnc", "stdlib.h", ALL_MS_LANGUAGES) -LIBBUILTIN(_byteswap_ulong, "UNiUNi", "fnc", "stdlib.h", ALL_MS_LANGUAGES) -LIBBUILTIN(_byteswap_uint64, "ULLiULLi", "fnc", "stdlib.h", ALL_MS_LANGUAGES) -LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__exception_code, "UNi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_exception_code, "UNi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__exception_info, "v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_exception_info, "v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_abnormal_termination, "i", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__GetExceptionInfo, "v*.", "ntu", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedAnd8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedAnd16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedAnd, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchange8, "ccD*cc", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchange16, "ssD*ss", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchange, "NiNiD*NiNi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchange64, "LLiLLiD*LLiLLi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedCompareExchangePointer_nf, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedDecrement16, "ssD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedDecrement, "NiNiD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchange, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchange8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchange16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeAdd8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeAdd16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeAdd, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeSub8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeSub16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedExchangeSub, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedIncrement16, "ssD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedIncrement, "NiNiD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedOr8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedOr16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedOr, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedXor8, "ccD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedXor16, "ssD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_InterlockedXor, "NiNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandreset, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandreset64, "UcWiD*Wi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandreset_acq, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandreset_nf, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandreset_rel, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandset, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandset64, "UcWiD*Wi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandset_acq, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandset_nf, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_interlockedbittestandset_rel, "UcNiD*Ni", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_load8, "ccCD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_load16, "ssCD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_load32, "iiCD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_load64, "LLiLLiCD*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_store8, "vcD*c", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_store16, "vsD*s", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_store32, "viD*i", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__lzcnt16, "UsUs", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(__lzcnt, "UiUi", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(__lzcnt64, "UWiUWi", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(__popcnt16, "UsUs", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(__popcnt, "UiUi", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(__popcnt64, "UWiUWi", "nc", ALL_MS_LANGUAGES) -LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotl8, "UcUcUc", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotl16, "UsUsUc", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotl, "UiUii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_lrotl, "ULiULii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotl64, "UWiUWii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotr8, "UcUcUc", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotr16, "UsUsUc", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotr, "UiUii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_lrotr, "ULiULii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(_rotr64, "UWiUWii", "n", ALL_MS_LANGUAGES) -LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES) -LANGBUILTIN(__fastfail, "vUi", "nr", ALL_MS_LANGUAGES) - -// Microsoft library builtins. -LIBBUILTIN(_setjmpex, "iJ", "fj", "setjmpex.h", ALL_MS_LANGUAGES) - -// C99 library functions -// C99 stdarg.h -LIBBUILTIN(va_start, "vA.", "fn", "stdarg.h", ALL_LANGUAGES) -LIBBUILTIN(va_end, "vA", "fn", "stdarg.h", ALL_LANGUAGES) -LIBBUILTIN(va_copy, "vAA", "fn", "stdarg.h", ALL_LANGUAGES) -// C99 stdlib.h -LIBBUILTIN(abort, "v", "fr", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtod, "dcC*c**", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtof, "fcC*c**", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtold, "LdcC*c**", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtol, "LicC*c**i", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtoll, "LLicC*c**i", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtoul, "ULicC*c**i", "f", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(strtoull, "ULLicC*c**i", "f", "stdlib.h", ALL_LANGUAGES) -// C99 string.h -LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memset, "v*v*iz", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strerror, "c*i", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES) -// C99 stdio.h -// FIXME: This list is incomplete. -LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vfprintf, "iP*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(scanf, "icC*R.", "fs:0:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(fscanf, "iP*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(fopen, "P*cC*cC*", "f", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(fread, "zv*zzP*", "f", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(fwrite, "zvC*zzP*", "f", "stdio.h", ALL_LANGUAGES) - -// C99 ctype.h -LIBBUILTIN(isalnum, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isalpha, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isblank, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(iscntrl, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isgraph, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(islower, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isprint, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(ispunct, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isspace, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(isxdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES) -// C99 wchar.h -// FIXME: This list is incomplete. We should cover at least the functions that -// take format strings. -LIBBUILTIN(wcschr, "w*wC*w", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wcscmp, "iwC*wC*", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wcslen, "zwC*", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wcsncmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wmemchr, "w*wC*wz", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wmemcmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wmemcpy, "w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES) -LIBBUILTIN(wmemmove,"w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES) - -// C99 -// In some systems setjmp is a macro that expands to _setjmp. We undefine -// it here to avoid having two identical LIBBUILTIN entries. -#undef setjmp -LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) - -// Non-C library functions, active in GNU mode only. -// Functions with (returns_twice) attribute (marked as "j") are still active in -// all languages, because losing this attribute would result in miscompilation -// when these functions are used in non-GNU mode. PR16138. -LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_GNU_LANGUAGES) -// POSIX string.h -LIBBUILTIN(memccpy, "v*v*vC*iz", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(mempcpy, "v*v*vC*z", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) -// POSIX strings.h -LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(bcmp, "ivC*vC*z", "f", "strings.h", ALL_GNU_LANGUAGES) -// In some systems str[n]casejmp is a macro that expands to _str[n]icmp. -// We undefine then here to avoid wrong name. -#undef strcasecmp -#undef strncasecmp -LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_GNU_LANGUAGES) -// POSIX unistd.h -LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(vfork, "p", "fj", "unistd.h", ALL_LANGUAGES) -// POSIX pthread.h -LIBBUILTIN(pthread_create, "", "fC<2,3>", "pthread.h", ALL_GNU_LANGUAGES) - -// POSIX setjmp.h - -LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES) - -LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES) -// non-standard but very common -LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) -LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) -// id objc_msgSend(id, SEL, ...) -LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG) -// long double objc_msgSend_fpret(id self, SEL op, ...) -LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG) -// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...) -LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG) -// void objc_msgSend_stret (id, SEL, ...) -LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG) -// id objc_msgSendSuper(struct objc_super *super, SEL op, ...) -LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG) -// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...) -LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG) -// id objc_getClass(const char *name) -LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) -// id objc_getMetaClass(const char *name) -LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) -// void objc_enumerationMutation(id) -LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG) - -// id objc_read_weak(id *location) -LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG) -// id objc_assign_weak(id value, id *location) -LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) -// id objc_assign_ivar(id value, id dest, ptrdiff_t offset) -LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG) -// id objc_assign_global(id val, id *dest) -LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) -// id objc_assign_strongCast(id val, id *dest -LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) - -// id objc_exception_extract(void *localExceptionData) -LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG) -// void objc_exception_try_enter(void *localExceptionData) -LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) -// void objc_exception_try_exit(void *localExceptionData) -LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) -// int objc_exception_match(Class exceptionClass, id exception) -LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG) -// void objc_exception_throw(id exception) -LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG) - -// int objc_sync_enter(id obj) -LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG) -// int objc_sync_exit(id obj) -LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG) - -BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") - -// void NSLog(NSString *fmt, ...) -LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) -// void NSLogv(NSString *fmt, va_list args) -LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) - -// Builtin math library functions -LIBBUILTIN(atan2, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atan2f, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atan2l, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(abs, "ii", "fnc", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(labs, "LiLi", "fnc", "stdlib.h", ALL_LANGUAGES) -LIBBUILTIN(llabs, "LLiLLi", "fnc", "stdlib.h", ALL_LANGUAGES) - -LIBBUILTIN(copysign, "ddd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(copysignf, "fff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(copysignl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fabs, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -// Some systems define finitef as alias of _finitef. -#if defined (finitef) -#undef finitef -#endif -LIBBUILTIN(finite, "id", "fnc", "math.h", GNU_LANG) -LIBBUILTIN(finitef, "if", "fnc", "math.h", GNU_LANG) -LIBBUILTIN(finitel, "iLd", "fnc", "math.h", GNU_LANG) -// glibc's math.h generates calls to __finite -LIBBUILTIN(__finite, "id", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__finitef, "if", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__finitel, "iLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(frexp, "ddi*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(frexpf, "ffi*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(frexpl, "LdLdi*", "fn", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(ldexp, "ddi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ldexpf, "ffi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ldexpl, "LdLdi", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(nan, "dcC*", "fUn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nanf, "fcC*", "fUn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nanl, "LdcC*", "fUn", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(powl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(acos, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(acosf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(acosl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(acosh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(acoshf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(acoshl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(asin, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(asinf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(asinl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(asinh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(asinhf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(asinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(atan, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atanf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atanl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(atanh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(cbrt, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(cbrtf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(cbrtl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ceill, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(cos, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(cosf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(cosl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(cosh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(coshf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(coshl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(erf, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(erff, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(erfl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(erfc, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(erfcf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(erfcl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(exp, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(expf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(expl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(exp2, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fdim, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fdimf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fdiml, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(floor, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(floorf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(floorl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fmax, "ddd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmaxf, "fff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fmaxl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(fmin, "ddd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fminf, "fff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(fminl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(hypot, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(hypotf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(hypotl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(ilogb, "id", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES) - -// POSIX math.h declares a global, signgam, that lgamma writes to, so these -// shouldn't have "e" or "c" attributes -LIBBUILTIN(lgamma, "dd", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lgammaf, "ff", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lgammal, "LdLd", "fn", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(llrintl, "LLiLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(llround, "LLid", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(llroundf, "LLif", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(llroundl, "LLiLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(log, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(logf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(logl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(log10, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log10f, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log10l, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(log1p, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log1pf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log1pl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(log2, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log2f, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(log2l, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(logb, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(logbf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(logbl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(lrint, "Lid", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lrintf, "Lif", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lrintl, "LiLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(lround, "Lid", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lroundf, "Lif", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(lroundl, "LiLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(nearbyint, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nearbyintf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nearbyintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(nextafter, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nextafterf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nextafterl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(nexttoward, "ddLd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nexttowardf, "ffLd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nexttowardl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(remainder, "ddd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(remainderf, "fff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(remainderl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(remquo, "dddi*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(remquof, "fffi*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(remquol, "LdLdLdi*", "fn", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(rint, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(rintf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(rintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(round, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(roundf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(roundl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(scalbln, "ddLi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(scalblnf, "ffLi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(scalblnl, "LdLdLi", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(scalbn, "ddi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(scalbnf, "ffi", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(scalbnl, "LdLdi", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(sin, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sinf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sinl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(sinh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sinhf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(sqrt, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sqrtf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sqrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(tan, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tanf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tanl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(tanh, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tanhf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(tgamma, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tgammaf, "ff", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(tgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(trunc, "dd", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(truncf, "ff", "fnc", "math.h", ALL_LANGUAGES) -LIBBUILTIN(truncl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(cabs, "dXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cabsf, "fXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cabsl, "LdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cacos, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cacosf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cacosl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cacosh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cacoshf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cacoshl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(carg, "dXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cargf, "fXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cargl, "LdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(casin, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(casinf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(casinl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(casinh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(casinhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(casinhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(catan, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(catanf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(catanl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(catanh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(catanhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(catanhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(ccos, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ccosf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ccosl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(ccosh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ccoshf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ccoshl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cexp, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cexpf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cexpl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(conj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(conjf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(conjl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(clog, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(clogf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(clogl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cproj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cprojf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cprojl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(cpow, "XdXdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cpowf, "XfXfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(cpowl, "XLdXLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(csin, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csinf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csinl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(csinh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csinhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csinhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(csqrt, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csqrtf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(csqrtl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(ctan, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ctanf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ctanl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -LIBBUILTIN(ctanh, "XdXd", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ctanhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES) -LIBBUILTIN(ctanhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES) - -// __sinpi and friends are OS X specific library functions, but otherwise much -// like the standard (non-complex) sin (etc). -LIBBUILTIN(__sinpi, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__sinpif, "ff", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(__cospi, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__cospif, "ff", "fne", "math.h", ALL_LANGUAGES) - -LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES) - -// Similarly, __exp10 is OS X only -LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES) - -// Blocks runtime Builtin math library functions -LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES) -LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) -// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. - -// Annotation function -BUILTIN(__builtin_annotation, "v.", "tn") - -// Invariants -BUILTIN(__builtin_assume, "vb", "n") - -// Multiprecision Arithmetic Builtins. -BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n") -BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n") -BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n") -BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n") -BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n") -BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n") -BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n") -BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n") -BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n") -BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n") - -// Checked Arithmetic Builtins for Security. -BUILTIN(__builtin_add_overflow, "b.", "nt") -BUILTIN(__builtin_sub_overflow, "b.", "nt") -BUILTIN(__builtin_mul_overflow, "b.", "nt") -BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "n") -BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "n") -BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "n") -BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "n") -BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "n") -BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "n") -BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "n") -BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "n") -BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "n") -BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "n") -BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "n") -BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "n") -BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "n") -BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "n") -BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "n") -BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "n") -BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "n") -BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "n") - -// Clang builtins (not available in GCC). -BUILTIN(__builtin_addressof, "v*v&", "nct") -BUILTIN(__builtin_operator_new, "v*z", "tc") -BUILTIN(__builtin_operator_delete, "vv*", "tn") -BUILTIN(__builtin_char_memchr, "c*cC*iz", "n") -BUILTIN(__builtin_dump_struct, "ivC*v*", "tn") -BUILTIN(__builtin_preserve_access_index, "v.", "t") - -// Alignment builtins (uses custom parsing to support pointers and integers) -BUILTIN(__builtin_is_aligned, "bvC*z", "nct") -BUILTIN(__builtin_align_up, "v*vC*z", "nct") -BUILTIN(__builtin_align_down, "v*vC*z", "nct") - -// Safestack builtins -BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") -BUILTIN(__builtin___get_unsafe_stack_bottom, "v*", "Fn") -BUILTIN(__builtin___get_unsafe_stack_top, "v*", "Fn") -BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn") - -// Nontemporal loads/stores builtins -BUILTIN(__builtin_nontemporal_store, "v.", "t") -BUILTIN(__builtin_nontemporal_load, "v.", "t") - -// Coroutine intrinsics. -BUILTIN(__builtin_coro_resume, "vv*", "") -BUILTIN(__builtin_coro_destroy, "vv*", "") -BUILTIN(__builtin_coro_done, "bv*", "n") -BUILTIN(__builtin_coro_promise, "v*v*IiIb", "n") - -BUILTIN(__builtin_coro_size, "z", "n") -BUILTIN(__builtin_coro_frame, "v*", "n") -BUILTIN(__builtin_coro_noop, "v*", "n") -BUILTIN(__builtin_coro_free, "v*v*", "n") - -BUILTIN(__builtin_coro_id, "v*Iiv*v*v*", "n") -BUILTIN(__builtin_coro_alloc, "b", "n") -BUILTIN(__builtin_coro_begin, "v*v*", "n") -BUILTIN(__builtin_coro_end, "bv*Ib", "n") -BUILTIN(__builtin_coro_suspend, "cIb", "n") -BUILTIN(__builtin_coro_param, "bv*v*", "n") - -// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions. -// We need the generic prototype, since the packet type could be anything. -LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG) -LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG) - -LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG) -LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG) - -LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG) -LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG) - -LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG) -LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG) - -LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG) -LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG) - -LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG) -LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG) - -LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG) -LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG) - -LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG) -LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG) - -// OpenCL v2.0 s6.13.17 - Enqueue kernel functions. -// Custom builtin check allows to perform special check of passed block arguments. -LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG) -LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG) -LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG) -LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG) -LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG) - -// OpenCL v2.0 s6.13.9 - Address space qualifier functions. -// FIXME: Pointer parameters of OpenCL builtins should have their address space -// requirement defined. -LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG) -LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG) -LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG) - -// OpenCL half load/store builtin -LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES) -LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES) -LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES) -LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES) - -// Builtins for os_log/os_trace -BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut") -BUILTIN(__builtin_os_log_format, "v*v*cC*.", "p:0:nt") - -// OpenMP 4.0 -LANGBUILTIN(omp_is_initial_device, "i", "nc", OMP_LANG) - -// Builtins for XRay -BUILTIN(__xray_customevent, "vcC*z", "") -BUILTIN(__xray_typedevent, "vzcC*z", "") - -// Win64-compatible va_list functions -BUILTIN(__builtin_ms_va_start, "vc*&.", "nt") -BUILTIN(__builtin_ms_va_end, "vc*&", "n") -BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n") - -#undef BUILTIN -#undef LIBBUILTIN -#undef LANGBUILTIN Index: clang/include/clang/Basic/Builtins.td =================================================================== --- /dev/null +++ clang/include/clang/Basic/Builtins.td @@ -0,0 +1,1566 @@ +//===--- Builtins.td - Builtin function info database -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the standard builtin function database. +// +//===----------------------------------------------------------------------===// +// Types of functions are specified via a string. The first character of the +// string specifies the type of the result and subsequent letters specify the +// types of any arguments as follows: +// v -> void +// b -> boolean +// c -> char +// s -> short +// i -> int +// h -> half +// f -> float +// d -> double +// z -> size_t +// w -> wchar_t +// F -> constant CFString +// G -> id +// H -> SEL +// M -> struct objc_super +// a -> __builtin_va_list +// A -> "reference" to __builtin_va_list +// V -> Vector, followed by the number of elements and the base type. +// q -> Scalable vector, followed by the number of elements and the base type. +// E -> ext_vector, followed by the number of elements and the base type. +// X -> _Complex, followed by the base type. +// Y -> ptrdiff_t +// P -> FILE +// J -> jmp_buf +// SJ -> sigjmp_buf +// K -> ucontext_t +// p -> pid_t +// . -> "...". This may only occur at the end of the function list. +// +// Types may be prefixed with the following modifiers: +// L -> long (e.g. Li for 'long int', Ld for 'long double') +// LL -> long long (e.g. LLi for 'long long int', LLd for __float128) +// LLL -> __int128_t (e.g. LLLi) +// Z -> int32_t (require a native 32-bit integer type on the target) +// W -> int64_t (require a native 64-bit integer type on the target) +// N -> 'int' size if target is LP64, 'L' otherwise. +// O -> long for OpenCL targets, long long otherwise. +// S -> signed +// U -> unsigned +// I -> Required to constant fold to an integer constant expression. +// +// Types may be postfixed with the following modifiers: +// * -> pointer (optionally followed by an address space number, if no address +// space is specified than any address space will be accepted) +// & -> reference (optionally followed by an address space number) +// C -> const +// D -> volatile +// +// Attributes of functions are also specified via strings. These must be kept +// in sync with the predicates in the Builtin::Context class. Currently we +// have: +// n -> nothrow +// r -> noreturn +// U -> pure +// c -> const +// t -> signature is meaningless, use custom typechecking +// F -> this is a libc/libm function with a '__builtin_' prefix added. +// f -> this is a libc/libm function without the '__builtin_' prefix. It can +// be followed by ':headername:' to state which header this function +// comes from. +// h -> this function requires a specific header or an explicit declaration. +// i -> this is a runtime library implemented function without the +// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc. +// p:N: -> this is a printf-like function whose Nth argument is the format +// string. +// P:N: -> similar to the p:N: attribute, but the function is like vprintf +// in that it accepts its arguments as a va_list rather than +// through an ellipsis +// s:N: -> this is a scanf-like function whose Nth argument is the format +// string. +// S:N: -> similar to the s:N: attribute, but the function is like vscanf +// in that it accepts its arguments as a va_list rather than +// through an ellipsis +// e -> const, but only when -fno-math-errno +// j -> returns_twice (like setjmp) +// u -> arguments are not evaluated for their side-effects +// V:N: -> requires vectors of at least N bits to be legal +// C -> callback behavior: argument N is called with argument +// M_0, ..., M_k as payload +// FIXME: gcc has nonnull + +include "BuiltinTableGenDefs.inc" + +// Standard libc/libm functions: +def __builtin_atan2 : Builtin<"ddd", "Fne">; +def __builtin_atan2f : Builtin<"fff", "Fne">; +def __builtin_atan2l : Builtin<"LdLdLd", "Fne">; +def __builtin_abs : Builtin<"ii", "ncF">; +def __builtin_copysign : Builtin<"ddd", "ncF">; +def __builtin_copysignf : Builtin<"fff", "ncF">; +def __builtin_copysignf16 : Builtin<"hhh", "ncF">; +def __builtin_copysignl : Builtin<"LdLdLd", "ncF">; +def __builtin_copysignf128 : Builtin<"LLdLLdLLd", "ncF">; +def __builtin_fabs : Builtin<"dd", "ncF">; +def __builtin_fabsf : Builtin<"ff", "ncF">; +def __builtin_fabsl : Builtin<"LdLd", "ncF">; +def __builtin_fabsf16 : Builtin<"hh", "ncF">; +def __builtin_fabsf128 : Builtin<"LLdLLd", "ncF">; +def __builtin_fmod : Builtin<"ddd", "Fne">; +def __builtin_fmodf : Builtin<"fff", "Fne">; +def __builtin_fmodf16 : Builtin<"hhh", "Fne">; +def __builtin_fmodl : Builtin<"LdLdLd", "Fne">; +def __builtin_frexp : Builtin<"ddi*", "Fn">; +def __builtin_frexpf : Builtin<"ffi*", "Fn">; +def __builtin_frexpl : Builtin<"LdLdi*", "Fn">; +def __builtin_huge_val : Builtin<"d", "nc">; +def __builtin_huge_valf : Builtin<"f", "nc">; +def __builtin_huge_vall : Builtin<"Ld", "nc">; +def __builtin_huge_valf128 : Builtin<"LLd", "nc">; +def __builtin_inf : Builtin<"d", "nc">; +def __builtin_inff : Builtin<"f", "nc">; +def __builtin_infl : Builtin<"Ld", "nc">; +def __builtin_inff128 : Builtin<"LLd", "nc">; +def __builtin_labs : Builtin<"LiLi", "Fnc">; +def __builtin_llabs : Builtin<"LLiLLi", "Fnc">; +def __builtin_ldexp : Builtin<"ddi", "Fne">; +def __builtin_ldexpf : Builtin<"ffi", "Fne">; +def __builtin_ldexpl : Builtin<"LdLdi", "Fne">; +def __builtin_modf : Builtin<"ddd*", "Fn">; +def __builtin_modff : Builtin<"fff*", "Fn">; +def __builtin_modfl : Builtin<"LdLdLd*", "Fn">; +def __builtin_nan : Builtin<"dcC*", "FnU">; +def __builtin_nanf : Builtin<"fcC*", "FnU">; +def __builtin_nanl : Builtin<"LdcC*", "FnU">; +def __builtin_nanf128 : Builtin<"LLdcC*", "FnU">; +def __builtin_nans : Builtin<"dcC*", "FnU">; +def __builtin_nansf : Builtin<"fcC*", "FnU">; +def __builtin_nansl : Builtin<"LdcC*", "FnU">; +def __builtin_nansf128 : Builtin<"LLdcC*", "FnU">; +def __builtin_powi : Builtin<"ddi", "Fnc">; +def __builtin_powif : Builtin<"ffi", "Fnc">; +def __builtin_powil : Builtin<"LdLdi", "Fnc">; +def __builtin_pow : Builtin<"ddd", "Fne">; +def __builtin_powf : Builtin<"fff", "Fne">; +def __builtin_powf16 : Builtin<"hhh", "Fne">; +def __builtin_powl : Builtin<"LdLdLd", "Fne">; + +// Standard unary libc/libm functions with double/float/long double variants: +def __builtin_acos : Builtin<"dd", "Fne">; +def __builtin_acosf : Builtin<"ff", "Fne">; +def __builtin_acosl : Builtin<"LdLd", "Fne">; +def __builtin_acosh : Builtin<"dd", "Fne">; +def __builtin_acoshf : Builtin<"ff", "Fne">; +def __builtin_acoshl : Builtin<"LdLd", "Fne">; +def __builtin_asin : Builtin<"dd", "Fne">; +def __builtin_asinf : Builtin<"ff", "Fne">; +def __builtin_asinl : Builtin<"LdLd", "Fne">; +def __builtin_asinh : Builtin<"dd", "Fne">; +def __builtin_asinhf : Builtin<"ff", "Fne">; +def __builtin_asinhl : Builtin<"LdLd", "Fne">; +def __builtin_atan : Builtin<"dd", "Fne">; +def __builtin_atanf : Builtin<"ff", "Fne">; +def __builtin_atanl : Builtin<"LdLd", "Fne">; +def __builtin_atanh : Builtin<"dd", "Fne">; +def __builtin_atanhf : Builtin<"ff", "Fne">; +def __builtin_atanhl : Builtin<"LdLd", "Fne">; +def __builtin_cbrt : Builtin<"dd", "Fnc">; +def __builtin_cbrtf : Builtin<"ff", "Fnc">; +def __builtin_cbrtl : Builtin<"LdLd", "Fnc">; +def __builtin_ceil : Builtin<"dd", "Fnc">; +def __builtin_ceilf : Builtin<"ff", "Fnc">; +def __builtin_ceilf16 : Builtin<"hh", "Fnc">; +def __builtin_ceill : Builtin<"LdLd", "Fnc">; +def __builtin_cos : Builtin<"dd", "Fne">; +def __builtin_cosf : Builtin<"ff", "Fne">; +def __builtin_cosf16 : Builtin<"hh", "Fne">; +def __builtin_cosh : Builtin<"dd", "Fne">; +def __builtin_coshf : Builtin<"ff", "Fne">; +def __builtin_coshl : Builtin<"LdLd", "Fne">; +def __builtin_cosl : Builtin<"LdLd", "Fne">; +def __builtin_erf : Builtin<"dd", "Fne">; +def __builtin_erff : Builtin<"ff", "Fne">; +def __builtin_erfl : Builtin<"LdLd", "Fne">; +def __builtin_erfc : Builtin<"dd", "Fne">; +def __builtin_erfcf : Builtin<"ff", "Fne">; +def __builtin_erfcl : Builtin<"LdLd", "Fne">; +def __builtin_exp : Builtin<"dd", "Fne">; +def __builtin_expf : Builtin<"ff", "Fne">; +def __builtin_expf16 : Builtin<"hh", "Fne">; +def __builtin_expl : Builtin<"LdLd", "Fne">; +def __builtin_exp2 : Builtin<"dd", "Fne">; +def __builtin_exp2f : Builtin<"ff", "Fne">; +def __builtin_exp2f16 : Builtin<"hh", "Fne">; +def __builtin_exp2l : Builtin<"LdLd", "Fne">; +def __builtin_expm1 : Builtin<"dd", "Fne">; +def __builtin_expm1f : Builtin<"ff", "Fne">; +def __builtin_expm1l : Builtin<"LdLd", "Fne">; +def __builtin_fdim : Builtin<"ddd", "Fne">; +def __builtin_fdimf : Builtin<"fff", "Fne">; +def __builtin_fdiml : Builtin<"LdLdLd", "Fne">; +def __builtin_floor : Builtin<"dd", "Fnc">; +def __builtin_floorf : Builtin<"ff", "Fnc">; +def __builtin_floorf16 : Builtin<"hh", "Fnc">; +def __builtin_floorl : Builtin<"LdLd", "Fnc">; +def __builtin_fma : Builtin<"dddd", "Fne">; +def __builtin_fmaf : Builtin<"ffff", "Fne">; +def __builtin_fmaf16 : Builtin<"hhhh", "Fne">; +def __builtin_fmal : Builtin<"LdLdLdLd", "Fne">; +def __builtin_fmax : Builtin<"ddd", "Fnc">; +def __builtin_fmaxf : Builtin<"fff", "Fnc">; +def __builtin_fmaxf16 : Builtin<"hhh", "Fnc">; +def __builtin_fmaxl : Builtin<"LdLdLd", "Fnc">; +def __builtin_fmin : Builtin<"ddd", "Fnc">; +def __builtin_fminf : Builtin<"fff", "Fnc">; +def __builtin_fminf16 : Builtin<"hhh", "Fnc">; +def __builtin_fminl : Builtin<"LdLdLd", "Fnc">; +def __builtin_hypot : Builtin<"ddd", "Fne">; +def __builtin_hypotf : Builtin<"fff", "Fne">; +def __builtin_hypotl : Builtin<"LdLdLd", "Fne">; +def __builtin_ilogb : Builtin<"id", "Fne">; +def __builtin_ilogbf : Builtin<"if", "Fne">; +def __builtin_ilogbl : Builtin<"iLd", "Fne">; +def __builtin_lgamma : Builtin<"dd", "Fn">; +def __builtin_lgammaf : Builtin<"ff", "Fn">; +def __builtin_lgammal : Builtin<"LdLd", "Fn">; +def __builtin_llrint : Builtin<"LLid", "Fne">; +def __builtin_llrintf : Builtin<"LLif", "Fne">; +def __builtin_llrintl : Builtin<"LLiLd", "Fne">; +def __builtin_llround : Builtin<"LLid", "Fne">; +def __builtin_llroundf : Builtin<"LLif", "Fne">; +def __builtin_llroundl : Builtin<"LLiLd", "Fne">; +def __builtin_log : Builtin<"dd", "Fne">; +def __builtin_log10 : Builtin<"dd", "Fne">; +def __builtin_log10f : Builtin<"ff", "Fne">; +def __builtin_log10f16 : Builtin<"hh", "Fne">; +def __builtin_log10l : Builtin<"LdLd", "Fne">; +def __builtin_log1p : Builtin<"dd", "Fne">; +def __builtin_log1pf : Builtin<"ff", "Fne">; +def __builtin_log1pl : Builtin<"LdLd", "Fne">; +def __builtin_log2 : Builtin<"dd", "Fne">; +def __builtin_log2f : Builtin<"ff", "Fne">; +def __builtin_log2f16 : Builtin<"hh", "Fne">; +def __builtin_log2l : Builtin<"LdLd", "Fne">; +def __builtin_logb : Builtin<"dd", "Fne">; +def __builtin_logbf : Builtin<"ff", "Fne">; +def __builtin_logbl : Builtin<"LdLd", "Fne">; +def __builtin_logf : Builtin<"ff", "Fne">; +def __builtin_logf16 : Builtin<"hh", "Fne">; +def __builtin_logl : Builtin<"LdLd", "Fne">; +def __builtin_lrint : Builtin<"Lid", "Fne">; +def __builtin_lrintf : Builtin<"Lif", "Fne">; +def __builtin_lrintl : Builtin<"LiLd", "Fne">; +def __builtin_lround : Builtin<"Lid", "Fne">; +def __builtin_lroundf : Builtin<"Lif", "Fne">; +def __builtin_lroundl : Builtin<"LiLd", "Fne">; +def __builtin_nearbyint : Builtin<"dd", "Fnc">; +def __builtin_nearbyintf : Builtin<"ff", "Fnc">; +def __builtin_nearbyintl : Builtin<"LdLd", "Fnc">; +def __builtin_nextafter : Builtin<"ddd", "Fne">; +def __builtin_nextafterf : Builtin<"fff", "Fne">; +def __builtin_nextafterl : Builtin<"LdLdLd", "Fne">; +def __builtin_nexttoward : Builtin<"ddLd", "Fne">; +def __builtin_nexttowardf : Builtin<"ffLd", "Fne">; +def __builtin_nexttowardl : Builtin<"LdLdLd", "Fne">; +def __builtin_remainder : Builtin<"ddd", "Fne">; +def __builtin_remainderf : Builtin<"fff", "Fne">; +def __builtin_remainderl : Builtin<"LdLdLd", "Fne">; +def __builtin_remquo : Builtin<"dddi*", "Fn">; +def __builtin_remquof : Builtin<"fffi*", "Fn">; +def __builtin_remquol : Builtin<"LdLdLdi*", "Fn">; +def __builtin_rint : Builtin<"dd", "Fnc">; +def __builtin_rintf : Builtin<"ff", "Fnc">; +def __builtin_rintf16 : Builtin<"hh", "Fnc">; +def __builtin_rintl : Builtin<"LdLd", "Fnc">; +def __builtin_round : Builtin<"dd", "Fnc">; +def __builtin_roundf : Builtin<"ff", "Fnc">; +def __builtin_roundf16 : Builtin<"hh", "Fnc">; +def __builtin_roundl : Builtin<"LdLd", "Fnc">; +def __builtin_scalbln : Builtin<"ddLi", "Fne">; +def __builtin_scalblnf : Builtin<"ffLi", "Fne">; +def __builtin_scalblnl : Builtin<"LdLdLi", "Fne">; +def __builtin_scalbn : Builtin<"ddi", "Fne">; +def __builtin_scalbnf : Builtin<"ffi", "Fne">; +def __builtin_scalbnl : Builtin<"LdLdi", "Fne">; +def __builtin_sin : Builtin<"dd", "Fne">; +def __builtin_sinf : Builtin<"ff", "Fne">; +def __builtin_sinf16 : Builtin<"hh", "Fne">; +def __builtin_sinh : Builtin<"dd", "Fne">; +def __builtin_sinhf : Builtin<"ff", "Fne">; +def __builtin_sinhl : Builtin<"LdLd", "Fne">; +def __builtin_sinl : Builtin<"LdLd", "Fne">; +def __builtin_sqrt : Builtin<"dd", "Fne">; +def __builtin_sqrtf : Builtin<"ff", "Fne">; +def __builtin_sqrtf16 : Builtin<"hh", "Fne">; +def __builtin_sqrtl : Builtin<"LdLd", "Fne">; +def __builtin_tan : Builtin<"dd", "Fne">; +def __builtin_tanf : Builtin<"ff", "Fne">; +def __builtin_tanh : Builtin<"dd", "Fne">; +def __builtin_tanhf : Builtin<"ff", "Fne">; +def __builtin_tanhl : Builtin<"LdLd", "Fne">; +def __builtin_tanl : Builtin<"LdLd", "Fne">; +def __builtin_tgamma : Builtin<"dd", "Fne">; +def __builtin_tgammaf : Builtin<"ff", "Fne">; +def __builtin_tgammal : Builtin<"LdLd", "Fne">; +def __builtin_trunc : Builtin<"dd", "Fnc">; +def __builtin_truncf : Builtin<"ff", "Fnc">; +def __builtin_truncl : Builtin<"LdLd", "Fnc">; +def __builtin_truncf16 : Builtin<"hh", "Fnc">; + +// Access to floating point environment +def __builtin_flt_rounds : Builtin<"i", "n">; + +// C99 complex builtins +def __builtin_cabs : Builtin<"dXd", "Fne">; +def __builtin_cabsf : Builtin<"fXf", "Fne">; +def __builtin_cabsl : Builtin<"LdXLd", "Fne">; +def __builtin_cacos : Builtin<"XdXd", "Fne">; +def __builtin_cacosf : Builtin<"XfXf", "Fne">; +def __builtin_cacosh : Builtin<"XdXd", "Fne">; +def __builtin_cacoshf : Builtin<"XfXf", "Fne">; +def __builtin_cacoshl : Builtin<"XLdXLd", "Fne">; +def __builtin_cacosl : Builtin<"XLdXLd", "Fne">; +def __builtin_carg : Builtin<"dXd", "Fne">; +def __builtin_cargf : Builtin<"fXf", "Fne">; +def __builtin_cargl : Builtin<"LdXLd", "Fne">; +def __builtin_casin : Builtin<"XdXd", "Fne">; +def __builtin_casinf : Builtin<"XfXf", "Fne">; +def __builtin_casinh : Builtin<"XdXd", "Fne">; +def __builtin_casinhf : Builtin<"XfXf", "Fne">; +def __builtin_casinhl : Builtin<"XLdXLd", "Fne">; +def __builtin_casinl : Builtin<"XLdXLd", "Fne">; +def __builtin_catan : Builtin<"XdXd", "Fne">; +def __builtin_catanf : Builtin<"XfXf", "Fne">; +def __builtin_catanh : Builtin<"XdXd", "Fne">; +def __builtin_catanhf : Builtin<"XfXf", "Fne">; +def __builtin_catanhl : Builtin<"XLdXLd", "Fne">; +def __builtin_catanl : Builtin<"XLdXLd", "Fne">; +def __builtin_ccos : Builtin<"XdXd", "Fne">; +def __builtin_ccosf : Builtin<"XfXf", "Fne">; +def __builtin_ccosl : Builtin<"XLdXLd", "Fne">; +def __builtin_ccosh : Builtin<"XdXd", "Fne">; +def __builtin_ccoshf : Builtin<"XfXf", "Fne">; +def __builtin_ccoshl : Builtin<"XLdXLd", "Fne">; +def __builtin_cexp : Builtin<"XdXd", "Fne">; +def __builtin_cexpf : Builtin<"XfXf", "Fne">; +def __builtin_cexpl : Builtin<"XLdXLd", "Fne">; +def __builtin_cimag : Builtin<"dXd", "Fnc">; +def __builtin_cimagf : Builtin<"fXf", "Fnc">; +def __builtin_cimagl : Builtin<"LdXLd", "Fnc">; +def __builtin_conj : Builtin<"XdXd", "Fnc">; +def __builtin_conjf : Builtin<"XfXf", "Fnc">; +def __builtin_conjl : Builtin<"XLdXLd", "Fnc">; +def __builtin_clog : Builtin<"XdXd", "Fne">; +def __builtin_clogf : Builtin<"XfXf", "Fne">; +def __builtin_clogl : Builtin<"XLdXLd", "Fne">; +def __builtin_cproj : Builtin<"XdXd", "Fnc">; +def __builtin_cprojf : Builtin<"XfXf", "Fnc">; +def __builtin_cprojl : Builtin<"XLdXLd", "Fnc">; +def __builtin_cpow : Builtin<"XdXdXd", "Fne">; +def __builtin_cpowf : Builtin<"XfXfXf", "Fne">; +def __builtin_cpowl : Builtin<"XLdXLdXLd", "Fne">; +def __builtin_creal : Builtin<"dXd", "Fnc">; +def __builtin_crealf : Builtin<"fXf", "Fnc">; +def __builtin_creall : Builtin<"LdXLd", "Fnc">; +def __builtin_csin : Builtin<"XdXd", "Fne">; +def __builtin_csinf : Builtin<"XfXf", "Fne">; +def __builtin_csinl : Builtin<"XLdXLd", "Fne">; +def __builtin_csinh : Builtin<"XdXd", "Fne">; +def __builtin_csinhf : Builtin<"XfXf", "Fne">; +def __builtin_csinhl : Builtin<"XLdXLd", "Fne">; +def __builtin_csqrt : Builtin<"XdXd", "Fne">; +def __builtin_csqrtf : Builtin<"XfXf", "Fne">; +def __builtin_csqrtl : Builtin<"XLdXLd", "Fne">; +def __builtin_ctan : Builtin<"XdXd", "Fne">; +def __builtin_ctanf : Builtin<"XfXf", "Fne">; +def __builtin_ctanl : Builtin<"XLdXLd", "Fne">; +def __builtin_ctanh : Builtin<"XdXd", "Fne">; +def __builtin_ctanhf : Builtin<"XfXf", "Fne">; +def __builtin_ctanhl : Builtin<"XLdXLd", "Fne">; + +// FP Comparisons. +def __builtin_isgreater : Builtin<"i.", "Fnct">; +def __builtin_isgreaterequal : Builtin<"i.", "Fnct">; +def __builtin_isless : Builtin<"i.", "Fnct">; +def __builtin_islessequal : Builtin<"i.", "Fnct">; +def __builtin_islessgreater : Builtin<"i.", "Fnct">; +def __builtin_isunordered : Builtin<"i.", "Fnct">; + +// Unary FP classification +def __builtin_fpclassify : Builtin<"iiiiii.", "Fnct">; +def __builtin_isfinite : Builtin<"i.", "Fnct">; +def __builtin_isinf : Builtin<"i.", "Fnct">; +def __builtin_isinf_sign : Builtin<"i.", "Fnct">; +def __builtin_isnan : Builtin<"i.", "Fnct">; +def __builtin_isnormal : Builtin<"i.", "Fnct">; + +// FP signbit builtins +def __builtin_signbit : Builtin<"i.", "Fnct">; +def __builtin_signbitf : Builtin<"if", "Fnc">; +def __builtin_signbitl : Builtin<"iLd", "Fnc">; + +// Special FP builtins. +def __builtin_canonicalize : Builtin<"dd", "nc">; +def __builtin_canonicalizef : Builtin<"ff", "nc">; +def __builtin_canonicalizef16 : Builtin<"hh", "nc">; +def __builtin_canonicalizel : Builtin<"LdLd", "nc">; + +// Builtins for arithmetic. +def __builtin_clzs : Builtin<"iUs", "nc">; +def __builtin_clz : Builtin<"iUi", "nc">; +def __builtin_clzl : Builtin<"iULi", "nc">; +def __builtin_clzll : Builtin<"iULLi", "nc">; +// TODO: int clzimax(uintmax_t) +def __builtin_ctzs : Builtin<"iUs", "nc">; +def __builtin_ctz : Builtin<"iUi", "nc">; +def __builtin_ctzl : Builtin<"iULi", "nc">; +def __builtin_ctzll : Builtin<"iULLi", "nc">; +// TODO: int ctzimax(uintmax_t) +def __builtin_ffs : Builtin<"ii", "Fnc">; +def __builtin_ffsl : Builtin<"iLi", "Fnc">; +def __builtin_ffsll : Builtin<"iLLi", "Fnc">; +def __builtin_parity : Builtin<"iUi", "nc">; +def __builtin_parityl : Builtin<"iULi", "nc">; +def __builtin_parityll : Builtin<"iULLi", "nc">; +def __builtin_popcount : Builtin<"iUi", "nc">; +def __builtin_popcountl : Builtin<"iULi", "nc">; +def __builtin_popcountll : Builtin<"iULLi", "nc">; +def __builtin_clrsb : Builtin<"ii", "nc">; +def __builtin_clrsbl : Builtin<"iLi", "nc">; +def __builtin_clrsbll : Builtin<"iLLi", "nc">; + +// The following builtins rely on that char == 8 bits, short == 16 bits and that +// there exists native types on the target that are 32- and 64-bits wide, unless +// these conditions are fulfilled these builtins will operate on a not intended +// bitwidth. +def __builtin_bswap16 : Builtin<"UsUs", "nc">; +def __builtin_bswap32 : Builtin<"UZiUZi", "nc">; +def __builtin_bswap64 : Builtin<"UWiUWi", "nc">; + +def __builtin_bitreverse8 : Builtin<"UcUc", "nc">; +def __builtin_bitreverse16 : Builtin<"UsUs", "nc">; +def __builtin_bitreverse32 : Builtin<"UZiUZi", "nc">; +def __builtin_bitreverse64 : Builtin<"UWiUWi", "nc">; + +def __builtin_rotateleft8 : Builtin<"UcUcUc", "nc">; +def __builtin_rotateleft16 : Builtin<"UsUsUs", "nc">; +def __builtin_rotateleft32 : Builtin<"UZiUZiUZi", "nc">; +def __builtin_rotateleft64 : Builtin<"UWiUWiUWi", "nc">; +def __builtin_rotateright8 : Builtin<"UcUcUc", "nc">; +def __builtin_rotateright16 : Builtin<"UsUsUs", "nc">; +def __builtin_rotateright32 : Builtin<"UZiUZiUZi", "nc">; +def __builtin_rotateright64 : Builtin<"UWiUWiUWi", "nc">; + +// Random GCC builtins +def __builtin_constant_p : Builtin<"i.", "nctu">; +def __builtin_classify_type : Builtin<"i.", "nctu">; +def __builtin___CFStringMakeConstantString : Builtin<"FC*cC*", "nc">; +def __builtin___NSStringMakeConstantString : Builtin<"FC*cC*", "nc">; +def __builtin_va_start : Builtin<"vA.", "nt">; +def __builtin_va_end : Builtin<"vA", "n">; +def __builtin_va_copy : Builtin<"vAA", "n">; +def __builtin_stdarg_start : Builtin<"vA.", "nt">; +def __builtin_assume_aligned : Builtin<"v*vC*z.", "nc">; +def __builtin_bcmp : Builtin<"ivC*vC*z", "Fn">; +def __builtin_bcopy : Builtin<"vv*v*z", "n">; +def __builtin_bzero : Builtin<"vv*z", "nF">; +def __builtin_fprintf : Builtin<"iP*cC*.", "Fp:1:">; +def __builtin_memchr : Builtin<"v*vC*iz", "nF">; +def __builtin_memcmp : Builtin<"ivC*vC*z", "nF">; +def __builtin_memcpy : Builtin<"v*v*vC*z", "nF">; +def __builtin_memcpy_inline : Builtin<"vv*vC*Iz", "nt">; +def __builtin_memmove : Builtin<"v*v*vC*z", "nF">; +def __builtin_mempcpy : Builtin<"v*v*vC*z", "nF">; +def __builtin_memset : Builtin<"v*v*iz", "nF">; +def __builtin_printf : Builtin<"icC*.", "Fp:0:">; +def __builtin_stpcpy : Builtin<"c*c*cC*", "nF">; +def __builtin_stpncpy : Builtin<"c*c*cC*z", "nF">; +def __builtin_strcasecmp : Builtin<"icC*cC*", "nF">; +def __builtin_strcat : Builtin<"c*c*cC*", "nF">; +def __builtin_strchr : Builtin<"c*cC*i", "nF">; +def __builtin_strcmp : Builtin<"icC*cC*", "nF">; +def __builtin_strcpy : Builtin<"c*c*cC*", "nF">; +def __builtin_strcspn : Builtin<"zcC*cC*", "nF">; +def __builtin_strdup : Builtin<"c*cC*", "nF">; +def __builtin_strlen : Builtin<"zcC*", "nF">; +def __builtin_strncasecmp : Builtin<"icC*cC*z", "nF">; +def __builtin_strncat : Builtin<"c*c*cC*z", "nF">; +def __builtin_strncmp : Builtin<"icC*cC*z", "nF">; +def __builtin_strncpy : Builtin<"c*c*cC*z", "nF">; +def __builtin_strndup : Builtin<"c*cC*z", "nF">; +def __builtin_strpbrk : Builtin<"c*cC*cC*", "nF">; +def __builtin_strrchr : Builtin<"c*cC*i", "nF">; +def __builtin_strspn : Builtin<"zcC*cC*", "nF">; +def __builtin_strstr : Builtin<"c*cC*cC*", "nF">; +def __builtin_wcschr : Builtin<"w*wC*w", "nF">; +def __builtin_wcscmp : Builtin<"iwC*wC*", "nF">; +def __builtin_wcslen : Builtin<"zwC*", "nF">; +def __builtin_wcsncmp : Builtin<"iwC*wC*z", "nF">; +def __builtin_wmemchr : Builtin<"w*wC*wz", "nF">; +def __builtin_wmemcmp : Builtin<"iwC*wC*z", "nF">; +def __builtin_wmemcpy : Builtin<"w*w*wC*z", "nF">; +def __builtin_wmemmove : Builtin<"w*w*wC*z", "nF">; +def __builtin_return_address : Builtin<"v*IUi", "n">; +def __builtin_extract_return_addr : Builtin<"v*v*", "n">; +def __builtin_frame_address : Builtin<"v*IUi", "n">; +def __builtin___clear_cache : Builtin<"vc*c*", "n">; +def __builtin_setjmp : Builtin<"iv**", "j">; +def __builtin_longjmp : Builtin<"vv**i", "r">; +def __builtin_unwind_init : Builtin<"v", "">; +def __builtin_eh_return_data_regno : Builtin<"iIi", "nc">; +def __builtin_snprintf : Builtin<"ic*zcC*.", "nFp:2:">; +def __builtin_vsprintf : Builtin<"ic*cC*a", "nFP:1:">; +def __builtin_vsnprintf : Builtin<"ic*zcC*a", "nFP:2:">; +def __builtin_thread_pointer : Builtin<"v*", "nc">; +def __builtin_launder : Builtin<"v*v*", "nt">; +def __builtin_is_constant_evaluated : LangBuiltin<"b", "n", CxxLang>; + +// GCC exception builtins +def __builtin_eh_return : Builtin<"vzv*", "r">; // FIXME: Takes intptr_t, not size_t! +def __builtin_frob_return_addr : Builtin<"v*v*", "n">; +def __builtin_dwarf_cfa : Builtin<"v*", "n">; +def __builtin_init_dwarf_reg_size_table : Builtin<"vv*", "n">; +def __builtin_dwarf_sp_column : Builtin<"Ui", "n">; +def __builtin_extend_pointer : Builtin<"ULLiv*", "n">; // _Unwind_Word == uint64_t + +// GCC Object size checking builtins +def __builtin_object_size : Builtin<"zvC*i", "nu">; +def __builtin_dynamic_object_size : Builtin<"zvC*i", "nu">; // Clang only. +def __builtin___memcpy_chk : Builtin<"v*v*vC*zz", "nF">; +def __builtin___memccpy_chk : Builtin<"v*v*vC*izz", "nF">; +def __builtin___memmove_chk : Builtin<"v*v*vC*zz", "nF">; +def __builtin___mempcpy_chk : Builtin<"v*v*vC*zz", "nF">; +def __builtin___memset_chk : Builtin<"v*v*izz", "nF">; +def __builtin___stpcpy_chk : Builtin<"c*c*cC*z", "nF">; +def __builtin___strcat_chk : Builtin<"c*c*cC*z", "nF">; +def __builtin___strcpy_chk : Builtin<"c*c*cC*z", "nF">; +def __builtin___strlcat_chk : Builtin<"zc*cC*zz", "nF">; +def __builtin___strlcpy_chk : Builtin<"zc*cC*zz", "nF">; +def __builtin___strncat_chk : Builtin<"c*c*cC*zz", "nF">; +def __builtin___strncpy_chk : Builtin<"c*c*cC*zz", "nF">; +def __builtin___stpncpy_chk : Builtin<"c*c*cC*zz", "nF">; +def __builtin___snprintf_chk : Builtin<"ic*zizcC*.", "Fp:4:">; +def __builtin___sprintf_chk : Builtin<"ic*izcC*.", "Fp:3:">; +def __builtin___vsnprintf_chk : Builtin<"ic*zizcC*a", "FP:4:">; +def __builtin___vsprintf_chk : Builtin<"ic*izcC*a", "FP:3:">; +def __builtin___fprintf_chk : Builtin<"iP*icC*.", "Fp:2:">; +def __builtin___printf_chk : Builtin<"iicC*.", "Fp:1:">; +def __builtin___vfprintf_chk : Builtin<"iP*icC*a", "FP:2:">; +def __builtin___vprintf_chk : Builtin<"iicC*a", "FP:1:">; + +def __builtin_unpredictable : Builtin<"LiLi", "nc">; +def __builtin_expect : Builtin<"LiLiLi", "nc">; +def __builtin_prefetch : Builtin<"vvC*.", "nc">; +def __builtin_readcyclecounter : Builtin<"ULLi", "n">; +def __builtin_trap : Builtin<"v", "nr">; +def __builtin_debugtrap : Builtin<"v", "n">; +def __builtin_unreachable : Builtin<"v", "nr">; +def __builtin_shufflevector : Builtin<"v.", "nct">; +def __builtin_convertvector : Builtin<"v.", "nct">; +def __builtin_alloca : Builtin<"v*z", "Fn">; +def __builtin_alloca_with_align : Builtin<"v*zIz", "Fn">; +def __builtin_call_with_static_chain : Builtin<"v.", "nt">; + +def __builtin_matrix_transpose : Builtin<"v.", "nFt">; + +// "Overloaded" Atomic operator builtins. These are overloaded to support data +// types of i8, i16, i32, i64, and i128. The front-end sees calls to the +// non-suffixed version of these (which has a bogus type) and transforms them to +// the right overloaded version in Sema (plus casts). + +// FIXME: These assume that char -> i8, short -> i16, int -> i32, +// long long -> i64. + +def __sync_fetch_and_add : Builtin<"v.", "t">; +def __sync_fetch_and_add_1 : Builtin<"ccD*c.", "nt">; +def __sync_fetch_and_add_2 : Builtin<"ssD*s.", "nt">; +def __sync_fetch_and_add_4 : Builtin<"iiD*i.", "nt">; +def __sync_fetch_and_add_8 : Builtin<"LLiLLiD*LLi.", "nt">; +def __sync_fetch_and_add_16 : Builtin<"LLLiLLLiD*LLLi.", "nt">; + +def __sync_fetch_and_sub : Builtin<"v.", "t">; +def __sync_fetch_and_sub_1 : Builtin<"ccD*c.", "nt">; +def __sync_fetch_and_sub_2 : Builtin<"ssD*s.", "nt">; +def __sync_fetch_and_sub_4 : Builtin<"iiD*i.", "nt">; +def __sync_fetch_and_sub_8 : Builtin<"LLiLLiD*LLi.", "nt">; +def __sync_fetch_and_sub_16 : Builtin<"LLLiLLLiD*LLLi.", "nt">; + +def __sync_fetch_and_or : Builtin<"v.", "t">; +def __sync_fetch_and_or_1 : Builtin<"ccD*c.", "nt">; +def __sync_fetch_and_or_2 : Builtin<"ssD*s.", "nt">; +def __sync_fetch_and_or_4 : Builtin<"iiD*i.", "nt">; +def __sync_fetch_and_or_8 : Builtin<"LLiLLiD*LLi.", "nt">; +def __sync_fetch_and_or_16 : Builtin<"LLLiLLLiD*LLLi.", "nt">; + +def __sync_fetch_and_and : Builtin<"v.", "t">; +def __sync_fetch_and_and_1 : Builtin<"ccD*c.", "tn">; +def __sync_fetch_and_and_2 : Builtin<"ssD*s.", "tn">; +def __sync_fetch_and_and_4 : Builtin<"iiD*i.", "tn">; +def __sync_fetch_and_and_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_fetch_and_and_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_fetch_and_xor : Builtin<"v.", "t">; +def __sync_fetch_and_xor_1 : Builtin<"ccD*c.", "tn">; +def __sync_fetch_and_xor_2 : Builtin<"ssD*s.", "tn">; +def __sync_fetch_and_xor_4 : Builtin<"iiD*i.", "tn">; +def __sync_fetch_and_xor_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_fetch_and_xor_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_fetch_and_nand : Builtin<"v.", "t">; +def __sync_fetch_and_nand_1 : Builtin<"ccD*c.", "tn">; +def __sync_fetch_and_nand_2 : Builtin<"ssD*s.", "tn">; +def __sync_fetch_and_nand_4 : Builtin<"iiD*i.", "tn">; +def __sync_fetch_and_nand_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_fetch_and_nand_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_add_and_fetch : Builtin<"v.", "t">; +def __sync_add_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_add_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_add_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_add_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_add_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_sub_and_fetch : Builtin<"v.", "t">; +def __sync_sub_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_sub_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_sub_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_sub_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_sub_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_or_and_fetch : Builtin<"v.", "t">; +def __sync_or_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_or_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_or_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_or_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_or_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_and_and_fetch : Builtin<"v.", "t">; +def __sync_and_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_and_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_and_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_and_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_and_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_xor_and_fetch : Builtin<"v.", "t">; +def __sync_xor_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_xor_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_xor_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_xor_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_xor_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_nand_and_fetch : Builtin<"v.", "t">; +def __sync_nand_and_fetch_1 : Builtin<"ccD*c.", "tn">; +def __sync_nand_and_fetch_2 : Builtin<"ssD*s.", "tn">; +def __sync_nand_and_fetch_4 : Builtin<"iiD*i.", "tn">; +def __sync_nand_and_fetch_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_nand_and_fetch_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_bool_compare_and_swap : Builtin<"v.", "t">; +def __sync_bool_compare_and_swap_1 : Builtin<"bcD*cc.", "tn">; +def __sync_bool_compare_and_swap_2 : Builtin<"bsD*ss.", "tn">; +def __sync_bool_compare_and_swap_4 : Builtin<"biD*ii.", "tn">; +def __sync_bool_compare_and_swap_8 : Builtin<"bLLiD*LLiLLi.", "tn">; +def __sync_bool_compare_and_swap_16 : Builtin<"bLLLiD*LLLiLLLi.", "tn">; + +def __sync_val_compare_and_swap : Builtin<"v.", "t">; +def __sync_val_compare_and_swap_1 : Builtin<"ccD*cc.", "tn">; +def __sync_val_compare_and_swap_2 : Builtin<"ssD*ss.", "tn">; +def __sync_val_compare_and_swap_4 : Builtin<"iiD*ii.", "tn">; +def __sync_val_compare_and_swap_8 : Builtin<"LLiLLiD*LLiLLi.", "tn">; +def __sync_val_compare_and_swap_16 : Builtin<"LLLiLLLiD*LLLiLLLi.", "tn">; + +def __sync_lock_test_and_set : Builtin<"v.", "t">; +def __sync_lock_test_and_set_1 : Builtin<"ccD*c.", "tn">; +def __sync_lock_test_and_set_2 : Builtin<"ssD*s.", "tn">; +def __sync_lock_test_and_set_4 : Builtin<"iiD*i.", "tn">; +def __sync_lock_test_and_set_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_lock_test_and_set_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +def __sync_lock_release : Builtin<"v.", "t">; +def __sync_lock_release_1 : Builtin<"vcD*.", "tn">; +def __sync_lock_release_2 : Builtin<"vsD*.", "tn">; +def __sync_lock_release_4 : Builtin<"viD*.", "tn">; +def __sync_lock_release_8 : Builtin<"vLLiD*.", "tn">; +def __sync_lock_release_16 : Builtin<"vLLLiD*.", "tn">; + +def __sync_swap : Builtin<"v.", "t">; +def __sync_swap_1 : Builtin<"ccD*c.", "tn">; +def __sync_swap_2 : Builtin<"ssD*s.", "tn">; +def __sync_swap_4 : Builtin<"iiD*i.", "tn">; +def __sync_swap_8 : Builtin<"LLiLLiD*LLi.", "tn">; +def __sync_swap_16 : Builtin<"LLLiLLLiD*LLLi.", "tn">; + +// Some of our atomics builtins are handled by AtomicExpr rather than +// as normal builtin CallExprs. This macro is used for such builtins. + +// C11 _Atomic operations for . +let Atomic = 1 in { + def __c11_atomic_init : Builtin<"v.", "t">; + def __c11_atomic_load : Builtin<"v.", "t">; + def __c11_atomic_store : Builtin<"v.", "t">; + def __c11_atomic_exchange : Builtin<"v.", "t">; + def __c11_atomic_compare_exchange_strong : Builtin<"v.", "t">; + def __c11_atomic_compare_exchange_weak : Builtin<"v.", "t">; + def __c11_atomic_fetch_add : Builtin<"v.", "t">; + def __c11_atomic_fetch_sub : Builtin<"v.", "t">; + def __c11_atomic_fetch_and : Builtin<"v.", "t">; + def __c11_atomic_fetch_or : Builtin<"v.", "t">; + def __c11_atomic_fetch_xor : Builtin<"v.", "t">; + def __c11_atomic_fetch_max : Builtin<"v.", "t">; + def __c11_atomic_fetch_min : Builtin<"v.", "t">; +} +def __c11_atomic_thread_fence : Builtin<"vi", "n">; +def __c11_atomic_signal_fence : Builtin<"vi", "n">; +def __c11_atomic_is_lock_free : Builtin<"bz", "n">; + +// GNU atomic builtins. +let Atomic = 1 in { + def __atomic_load : Builtin<"v.", "t">; + def __atomic_load_n : Builtin<"v.", "t">; + def __atomic_store : Builtin<"v.", "t">; + def __atomic_store_n : Builtin<"v.", "t">; + def __atomic_exchange : Builtin<"v.", "t">; + def __atomic_exchange_n : Builtin<"v.", "t">; + def __atomic_compare_exchange : Builtin<"v.", "t">; + def __atomic_compare_exchange_n : Builtin<"v.", "t">; + def __atomic_fetch_add : Builtin<"v.", "t">; + def __atomic_fetch_sub : Builtin<"v.", "t">; + def __atomic_fetch_and : Builtin<"v.", "t">; + def __atomic_fetch_or : Builtin<"v.", "t">; + def __atomic_fetch_xor : Builtin<"v.", "t">; + def __atomic_fetch_nand : Builtin<"v.", "t">; + def __atomic_add_fetch : Builtin<"v.", "t">; + def __atomic_sub_fetch : Builtin<"v.", "t">; + def __atomic_and_fetch : Builtin<"v.", "t">; + def __atomic_or_fetch : Builtin<"v.", "t">; + def __atomic_xor_fetch : Builtin<"v.", "t">; + def __atomic_max_fetch : Builtin<"v.", "t">; + def __atomic_min_fetch : Builtin<"v.", "t">; + def __atomic_nand_fetch : Builtin<"v.", "t">; +} +def __atomic_test_and_set : Builtin<"bvD*i", "n">; +def __atomic_clear : Builtin<"vvD*i", "n">; +def __atomic_thread_fence : Builtin<"vi", "n">; +def __atomic_signal_fence : Builtin<"vi", "n">; +def __atomic_always_lock_free : Builtin<"bzvCD*", "n">; +def __atomic_is_lock_free : Builtin<"bzvCD*", "n">; + +// OpenCL 2.0 atomic builtins. +let Atomic = 1 in { + def __opencl_atomic_init : Builtin<"v.", "t">; + def __opencl_atomic_load : Builtin<"v.", "t">; + def __opencl_atomic_store : Builtin<"v.", "t">; + def __opencl_atomic_exchange : Builtin<"v.", "t">; + def __opencl_atomic_compare_exchange_strong : Builtin<"v.", "t">; + def __opencl_atomic_compare_exchange_weak : Builtin<"v.", "t">; + def __opencl_atomic_fetch_add : Builtin<"v.", "t">; + def __opencl_atomic_fetch_sub : Builtin<"v.", "t">; + def __opencl_atomic_fetch_and : Builtin<"v.", "t">; + def __opencl_atomic_fetch_or : Builtin<"v.", "t">; + def __opencl_atomic_fetch_xor : Builtin<"v.", "t">; + def __opencl_atomic_fetch_min : Builtin<"v.", "t">; + def __opencl_atomic_fetch_max : Builtin<"v.", "t">; + +// GCC does not support these, they are a Clang extension. + def __atomic_fetch_min : Builtin<"v.", "t">; + def __atomic_fetch_max : Builtin<"v.", "t">; + + +// Non-overloaded atomic builtins. +} +def __sync_synchronize : Builtin<"v", "n">; +// GCC does not support these, they are a Clang extension. +def __sync_fetch_and_min : Builtin<"iiD*i", "n">; +def __sync_fetch_and_max : Builtin<"iiD*i", "n">; +def __sync_fetch_and_umin : Builtin<"UiUiD*Ui", "n">; +def __sync_fetch_and_umax : Builtin<"UiUiD*Ui", "n">; + +// Random libc builtins. +def __builtin_abort : Builtin<"v", "Fnr">; +def __builtin_index : Builtin<"c*cC*i", "Fn">; +def __builtin_rindex : Builtin<"c*cC*i", "Fn">; + +// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399 +def __warn_memset_zero_len : Builtin<"v", "nU">; + +// Microsoft builtins. These are only active with -fms-extensions. +def _alloca : LangBuiltin<"v*z", "n", AllMSLanguages>; +def __annotation : LangBuiltin<"wC*.", "n", AllMSLanguages>; +def __assume : LangBuiltin<"vb", "n", AllMSLanguages>; +def _bittest : LangBuiltin<"UcNiC*Ni", "n", AllMSLanguages>; +def _bittestandcomplement : LangBuiltin<"UcNi*Ni", "n", AllMSLanguages>; +def _bittestandreset : LangBuiltin<"UcNi*Ni", "n", AllMSLanguages>; +def _bittestandset : LangBuiltin<"UcNi*Ni", "n", AllMSLanguages>; +def _bittest64 : LangBuiltin<"UcWiC*Wi", "n", AllMSLanguages>; +def _bittestandcomplement64 : LangBuiltin<"UcWi*Wi", "n", AllMSLanguages>; +def _bittestandreset64 : LangBuiltin<"UcWi*Wi", "n", AllMSLanguages>; +def _bittestandset64 : LangBuiltin<"UcWi*Wi", "n", AllMSLanguages>; +def _byteswap_ushort : LibraryBuiltin<"UsUs", "fnc", "stdlib.h", AllMSLanguages>; +def _byteswap_ulong : LibraryBuiltin<"UNiUNi", "fnc", "stdlib.h", AllMSLanguages>; +def _byteswap_uint64 : LibraryBuiltin<"ULLiULLi", "fnc", "stdlib.h", AllMSLanguages>; +def __debugbreak : LangBuiltin<"v", "n", AllMSLanguages>; +def __exception_code : LangBuiltin<"UNi", "n", AllMSLanguages>; +def _exception_code : LangBuiltin<"UNi", "n", AllMSLanguages>; +def __exception_info : LangBuiltin<"v*", "n", AllMSLanguages>; +def _exception_info : LangBuiltin<"v*", "n", AllMSLanguages>; +def __abnormal_termination : LangBuiltin<"i", "n", AllMSLanguages>; +def _abnormal_termination : LangBuiltin<"i", "n", AllMSLanguages>; +def __GetExceptionInfo : LangBuiltin<"v*.", "ntu", AllMSLanguages>; +def _InterlockedAnd8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedAnd16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedAnd : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _InterlockedCompareExchange8 : LangBuiltin<"ccD*cc", "n", AllMSLanguages>; +def _InterlockedCompareExchange16 : LangBuiltin<"ssD*ss", "n", AllMSLanguages>; +def _InterlockedCompareExchange : LangBuiltin<"NiNiD*NiNi", "n", AllMSLanguages>; +def _InterlockedCompareExchange64 : LangBuiltin<"LLiLLiD*LLiLLi", "n", AllMSLanguages>; +def _InterlockedCompareExchangePointer : LangBuiltin<"v*v*D*v*v*", "n", AllMSLanguages>; +def _InterlockedCompareExchangePointer_nf : LangBuiltin<"v*v*D*v*v*", "n", AllMSLanguages>; +def _InterlockedDecrement16 : LangBuiltin<"ssD*", "n", AllMSLanguages>; +def _InterlockedDecrement : LangBuiltin<"NiNiD*", "n", AllMSLanguages>; +def _InterlockedExchange : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _InterlockedExchange8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedExchange16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedExchangeAdd8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedExchangeAdd16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedExchangeAdd : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _InterlockedExchangePointer : LangBuiltin<"v*v*D*v*", "n", AllMSLanguages>; +def _InterlockedExchangeSub8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedExchangeSub16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedExchangeSub : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _InterlockedIncrement16 : LangBuiltin<"ssD*", "n", AllMSLanguages>; +def _InterlockedIncrement : LangBuiltin<"NiNiD*", "n", AllMSLanguages>; +def _InterlockedOr8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedOr16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedOr : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _InterlockedXor8 : LangBuiltin<"ccD*c", "n", AllMSLanguages>; +def _InterlockedXor16 : LangBuiltin<"ssD*s", "n", AllMSLanguages>; +def _InterlockedXor : LangBuiltin<"NiNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandreset : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandreset64 : LangBuiltin<"UcWiD*Wi", "n", AllMSLanguages>; +def _interlockedbittestandreset_acq : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandreset_nf : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandreset_rel : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandset : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandset64 : LangBuiltin<"UcWiD*Wi", "n", AllMSLanguages>; +def _interlockedbittestandset_acq : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandset_nf : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def _interlockedbittestandset_rel : LangBuiltin<"UcNiD*Ni", "n", AllMSLanguages>; +def __iso_volatile_load8 : LangBuiltin<"ccCD*", "n", AllMSLanguages>; +def __iso_volatile_load16 : LangBuiltin<"ssCD*", "n", AllMSLanguages>; +def __iso_volatile_load32 : LangBuiltin<"iiCD*", "n", AllMSLanguages>; +def __iso_volatile_load64 : LangBuiltin<"LLiLLiCD*", "n", AllMSLanguages>; +def __iso_volatile_store8 : LangBuiltin<"vcD*c", "n", AllMSLanguages>; +def __iso_volatile_store16 : LangBuiltin<"vsD*s", "n", AllMSLanguages>; +def __iso_volatile_store32 : LangBuiltin<"viD*i", "n", AllMSLanguages>; +def __iso_volatile_store64 : LangBuiltin<"vLLiD*LLi", "n", AllMSLanguages>; +def __noop : LangBuiltin<"i.", "n", AllMSLanguages>; +def __lzcnt16 : LangBuiltin<"UsUs", "nc", AllMSLanguages>; +def __lzcnt : LangBuiltin<"UiUi", "nc", AllMSLanguages>; +def __lzcnt64 : LangBuiltin<"UWiUWi", "nc", AllMSLanguages>; +def __popcnt16 : LangBuiltin<"UsUs", "nc", AllMSLanguages>; +def __popcnt : LangBuiltin<"UiUi", "nc", AllMSLanguages>; +def __popcnt64 : LangBuiltin<"UWiUWi", "nc", AllMSLanguages>; +def _ReturnAddress : LangBuiltin<"v*", "n", AllMSLanguages>; +def _rotl8 : LangBuiltin<"UcUcUc", "n", AllMSLanguages>; +def _rotl16 : LangBuiltin<"UsUsUc", "n", AllMSLanguages>; +def _rotl : LangBuiltin<"UiUii", "n", AllMSLanguages>; +def _lrotl : LangBuiltin<"ULiULii", "n", AllMSLanguages>; +def _rotl64 : LangBuiltin<"UWiUWii", "n", AllMSLanguages>; +def _rotr8 : LangBuiltin<"UcUcUc", "n", AllMSLanguages>; +def _rotr16 : LangBuiltin<"UsUsUc", "n", AllMSLanguages>; +def _rotr : LangBuiltin<"UiUii", "n", AllMSLanguages>; +def _lrotr : LangBuiltin<"ULiULii", "n", AllMSLanguages>; +def _rotr64 : LangBuiltin<"UWiUWii", "n", AllMSLanguages>; +def __va_start : LangBuiltin<"vc**.", "nt", AllMSLanguages>; +def __fastfail : LangBuiltin<"vUi", "nr", AllMSLanguages>; + +// Microsoft library builtins. +def _setjmpex : LibraryBuiltin<"iJ", "fj", "setjmpex.h", AllMSLanguages>; + +// C99 library functions +// C99 stdarg.h +def va_start : LibraryBuiltin<"vA.", "fn", "stdarg.h", AllLanguages>; +def va_end : LibraryBuiltin<"vA", "fn", "stdarg.h", AllLanguages>; +def va_copy : LibraryBuiltin<"vAA", "fn", "stdarg.h", AllLanguages>; +// C99 stdlib.h +def abort : LibraryBuiltin<"v", "fr", "stdlib.h", AllLanguages>; +def calloc : LibraryBuiltin<"v*zz", "f", "stdlib.h", AllLanguages>; +def exit : LibraryBuiltin<"vi", "fr", "stdlib.h", AllLanguages>; +def _Exit : LibraryBuiltin<"vi", "fr", "stdlib.h", AllLanguages>; +def malloc : LibraryBuiltin<"v*z", "f", "stdlib.h", AllLanguages>; +def realloc : LibraryBuiltin<"v*v*z", "f", "stdlib.h", AllLanguages>; +def strtod : LibraryBuiltin<"dcC*c**", "f", "stdlib.h", AllLanguages>; +def strtof : LibraryBuiltin<"fcC*c**", "f", "stdlib.h", AllLanguages>; +def strtold : LibraryBuiltin<"LdcC*c**", "f", "stdlib.h", AllLanguages>; +def strtol : LibraryBuiltin<"LicC*c**i", "f", "stdlib.h", AllLanguages>; +def strtoll : LibraryBuiltin<"LLicC*c**i", "f", "stdlib.h", AllLanguages>; +def strtoul : LibraryBuiltin<"ULicC*c**i", "f", "stdlib.h", AllLanguages>; +def strtoull : LibraryBuiltin<"ULLicC*c**i", "f", "stdlib.h", AllLanguages>; +// C99 string.h +def memcpy : LibraryBuiltin<"v*v*vC*z", "f", "string.h", AllLanguages>; +def memcmp : LibraryBuiltin<"ivC*vC*z", "f", "string.h", AllLanguages>; +def memmove : LibraryBuiltin<"v*v*vC*z", "f", "string.h", AllLanguages>; +def strcpy : LibraryBuiltin<"c*c*cC*", "f", "string.h", AllLanguages>; +def strncpy : LibraryBuiltin<"c*c*cC*z", "f", "string.h", AllLanguages>; +def strcmp : LibraryBuiltin<"icC*cC*", "f", "string.h", AllLanguages>; +def strncmp : LibraryBuiltin<"icC*cC*z", "f", "string.h", AllLanguages>; +def strcat : LibraryBuiltin<"c*c*cC*", "f", "string.h", AllLanguages>; +def strncat : LibraryBuiltin<"c*c*cC*z", "f", "string.h", AllLanguages>; +def strxfrm : LibraryBuiltin<"zc*cC*z", "f", "string.h", AllLanguages>; +def memchr : LibraryBuiltin<"v*vC*iz", "f", "string.h", AllLanguages>; +def strchr : LibraryBuiltin<"c*cC*i", "f", "string.h", AllLanguages>; +def strcspn : LibraryBuiltin<"zcC*cC*", "f", "string.h", AllLanguages>; +def strpbrk : LibraryBuiltin<"c*cC*cC*", "f", "string.h", AllLanguages>; +def strrchr : LibraryBuiltin<"c*cC*i", "f", "string.h", AllLanguages>; +def strspn : LibraryBuiltin<"zcC*cC*", "f", "string.h", AllLanguages>; +def strstr : LibraryBuiltin<"c*cC*cC*", "f", "string.h", AllLanguages>; +def strtok : LibraryBuiltin<"c*c*cC*", "f", "string.h", AllLanguages>; +def memset : LibraryBuiltin<"v*v*iz", "f", "string.h", AllLanguages>; +def strerror : LibraryBuiltin<"c*i", "f", "string.h", AllLanguages>; +def strlen : LibraryBuiltin<"zcC*", "f", "string.h", AllLanguages>; +// C99 stdio.h +// FIXME: This list is incomplete. +def printf : LibraryBuiltin<"icC*.", "fp:0:", "stdio.h", AllLanguages>; +def fprintf : LibraryBuiltin<"iP*cC*.", "fp:1:", "stdio.h", AllLanguages>; +def snprintf : LibraryBuiltin<"ic*zcC*.", "fp:2:", "stdio.h", AllLanguages>; +def sprintf : LibraryBuiltin<"ic*cC*.", "fp:1:", "stdio.h", AllLanguages>; +def vprintf : LibraryBuiltin<"icC*a", "fP:0:", "stdio.h", AllLanguages>; +def vfprintf : LibraryBuiltin<"iP*cC*a", "fP:1:", "stdio.h", AllLanguages>; +def vsnprintf : LibraryBuiltin<"ic*zcC*a", "fP:2:", "stdio.h", AllLanguages>; +def vsprintf : LibraryBuiltin<"ic*cC*a", "fP:1:", "stdio.h", AllLanguages>; +def scanf : LibraryBuiltin<"icC*R.", "fs:0:", "stdio.h", AllLanguages>; +def fscanf : LibraryBuiltin<"iP*RcC*R.", "fs:1:", "stdio.h", AllLanguages>; +def sscanf : LibraryBuiltin<"icC*RcC*R.", "fs:1:", "stdio.h", AllLanguages>; +def vscanf : LibraryBuiltin<"icC*Ra", "fS:0:", "stdio.h", AllLanguages>; +def vfscanf : LibraryBuiltin<"iP*RcC*Ra", "fS:1:", "stdio.h", AllLanguages>; +def vsscanf : LibraryBuiltin<"icC*RcC*Ra", "fS:1:", "stdio.h", AllLanguages>; +def fopen : LibraryBuiltin<"P*cC*cC*", "f", "stdio.h", AllLanguages>; +def fread : LibraryBuiltin<"zv*zzP*", "f", "stdio.h", AllLanguages>; +def fwrite : LibraryBuiltin<"zvC*zzP*", "f", "stdio.h", AllLanguages>; + +// C99 ctype.h +def isalnum : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isalpha : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isblank : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def iscntrl : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isdigit : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isgraph : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def islower : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isprint : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def ispunct : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isspace : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isupper : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def isxdigit : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def tolower : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +def toupper : LibraryBuiltin<"ii", "fnU", "ctype.h", AllLanguages>; +// C99 wchar.h +// FIXME: This list is incomplete. We should cover at least the functions that +// take format strings. +def wcschr : LibraryBuiltin<"w*wC*w", "f", "wchar.h", AllLanguages>; +def wcscmp : LibraryBuiltin<"iwC*wC*", "f", "wchar.h", AllLanguages>; +def wcslen : LibraryBuiltin<"zwC*", "f", "wchar.h", AllLanguages>; +def wcsncmp : LibraryBuiltin<"iwC*wC*z", "f", "wchar.h", AllLanguages>; +def wmemchr : LibraryBuiltin<"w*wC*wz", "f", "wchar.h", AllLanguages>; +def wmemcmp : LibraryBuiltin<"iwC*wC*z", "f", "wchar.h", AllLanguages>; +def wmemcpy : LibraryBuiltin<"w*w*wC*z", "f", "wchar.h", AllLanguages>; +def wmemmove : LibraryBuiltin<"w*w*wC*z", "f", "wchar.h", AllLanguages>; + +// C99 +// In some systems setjmp is a macro that expands to _setjmp. We undefine +// it here to avoid having two identical LIBBUILTIN entries. +def setjmp : LibraryBuiltin<"iJ", "fj", "setjmp.h", AllLanguages>; +def longjmp : LibraryBuiltin<"vJi", "fr", "setjmp.h", AllLanguages>; + +// Non-C library functions, active in GNU mode only. +// Functions with (returns_twice) attribute (marked as "j") are still active in +// all languages, because losing this attribute would result in miscompilation +// when these functions are used in non-GNU mode. PR16138. +def alloca : LibraryBuiltin<"v*z", "f", "stdlib.h", AllGnuLanguages>; +// POSIX string.h +def memccpy : LibraryBuiltin<"v*v*vC*iz", "f", "string.h", AllGnuLanguages>; +def mempcpy : LibraryBuiltin<"v*v*vC*z", "f", "string.h", AllGnuLanguages>; +def stpcpy : LibraryBuiltin<"c*c*cC*", "f", "string.h", AllGnuLanguages>; +def stpncpy : LibraryBuiltin<"c*c*cC*z", "f", "string.h", AllGnuLanguages>; +def strdup : LibraryBuiltin<"c*cC*", "f", "string.h", AllGnuLanguages>; +def strndup : LibraryBuiltin<"c*cC*z", "f", "string.h", AllGnuLanguages>; +// POSIX strings.h +def index : LibraryBuiltin<"c*cC*i", "f", "strings.h", AllGnuLanguages>; +def rindex : LibraryBuiltin<"c*cC*i", "f", "strings.h", AllGnuLanguages>; +def bzero : LibraryBuiltin<"vv*z", "f", "strings.h", AllGnuLanguages>; +def bcmp : LibraryBuiltin<"ivC*vC*z", "f", "strings.h", AllGnuLanguages>; +// In some systems str[n]casejmp is a macro that expands to _str[n]icmp. +// We undefine then here to avoid wrong name. +def strcasecmp : LibraryBuiltin<"icC*cC*", "f", "strings.h", AllGnuLanguages>; +def strncasecmp : LibraryBuiltin<"icC*cC*z", "f", "strings.h", AllGnuLanguages>; +// POSIX unistd.h +def _exit : LibraryBuiltin<"vi", "fr", "unistd.h", AllGnuLanguages>; +def vfork : LibraryBuiltin<"p", "fj", "unistd.h", AllLanguages>; +// POSIX pthread.h +def pthread_create : LibraryBuiltin<"", "fC<2,3>", "pthread.h", AllGnuLanguages>; + +// POSIX setjmp.h + +def _setjmp : LibraryBuiltin<"iJ", "fj", "setjmp.h", AllLanguages>; +def __sigsetjmp : LibraryBuiltin<"iSJi", "fj", "setjmp.h", AllLanguages>; +def sigsetjmp : LibraryBuiltin<"iSJi", "fj", "setjmp.h", AllLanguages>; +def savectx : LibraryBuiltin<"iJ", "fj", "setjmp.h", AllLanguages>; +def getcontext : LibraryBuiltin<"iK*", "fj", "setjmp.h", AllLanguages>; + +def _longjmp : LibraryBuiltin<"vJi", "fr", "setjmp.h", AllGnuLanguages>; +def siglongjmp : LibraryBuiltin<"vSJi", "fr", "setjmp.h", AllGnuLanguages>; +// non-standard but very common +def strlcpy : LibraryBuiltin<"zc*cC*z", "f", "string.h", AllGnuLanguages>; +def strlcat : LibraryBuiltin<"zc*cC*z", "f", "string.h", AllGnuLanguages>; +// id objc_msgSend(id, SEL, ...) +def objc_msgSend : LibraryBuiltin<"GGH.", "f", "objc/message.h", ObjcLang>; +// long double objc_msgSend_fpret(id self, SEL op, ...) +def objc_msgSend_fpret : LibraryBuiltin<"LdGH.", "f", "objc/message.h", ObjcLang>; +// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...) +def objc_msgSend_fp2ret : LibraryBuiltin<"XLdGH.", "f", "objc/message.h", ObjcLang>; +// void objc_msgSend_stret (id, SEL, ...) +def objc_msgSend_stret : LibraryBuiltin<"vGH.", "f", "objc/message.h", ObjcLang>; +// id objc_msgSendSuper(struct objc_super *super, SEL op, ...) +def objc_msgSendSuper : LibraryBuiltin<"GM*H.", "f", "objc/message.h", ObjcLang>; +// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...) +def objc_msgSendSuper_stret : LibraryBuiltin<"vM*H.", "f", "objc/message.h", ObjcLang>; +// id objc_getClass(const char *name) +def objc_getClass : LibraryBuiltin<"GcC*", "f", "objc/runtime.h", ObjcLang>; +// id objc_getMetaClass(const char *name) +def objc_getMetaClass : LibraryBuiltin<"GcC*", "f", "objc/runtime.h", ObjcLang>; +// void objc_enumerationMutation(id) +def objc_enumerationMutation : LibraryBuiltin<"vG", "f", "objc/runtime.h", ObjcLang>; + +// id objc_read_weak(id *location) +def objc_read_weak : LibraryBuiltin<"GG*", "f", "objc/objc-auto.h", ObjcLang>; +// id objc_assign_weak(id value, id *location) +def objc_assign_weak : LibraryBuiltin<"GGG*", "f", "objc/objc-auto.h", ObjcLang>; +// id objc_assign_ivar(id value, id dest, ptrdiff_t offset) +def objc_assign_ivar : LibraryBuiltin<"GGGY", "f", "objc/objc-auto.h", ObjcLang>; +// id objc_assign_global(id val, id *dest) +def objc_assign_global : LibraryBuiltin<"GGG*", "f", "objc/objc-auto.h", ObjcLang>; +// id objc_assign_strongCast(id val, id *dest +def objc_assign_strongCast : LibraryBuiltin<"GGG*", "f", "objc/objc-auto.h", ObjcLang>; + +// id objc_exception_extract(void *localExceptionData) +def objc_exception_extract : LibraryBuiltin<"Gv*", "f", "objc/objc-exception.h", ObjcLang>; +// void objc_exception_try_enter(void *localExceptionData) +def objc_exception_try_enter : LibraryBuiltin<"vv*", "f", "objc/objc-exception.h", ObjcLang>; +// void objc_exception_try_exit(void *localExceptionData) +def objc_exception_try_exit : LibraryBuiltin<"vv*", "f", "objc/objc-exception.h", ObjcLang>; +// int objc_exception_match(Class exceptionClass, id exception) +def objc_exception_match : LibraryBuiltin<"iGG", "f", "objc/objc-exception.h", ObjcLang>; +// void objc_exception_throw(id exception) +def objc_exception_throw : LibraryBuiltin<"vG", "f", "objc/objc-exception.h", ObjcLang>; + +// int objc_sync_enter(id obj) +def objc_sync_enter : LibraryBuiltin<"iG", "f", "objc/objc-sync.h", ObjcLang>; +// int objc_sync_exit(id obj) +def objc_sync_exit : LibraryBuiltin<"iG", "f", "objc/objc-sync.h", ObjcLang>; + +def __builtin_objc_memmove_collectable : Builtin<"v*v*vC*z", "nF">; + +// void NSLog(NSString *fmt, ...) +def NSLog : LibraryBuiltin<"vG.", "fp:0:", "Foundation/NSObjCRuntime.h", ObjcLang>; +// void NSLogv(NSString *fmt, va_list args) +def NSLogv : LibraryBuiltin<"vGa", "fP:0:", "Foundation/NSObjCRuntime.h", ObjcLang>; + +// Builtin math library functions +def atan2 : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def atan2f : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def atan2l : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def abs : LibraryBuiltin<"ii", "fnc", "stdlib.h", AllLanguages>; +def labs : LibraryBuiltin<"LiLi", "fnc", "stdlib.h", AllLanguages>; +def llabs : LibraryBuiltin<"LLiLLi", "fnc", "stdlib.h", AllLanguages>; + +def copysign : LibraryBuiltin<"ddd", "fnc", "math.h", AllLanguages>; +def copysignf : LibraryBuiltin<"fff", "fnc", "math.h", AllLanguages>; +def copysignl : LibraryBuiltin<"LdLdLd", "fnc", "math.h", AllLanguages>; + +def fabs : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def fabsf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def fabsl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +// Some systems define finitef as alias of _finitef. +def finite : LibraryBuiltin<"id", "fnc", "math.h", GnuLang>; +def finitef : LibraryBuiltin<"if", "fnc", "math.h", GnuLang>; +def finitel : LibraryBuiltin<"iLd", "fnc", "math.h", GnuLang>; +// glibc's math.h generates calls to __finite +def __finite : LibraryBuiltin<"id", "fnc", "math.h", AllLanguages>; +def __finitef : LibraryBuiltin<"if", "fnc", "math.h", AllLanguages>; +def __finitel : LibraryBuiltin<"iLd", "fnc", "math.h", AllLanguages>; + +def fmod : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def fmodf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def fmodl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def frexp : LibraryBuiltin<"ddi*", "fn", "math.h", AllLanguages>; +def frexpf : LibraryBuiltin<"ffi*", "fn", "math.h", AllLanguages>; +def frexpl : LibraryBuiltin<"LdLdi*", "fn", "math.h", AllLanguages>; + +def ldexp : LibraryBuiltin<"ddi", "fne", "math.h", AllLanguages>; +def ldexpf : LibraryBuiltin<"ffi", "fne", "math.h", AllLanguages>; +def ldexpl : LibraryBuiltin<"LdLdi", "fne", "math.h", AllLanguages>; + +def modf : LibraryBuiltin<"ddd*", "fn", "math.h", AllLanguages>; +def modff : LibraryBuiltin<"fff*", "fn", "math.h", AllLanguages>; +def modfl : LibraryBuiltin<"LdLdLd*", "fn", "math.h", AllLanguages>; + +def nan : LibraryBuiltin<"dcC*", "fUn", "math.h", AllLanguages>; +def nanf : LibraryBuiltin<"fcC*", "fUn", "math.h", AllLanguages>; +def nanl : LibraryBuiltin<"LdcC*", "fUn", "math.h", AllLanguages>; + +def pow : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def powf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def powl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def acos : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def acosf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def acosl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def acosh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def acoshf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def acoshl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def asin : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def asinf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def asinl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def asinh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def asinhf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def asinhl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def atan : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def atanf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def atanl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def atanh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def atanhf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def atanhl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def cbrt : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def cbrtf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def cbrtl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def ceil : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def ceilf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def ceill : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def cos : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def cosf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def cosl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def cosh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def coshf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def coshl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def erf : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def erff : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def erfl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def erfc : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def erfcf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def erfcl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def exp : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def expf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def expl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def exp2 : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def exp2f : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def exp2l : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def expm1 : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def expm1f : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def expm1l : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def fdim : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def fdimf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def fdiml : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def floor : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def floorf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def floorl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def fma : LibraryBuiltin<"dddd", "fne", "math.h", AllLanguages>; +def fmaf : LibraryBuiltin<"ffff", "fne", "math.h", AllLanguages>; +def fmal : LibraryBuiltin<"LdLdLdLd", "fne", "math.h", AllLanguages>; + +def fmax : LibraryBuiltin<"ddd", "fnc", "math.h", AllLanguages>; +def fmaxf : LibraryBuiltin<"fff", "fnc", "math.h", AllLanguages>; +def fmaxl : LibraryBuiltin<"LdLdLd", "fnc", "math.h", AllLanguages>; + +def fmin : LibraryBuiltin<"ddd", "fnc", "math.h", AllLanguages>; +def fminf : LibraryBuiltin<"fff", "fnc", "math.h", AllLanguages>; +def fminl : LibraryBuiltin<"LdLdLd", "fnc", "math.h", AllLanguages>; + +def hypot : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def hypotf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def hypotl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def ilogb : LibraryBuiltin<"id", "fne", "math.h", AllLanguages>; +def ilogbf : LibraryBuiltin<"if", "fne", "math.h", AllLanguages>; +def ilogbl : LibraryBuiltin<"iLd", "fne", "math.h", AllLanguages>; + +// POSIX math.h declares a global, signgam, that lgamma writes to, so these +// shouldn't have "e" or "c" attributes +def lgamma : LibraryBuiltin<"dd", "fn", "math.h", AllLanguages>; +def lgammaf : LibraryBuiltin<"ff", "fn", "math.h", AllLanguages>; +def lgammal : LibraryBuiltin<"LdLd", "fn", "math.h", AllLanguages>; + +def llrint : LibraryBuiltin<"LLid", "fne", "math.h", AllLanguages>; +def llrintf : LibraryBuiltin<"LLif", "fne", "math.h", AllLanguages>; +def llrintl : LibraryBuiltin<"LLiLd", "fne", "math.h", AllLanguages>; + +def llround : LibraryBuiltin<"LLid", "fne", "math.h", AllLanguages>; +def llroundf : LibraryBuiltin<"LLif", "fne", "math.h", AllLanguages>; +def llroundl : LibraryBuiltin<"LLiLd", "fne", "math.h", AllLanguages>; + +def log : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def logf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def logl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def log10 : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def log10f : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def log10l : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def log1p : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def log1pf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def log1pl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def log2 : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def log2f : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def log2l : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def logb : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def logbf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def logbl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def lrint : LibraryBuiltin<"Lid", "fne", "math.h", AllLanguages>; +def lrintf : LibraryBuiltin<"Lif", "fne", "math.h", AllLanguages>; +def lrintl : LibraryBuiltin<"LiLd", "fne", "math.h", AllLanguages>; + +def lround : LibraryBuiltin<"Lid", "fne", "math.h", AllLanguages>; +def lroundf : LibraryBuiltin<"Lif", "fne", "math.h", AllLanguages>; +def lroundl : LibraryBuiltin<"LiLd", "fne", "math.h", AllLanguages>; + +def nearbyint : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def nearbyintf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def nearbyintl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def nextafter : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def nextafterf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def nextafterl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def nexttoward : LibraryBuiltin<"ddLd", "fne", "math.h", AllLanguages>; +def nexttowardf : LibraryBuiltin<"ffLd", "fne", "math.h", AllLanguages>; +def nexttowardl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def remainder : LibraryBuiltin<"ddd", "fne", "math.h", AllLanguages>; +def remainderf : LibraryBuiltin<"fff", "fne", "math.h", AllLanguages>; +def remainderl : LibraryBuiltin<"LdLdLd", "fne", "math.h", AllLanguages>; + +def remquo : LibraryBuiltin<"dddi*", "fn", "math.h", AllLanguages>; +def remquof : LibraryBuiltin<"fffi*", "fn", "math.h", AllLanguages>; +def remquol : LibraryBuiltin<"LdLdLdi*", "fn", "math.h", AllLanguages>; + +def rint : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def rintf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def rintl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def round : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def roundf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def roundl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def scalbln : LibraryBuiltin<"ddLi", "fne", "math.h", AllLanguages>; +def scalblnf : LibraryBuiltin<"ffLi", "fne", "math.h", AllLanguages>; +def scalblnl : LibraryBuiltin<"LdLdLi", "fne", "math.h", AllLanguages>; + +def scalbn : LibraryBuiltin<"ddi", "fne", "math.h", AllLanguages>; +def scalbnf : LibraryBuiltin<"ffi", "fne", "math.h", AllLanguages>; +def scalbnl : LibraryBuiltin<"LdLdi", "fne", "math.h", AllLanguages>; + +def sin : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def sinf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def sinl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def sinh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def sinhf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def sinhl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def sqrt : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def sqrtf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def sqrtl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def tan : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def tanf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def tanl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def tanh : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def tanhf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def tanhl : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def tgamma : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def tgammaf : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; +def tgammal : LibraryBuiltin<"LdLd", "fne", "math.h", AllLanguages>; + +def trunc : LibraryBuiltin<"dd", "fnc", "math.h", AllLanguages>; +def truncf : LibraryBuiltin<"ff", "fnc", "math.h", AllLanguages>; +def truncl : LibraryBuiltin<"LdLd", "fnc", "math.h", AllLanguages>; + +def cabs : LibraryBuiltin<"dXd", "fne", "complex.h", AllLanguages>; +def cabsf : LibraryBuiltin<"fXf", "fne", "complex.h", AllLanguages>; +def cabsl : LibraryBuiltin<"LdXLd", "fne", "complex.h", AllLanguages>; + +def cacos : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def cacosf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def cacosl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def cacosh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def cacoshf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def cacoshl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def carg : LibraryBuiltin<"dXd", "fne", "complex.h", AllLanguages>; +def cargf : LibraryBuiltin<"fXf", "fne", "complex.h", AllLanguages>; +def cargl : LibraryBuiltin<"LdXLd", "fne", "complex.h", AllLanguages>; + +def casin : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def casinf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def casinl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def casinh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def casinhf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def casinhl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def catan : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def catanf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def catanl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def catanh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def catanhf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def catanhl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def ccos : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def ccosf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def ccosl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def ccosh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def ccoshf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def ccoshl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def cexp : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def cexpf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def cexpl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def cimag : LibraryBuiltin<"dXd", "fnc", "complex.h", AllLanguages>; +def cimagf : LibraryBuiltin<"fXf", "fnc", "complex.h", AllLanguages>; +def cimagl : LibraryBuiltin<"LdXLd", "fnc", "complex.h", AllLanguages>; + +def conj : LibraryBuiltin<"XdXd", "fnc", "complex.h", AllLanguages>; +def conjf : LibraryBuiltin<"XfXf", "fnc", "complex.h", AllLanguages>; +def conjl : LibraryBuiltin<"XLdXLd", "fnc", "complex.h", AllLanguages>; + +def clog : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def clogf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def clogl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def cproj : LibraryBuiltin<"XdXd", "fnc", "complex.h", AllLanguages>; +def cprojf : LibraryBuiltin<"XfXf", "fnc", "complex.h", AllLanguages>; +def cprojl : LibraryBuiltin<"XLdXLd", "fnc", "complex.h", AllLanguages>; + +def cpow : LibraryBuiltin<"XdXdXd", "fne", "complex.h", AllLanguages>; +def cpowf : LibraryBuiltin<"XfXfXf", "fne", "complex.h", AllLanguages>; +def cpowl : LibraryBuiltin<"XLdXLdXLd", "fne", "complex.h", AllLanguages>; + +def creal : LibraryBuiltin<"dXd", "fnc", "complex.h", AllLanguages>; +def crealf : LibraryBuiltin<"fXf", "fnc", "complex.h", AllLanguages>; +def creall : LibraryBuiltin<"LdXLd", "fnc", "complex.h", AllLanguages>; + +def csin : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def csinf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def csinl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def csinh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def csinhf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def csinhl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def csqrt : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def csqrtf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def csqrtl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def ctan : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def ctanf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def ctanl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +def ctanh : LibraryBuiltin<"XdXd", "fne", "complex.h", AllLanguages>; +def ctanhf : LibraryBuiltin<"XfXf", "fne", "complex.h", AllLanguages>; +def ctanhl : LibraryBuiltin<"XLdXLd", "fne", "complex.h", AllLanguages>; + +// __sinpi and friends are OS X specific library functions, but otherwise much +// like the standard (non-complex) sin (etc). +def __sinpi : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def __sinpif : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; + +def __cospi : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def __cospif : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; + +def __tanpi : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def __tanpif : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; + +// Similarly, __exp10 is OS X only +def __exp10 : LibraryBuiltin<"dd", "fne", "math.h", AllLanguages>; +def __exp10f : LibraryBuiltin<"ff", "fne", "math.h", AllLanguages>; + +// Blocks runtime Builtin math library functions +def _Block_object_assign : LibraryBuiltin<"vv*vC*iC", "f", "Blocks.h", AllLanguages>; +def _Block_object_dispose : LibraryBuiltin<"vvC*iC", "f", "Blocks.h", AllLanguages>; +// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. + +// Annotation function +def __builtin_annotation : Builtin<"v.", "tn">; + +// Invariants +def __builtin_assume : Builtin<"vb", "n">; + +// Multiprecision Arithmetic Builtins. +def __builtin_addcb : Builtin<"UcUcCUcCUcCUc*", "n">; +def __builtin_addcs : Builtin<"UsUsCUsCUsCUs*", "n">; +def __builtin_addc : Builtin<"UiUiCUiCUiCUi*", "n">; +def __builtin_addcl : Builtin<"ULiULiCULiCULiCULi*", "n">; +def __builtin_addcll : Builtin<"ULLiULLiCULLiCULLiCULLi*", "n">; +def __builtin_subcb : Builtin<"UcUcCUcCUcCUc*", "n">; +def __builtin_subcs : Builtin<"UsUsCUsCUsCUs*", "n">; +def __builtin_subc : Builtin<"UiUiCUiCUiCUi*", "n">; +def __builtin_subcl : Builtin<"ULiULiCULiCULiCULi*", "n">; +def __builtin_subcll : Builtin<"ULLiULLiCULLiCULLiCULLi*", "n">; + +// Checked Arithmetic Builtins for Security. +def __builtin_add_overflow : Builtin<"b.", "nt">; +def __builtin_sub_overflow : Builtin<"b.", "nt">; +def __builtin_mul_overflow : Builtin<"b.", "nt">; +def __builtin_uadd_overflow : Builtin<"bUiCUiCUi*", "n">; +def __builtin_uaddl_overflow : Builtin<"bULiCULiCULi*", "n">; +def __builtin_uaddll_overflow : Builtin<"bULLiCULLiCULLi*", "n">; +def __builtin_usub_overflow : Builtin<"bUiCUiCUi*", "n">; +def __builtin_usubl_overflow : Builtin<"bULiCULiCULi*", "n">; +def __builtin_usubll_overflow : Builtin<"bULLiCULLiCULLi*", "n">; +def __builtin_umul_overflow : Builtin<"bUiCUiCUi*", "n">; +def __builtin_umull_overflow : Builtin<"bULiCULiCULi*", "n">; +def __builtin_umulll_overflow : Builtin<"bULLiCULLiCULLi*", "n">; +def __builtin_sadd_overflow : Builtin<"bSiCSiCSi*", "n">; +def __builtin_saddl_overflow : Builtin<"bSLiCSLiCSLi*", "n">; +def __builtin_saddll_overflow : Builtin<"bSLLiCSLLiCSLLi*", "n">; +def __builtin_ssub_overflow : Builtin<"bSiCSiCSi*", "n">; +def __builtin_ssubl_overflow : Builtin<"bSLiCSLiCSLi*", "n">; +def __builtin_ssubll_overflow : Builtin<"bSLLiCSLLiCSLLi*", "n">; +def __builtin_smul_overflow : Builtin<"bSiCSiCSi*", "n">; +def __builtin_smull_overflow : Builtin<"bSLiCSLiCSLi*", "n">; +def __builtin_smulll_overflow : Builtin<"bSLLiCSLLiCSLLi*", "n">; + +// Clang builtins (not available in GCC). +def __builtin_addressof : Builtin<"v*v&", "nct">; +def __builtin_operator_new : Builtin<"v*z", "tc">; +def __builtin_operator_delete : Builtin<"vv*", "tn">; +def __builtin_char_memchr : Builtin<"c*cC*iz", "n">; +def __builtin_dump_struct : Builtin<"ivC*v*", "tn">; +def __builtin_preserve_access_index : Builtin<"v.", "t">; + +// Alignment builtins (uses custom parsing to support pointers and integers) +def __builtin_is_aligned : Builtin<"bvC*z", "nct">; +def __builtin_align_up : Builtin<"v*vC*z", "nct">; +def __builtin_align_down : Builtin<"v*vC*z", "nct">; + +// Safestack builtins +def __builtin___get_unsafe_stack_start : Builtin<"v*", "Fn">; +def __builtin___get_unsafe_stack_bottom : Builtin<"v*", "Fn">; +def __builtin___get_unsafe_stack_top : Builtin<"v*", "Fn">; +def __builtin___get_unsafe_stack_ptr : Builtin<"v*", "Fn">; + +// Nontemporal loads/stores builtins +def __builtin_nontemporal_store : Builtin<"v.", "t">; +def __builtin_nontemporal_load : Builtin<"v.", "t">; + +// Coroutine intrinsics. +def __builtin_coro_resume : Builtin<"vv*", "">; +def __builtin_coro_destroy : Builtin<"vv*", "">; +def __builtin_coro_done : Builtin<"bv*", "n">; +def __builtin_coro_promise : Builtin<"v*v*IiIb", "n">; + +def __builtin_coro_size : Builtin<"z", "n">; +def __builtin_coro_frame : Builtin<"v*", "n">; +def __builtin_coro_noop : Builtin<"v*", "n">; +def __builtin_coro_free : Builtin<"v*v*", "n">; + +def __builtin_coro_id : Builtin<"v*Iiv*v*v*", "n">; +def __builtin_coro_alloc : Builtin<"b", "n">; +def __builtin_coro_begin : Builtin<"v*v*", "n">; +def __builtin_coro_end : Builtin<"bv*Ib", "n">; +def __builtin_coro_suspend : Builtin<"cIb", "n">; +def __builtin_coro_param : Builtin<"bv*v*", "n">; + +// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions. +// We need the generic prototype, since the packet type could be anything. +def read_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; +def write_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; + +def reserve_read_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; +def reserve_write_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; + +def commit_write_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; +def commit_read_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; + +def sub_group_reserve_read_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; +def sub_group_reserve_write_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; + +def sub_group_commit_read_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; +def sub_group_commit_write_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; + +def work_group_reserve_read_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; +def work_group_reserve_write_pipe : LangBuiltin<"i.", "tn", OCLC20Lang>; + +def work_group_commit_read_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; +def work_group_commit_write_pipe : LangBuiltin<"v.", "tn", OCLC20Lang>; + +def get_pipe_num_packets : LangBuiltin<"Ui.", "tn", OCLC20Lang>; +def get_pipe_max_packets : LangBuiltin<"Ui.", "tn", OCLC20Lang>; + +// OpenCL v2.0 s6.13.17 - Enqueue kernel functions. +// Custom builtin check allows to perform special check of passed block arguments. +def enqueue_kernel : LangBuiltin<"i.", "tn", OCLC20Lang>; +def get_kernel_work_group_size : LangBuiltin<"Ui.", "tn", OCLC20Lang>; +def get_kernel_preferred_work_group_size_multiple : LangBuiltin<"Ui.", "tn", OCLC20Lang>; +def get_kernel_max_sub_group_size_for_ndrange : LangBuiltin<"Ui.", "tn", OCLC20Lang>; +def get_kernel_sub_group_count_for_ndrange : LangBuiltin<"Ui.", "tn", OCLC20Lang>; + +// OpenCL v2.0 s6.13.9 - Address space qualifier functions. +// FIXME: Pointer parameters of OpenCL builtins should have their address space +// requirement defined. +def to_global : LangBuiltin<"v*v*", "tn", OCLC20Lang>; +def to_local : LangBuiltin<"v*v*", "tn", OCLC20Lang>; +def to_private : LangBuiltin<"v*v*", "tn", OCLC20Lang>; + +// OpenCL half load/store builtin +def __builtin_store_half : LangBuiltin<"vdh*", "n", AllOCLCLanguages>; +def __builtin_store_halff : LangBuiltin<"vfh*", "n", AllOCLCLanguages>; +def __builtin_load_half : LangBuiltin<"dhC*", "nc", AllOCLCLanguages>; +def __builtin_load_halff : LangBuiltin<"fhC*", "nc", AllOCLCLanguages>; + +// Builtins for os_log/os_trace +def __builtin_os_log_format_buffer_size : Builtin<"zcC*.", "p:0:nut">; +def __builtin_os_log_format : Builtin<"v*v*cC*.", "p:0:nt">; + +// OpenMP 4.0 +def omp_is_initial_device : LangBuiltin<"i", "nc", OMPLang>; + +// Builtins for XRay +def __xray_customevent : Builtin<"vcC*z", "">; +def __xray_typedevent : Builtin<"vzcC*z", "">; + +// Win64-compatible va_list functions +def __builtin_ms_va_start : Builtin<"vc*&.", "nt">; +def __builtin_ms_va_end : Builtin<"vc*&", "n">; +def __builtin_ms_va_copy : Builtin<"vc*&c*&", "n">; + Index: clang/include/clang/Basic/BuiltinsAArch64.def =================================================================== --- clang/include/clang/Basic/BuiltinsAArch64.def +++ clang/include/clang/Basic/BuiltinsAArch64.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(LANGBUILTIN) # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsAMDGPU.def =================================================================== --- clang/include/clang/Basic/BuiltinsAMDGPU.def +++ clang/include/clang/Basic/BuiltinsAMDGPU.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsARM.def =================================================================== --- clang/include/clang/Basic/BuiltinsARM.def +++ clang/include/clang/Basic/BuiltinsARM.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(LANGBUILTIN) # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsBPF.def =================================================================== --- clang/include/clang/Basic/BuiltinsBPF.def +++ clang/include/clang/Basic/BuiltinsBPF.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsHexagon.def =================================================================== --- clang/include/clang/Basic/BuiltinsHexagon.def +++ clang/include/clang/Basic/BuiltinsHexagon.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsLe64.def =================================================================== --- clang/include/clang/Basic/BuiltinsLe64.def +++ clang/include/clang/Basic/BuiltinsLe64.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. BUILTIN(__clear_cache, "vv*v*", "i") Index: clang/include/clang/Basic/BuiltinsMips.def =================================================================== --- clang/include/clang/Basic/BuiltinsMips.def +++ clang/include/clang/Basic/BuiltinsMips.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. // MIPS DSP Rev 1 Index: clang/include/clang/Basic/BuiltinsNEON.def =================================================================== --- clang/include/clang/Basic/BuiltinsNEON.def +++ clang/include/clang/Basic/BuiltinsNEON.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #define GET_NEON_BUILTINS #include "clang/Basic/arm_neon.inc" Index: clang/include/clang/Basic/BuiltinsNVPTX.def =================================================================== --- clang/include/clang/Basic/BuiltinsNVPTX.def +++ clang/include/clang/Basic/BuiltinsNVPTX.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsPPC.def =================================================================== --- clang/include/clang/Basic/BuiltinsPPC.def +++ clang/include/clang/Basic/BuiltinsPPC.def @@ -14,7 +14,7 @@ // FIXME: this needs to be the full list supported by GCC. Right now, I'm just // adding stuff on demand. -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. BUILTIN(__builtin_ppc_get_timebase, "ULLi", "n") Index: clang/include/clang/Basic/BuiltinsSVE.def =================================================================== --- clang/include/clang/Basic/BuiltinsSVE.def +++ clang/include/clang/Basic/BuiltinsSVE.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #define GET_SVE_BUILTINS #include "clang/Basic/arm_sve_builtins.inc" Index: clang/include/clang/Basic/BuiltinsSystemZ.def =================================================================== --- clang/include/clang/Basic/BuiltinsSystemZ.def +++ clang/include/clang/Basic/BuiltinsSystemZ.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsWebAssembly.def =================================================================== --- clang/include/clang/Basic/BuiltinsWebAssembly.def +++ clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -13,7 +13,7 @@ /// //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsX86.def =================================================================== --- clang/include/clang/Basic/BuiltinsX86.def +++ clang/include/clang/Basic/BuiltinsX86.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. // FIXME: Ideally we would be able to pull this information from what // LLVM already knows about X86 builtins. We need to match the LLVM Index: clang/include/clang/Basic/BuiltinsX86_64.def =================================================================== --- clang/include/clang/Basic/BuiltinsX86_64.def +++ clang/include/clang/Basic/BuiltinsX86_64.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. #if defined(BUILTIN) && !defined(TARGET_BUILTIN) # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) Index: clang/include/clang/Basic/BuiltinsXCore.def =================================================================== --- clang/include/clang/Basic/BuiltinsXCore.def +++ clang/include/clang/Basic/BuiltinsXCore.def @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -// The format of this database matches clang/Basic/Builtins.def. +// Type and attribute strings are as defined in Builtins.td. BUILTIN(__builtin_bitrev, "UiUi", "nc") BUILTIN(__builtin_getid, "Si", "nc") Index: clang/include/clang/Basic/CMakeLists.txt =================================================================== --- clang/include/clang/Basic/CMakeLists.txt +++ clang/include/clang/Basic/CMakeLists.txt @@ -41,6 +41,11 @@ TARGET ClangAttrHasAttributeImpl ) +clang_tablegen(Builtins.inc -gen-clang-builtins-inc + SOURCE Builtins.td + TARGET ClangBuiltins + ) + # ARM NEON and MVE clang_tablegen(arm_neon.inc -gen-arm-neon-sema SOURCE arm_neon.td Index: clang/include/clang/Basic/arm_neon_incl.td =================================================================== --- clang/include/clang/Basic/arm_neon_incl.td +++ clang/include/clang/Basic/arm_neon_incl.td @@ -293,7 +293,6 @@ } // The following instruction classes are implemented via builtins. -// These declarations are used to generate Builtins.def: // // SInst: Instruction with signed/unsigned suffix (e.g., "s8", "u8", "p8") // IInst: Instruction with generic integer suffix (e.g., "i8") Index: clang/include/clang/module.modulemap =================================================================== --- clang/include/clang/module.modulemap +++ clang/include/clang/module.modulemap @@ -36,7 +36,6 @@ textual header "Basic/BuiltinsAMDGPU.def" textual header "Basic/BuiltinsARM.def" textual header "Basic/BuiltinsBPF.def" - textual header "Basic/Builtins.def" textual header "Basic/BuiltinsHexagon.def" textual header "Basic/BuiltinsHexagonDep.def" textual header "Basic/BuiltinsHexagonMapCustomDep.def" Index: clang/lib/AST/StmtPrinter.cpp =================================================================== --- clang/lib/AST/StmtPrinter.cpp +++ clang/lib/AST/StmtPrinter.cpp @@ -1655,7 +1655,7 @@ case AtomicExpr::AO ## ID: \ Name = #ID "("; \ break; -#include "clang/Basic/Builtins.def" +#include "clang/Basic/Builtins.inc" } OS << Name; Index: clang/lib/Basic/Builtins.cpp =================================================================== --- clang/lib/Basic/Builtins.cpp +++ clang/lib/Basic/Builtins.cpp @@ -18,14 +18,15 @@ using namespace clang; static const Builtin::Info BuiltinInfo[] = { - { "not a builtin function", nullptr, nullptr, nullptr, ALL_LANGUAGES,nullptr}, + {"not a builtin function", nullptr, nullptr, nullptr, ALL_LANGUAGES, + nullptr}, #define BUILTIN(ID, TYPE, ATTRS) \ { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr }, #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \ { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr }, #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \ { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr }, -#include "clang/Basic/Builtins.def" +#include "clang/Basic/Builtins.inc" }; const Builtin::Info &Builtin::Context::getRecord(unsigned ID) const { Index: clang/lib/Sema/OpenCLBuiltins.td =================================================================== --- clang/lib/Sema/OpenCLBuiltins.td +++ clang/lib/Sema/OpenCLBuiltins.td @@ -1238,23 +1238,23 @@ //-------------------------------------------------------------------- // OpenCL2.0 : 6.13.16 : Pipe Functions // --- Table 27 --- -// Defined in Builtins.def +// Defined in Builtins.td // --- Table 28 --- // Builtins taking pipe arguments are defined in Builtins.def def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>; // --- Table 29 --- -// Defined in Builtins.def +// Defined in Builtins.td //-------------------------------------------------------------------- // OpenCL2.0 : 6.13.17 : Enqueuing Kernels // --- Table 30 --- -// Defined in Builtins.def +// Defined in Builtins.td // --- Table 32 --- -// Defined in Builtins.def +// Defined in Builtins.td // --- Table 33 --- def : Builtin<"enqueue_marker", Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -1718,7 +1718,7 @@ #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \ case Builtin::BI##ID: \ return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID); -#include "clang/Basic/Builtins.def" +#include "clang/Basic/Builtins.inc" case Builtin::BI__annotation: if (SemaBuiltinMSVCAnnotation(*this, TheCall)) return ExprError(); Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -6532,7 +6532,7 @@ // Extract the return type from the (builtin) function pointer type. // FIXME Several builtins still have setType in // Sema::CheckBuiltinFunctionCall. One should review their definitions in - // Builtins.def to ensure they are correct before removing setType calls. + // Builtins.td to ensure they are correct before removing setType calls. QualType FnPtrTy = Context.getPointerType(FDecl->getType()); Result = ImpCastExprToType(Fn, FnPtrTy, CK_BuiltinFnToFnPtr).get(); ResultTy = FDecl->getCallResultType(); Index: clang/test/Analysis/bstring.c =================================================================== --- clang/test/Analysis/bstring.c +++ clang/test/Analysis/bstring.c @@ -479,7 +479,7 @@ //===----------------------------------------------------------------------=== #define bcopy BUILTIN(bcopy) -// __builtin_bcopy is not defined with const in Builtins.def. +// __builtin_bcopy is not defined with const in Builtins.td. void bcopy(/*const*/ void *s1, void *s2, size_t n); Index: clang/utils/TableGen/CMakeLists.txt =================================================================== --- clang/utils/TableGen/CMakeLists.txt +++ clang/utils/TableGen/CMakeLists.txt @@ -8,6 +8,7 @@ ClangCommentCommandInfoEmitter.cpp ClangCommentHTMLNamedCharacterReferenceEmitter.cpp ClangCommentHTMLTagsEmitter.cpp + ClangBuiltinsEmitter.cpp ClangDataCollectorsEmitter.cpp ClangDiagnosticsEmitter.cpp ClangOpcodesEmitter.cpp Index: clang/utils/TableGen/ClangBuiltinsEmitter.cpp =================================================================== --- /dev/null +++ clang/utils/TableGen/ClangBuiltinsEmitter.cpp @@ -0,0 +1,73 @@ +#include "TableGenBackends.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/TableGen/Record.h" +#include "llvm/TableGen/TableGenBackend.h" + +#include +#include + +using namespace llvm; + +namespace clang { + +void EmitClangBuiltins(RecordKeeper &Records, raw_ostream &OS) { + std::vector Builtins = Records.getAllDerivedDefinitions("BuiltinBase"); + // The atomic builtins, particularly, are assumed to be assigned IDs in + // definition order. + std::sort(Builtins.begin(), Builtins.end(), LessRecordByID()); + + OS << "#if defined(BUILTIN) && !defined(LIBBUILTIN)\n" + << "# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) " + "BUILTIN(ID, TYPE, ATTRS)\n" + << "#endif\n" + << "\n" + << "#if defined(BUILTIN) && !defined(LANGBUILTIN)\n" + << "# define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, " + "TYPE, ATTRS)\n" + << "#endif\n" + << "\n" + << "#ifndef ATOMIC_BUILTIN\n" + << "# define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)\n" + << "#endif\n" + << "\n"; + + Record *LibraryBuiltinClass = Records.getClass("LibraryBuiltin"); + Record *LangBuiltinClass = Records.getClass("LangBuiltin"); + + for (const auto &R : Builtins) { + StringRef Name = R->getName(); + StringRef Type = R->getValueAsString("Type"); + StringRef Attributes = R->getValueAsString("Attributes"); + StringRef Language = R->getValueAsDef("Lang")->getValueAsString("Name"); + + if (R->getValueAsBit("Atomic")) { + OS << "ATOMIC_BUILTIN(" << Name << ", \"" << Type << "\", \"" + << Attributes << "\")\n"; + continue; + } + + if (R->isSubClassOf(LibraryBuiltinClass)) { + StringRef Header = R->getValueAsString("Header"); + OS << "LIBBUILTIN(" << Name << ", \"" << Type << "\", \"" << Attributes + << "\", \"" << Header << "\", " << Language << ")\n"; + continue; + } + + if (R->isSubClassOf(LangBuiltinClass)) { + OS << "LANGBUILTIN(" << Name << ", \"" << Type << "\", \"" << Attributes + << "\", " << Language << ")\n"; + continue; + } + + OS << "BUILTIN(" << Name << ", \"" << Type << "\", \"" << Attributes + << "\")\n"; + } + + OS << "#undef BUILTIN\n" + << "#undef ATOMIC_BUILTIN\n" + << "#undef LANGBUILTIN\n" + << "#undef LIBBUILTIN\n"; +} + +} // end namespace clang Index: clang/utils/TableGen/MveEmitter.cpp =================================================================== --- clang/utils/TableGen/MveEmitter.cpp +++ clang/utils/TableGen/MveEmitter.cpp @@ -1830,7 +1830,7 @@ // declared 'static inline' without a body, which is fine // provided clang recognizes them as builtins, and has the // effect that this type signature is used in place of the one - // that Builtins.def didn't provide. That's how we can get + // that Builtins.td didn't provide. That's how we can get // structure types that weren't defined until this header was // included to be part of the type signature of a builtin that // was known to clang already. Index: clang/utils/TableGen/NeonEmitter.cpp =================================================================== --- clang/utils/TableGen/NeonEmitter.cpp +++ clang/utils/TableGen/NeonEmitter.cpp @@ -261,8 +261,7 @@ /// defined in stdint.h or arm_neon.h. std::string str() const; - /// Return the string representation of a type, which is an encoded - /// string for passing to the BUILTIN() macro in Builtins.def. + /// Return the string representation of a type as specified in Builtins.td. std::string builtin_str() const; /// Return the value in NeonTypeFlags for this type. @@ -478,7 +477,7 @@ std::string getMangledName(bool ForceClassS = false) const; /// Return the type code for a builtin function call. std::string getInstTypeCode(Type T, ClassKind CK) const; - /// Return the type string for a BUILTIN() macro in Builtins.def. + /// Return the type string as specified in Builtins.td. std::string getBuiltinTypeStr(); /// Generate the intrinsic, returning code. Index: clang/utils/TableGen/SveEmitter.cpp =================================================================== --- clang/utils/TableGen/SveEmitter.cpp +++ clang/utils/TableGen/SveEmitter.cpp @@ -113,7 +113,7 @@ } /// Return the string representation of a type, which is an encoded - /// string for passing to the BUILTIN() macro in Builtins.def. + /// string as described in Builtins.td. std::string builtin_str() const; /// Return the C/C++ string representation of a type for use in the @@ -194,7 +194,7 @@ ArrayRef getImmChecks() const { return ImmChecks; } - /// Return the type string for a BUILTIN() macro in Builtins.def. + /// Return the type string as specified in Builtins.td. std::string getBuiltinTypeStr(); /// Return the name, mangled with type information. The name is mangled for Index: clang/utils/TableGen/TableGen.cpp =================================================================== --- clang/utils/TableGen/TableGen.cpp +++ clang/utils/TableGen/TableGen.cpp @@ -44,6 +44,7 @@ GenClangAttrNodeTraverse, GenClangBasicReader, GenClangBasicWriter, + GenClangBuiltins, GenClangDiagsDefs, GenClangDiagGroups, GenClangDiagsIndexName, @@ -150,6 +151,8 @@ "Generate Clang BasicReader classes"), clEnumValN(GenClangBasicWriter, "gen-clang-basic-writer", "Generate Clang BasicWriter classes"), + clEnumValN(GenClangBuiltins, "gen-clang-builtins-inc", + "Generate Clang Builtins"), clEnumValN(GenClangCommentNodes, "gen-clang-comment-nodes", "Generate Clang AST comment nodes"), clEnumValN(GenClangDeclNodes, "gen-clang-decl-nodes", @@ -332,6 +335,9 @@ case GenClangBasicWriter: EmitClangBasicWriter(Records, OS); break; + case GenClangBuiltins: + EmitClangBuiltins(Records, OS); + break; case GenClangOpcodes: EmitClangOpcodes(Records, OS); break; Index: clang/utils/TableGen/TableGenBackends.h =================================================================== --- clang/utils/TableGen/TableGenBackends.h +++ clang/utils/TableGen/TableGenBackends.h @@ -123,6 +123,8 @@ void EmitTestPragmaAttributeSupportedAttributes(llvm::RecordKeeper &Records, llvm::raw_ostream &OS); +void EmitClangBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS); + } // end namespace clang #endif