1//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the standard builtin function database. Users of this file 11// must define the BUILTIN macro to make use of this information. 12// 13//===----------------------------------------------------------------------===// 14 15// FIXME: This should really be a .td file, but that requires modifying tblgen. 16// Perhaps tblgen should have plugins. 17 18// The first value provided to the macro specifies the function name of the 19// builtin, and results in a clang::builtin::BIXX enum value for XX. 20 21// The second value provided to the macro specifies the type of the function 22// (result value, then each argument) as follows: 23// v -> void 24// b -> boolean 25// c -> char 26// s -> short 27// i -> int 28// f -> float 29// d -> double 30// z -> size_t 31// F -> constant CFString 32// G -> id 33// H -> SEL 34// M -> struct objc_super 35// a -> __builtin_va_list 36// A -> "reference" to __builtin_va_list 37// V -> Vector, followed by the number of elements and the base type. 38// E -> ext_vector, followed by the number of elements and the base type. 39// X -> _Complex, followed by the base type. 40// Y -> ptrdiff_t 41// P -> FILE 42// J -> jmp_buf 43// SJ -> sigjmp_buf 44// K -> ucontext_t 45// p -> pid_t 46// . -> "...". This may only occur at the end of the function list. 47// 48// Types may be prefixed with the following modifiers: 49// L -> long (e.g. Li for 'long int') 50// LL -> long long 51// LLL -> __int128_t (e.g. LLLi) 52// S -> signed 53// U -> unsigned 54// I -> Required to constant fold to an integer constant expression. 55// 56// Types may be postfixed with the following modifiers: 57// * -> pointer (optionally followed by an address space number) 58// & -> reference (optionally followed by an address space number) 59// C -> const 60// D -> volatile 61 62// The third value provided to the macro specifies information about attributes 63// of the function. These must be kept in sync with the predicates in the 64// Builtin::Context class. Currently we have: 65// n -> nothrow 66// r -> noreturn 67// c -> const 68// t -> signature is meaningless, use custom typechecking 69// F -> this is a libc/libm function with a '__builtin_' prefix added. 70// f -> this is a libc/libm function without the '__builtin_' prefix. It can 71// be followed by ':headername:' to state which header this function 72// comes from. 73// p:N: -> this is a printf-like function whose Nth argument is the format 74// string. 75// P:N: -> similar to the p:N: attribute, but the function is like vprintf 76// in that it accepts its arguments as a va_list rather than 77// through an ellipsis 78// s:N: -> this is a scanf-like function whose Nth argument is the format 79// string. 80// S:N: -> similar to the s:N: attribute, but the function is like vscanf 81// in that it accepts its arguments as a va_list rather than 82// through an ellipsis 83// e -> const, but only when -fmath-errno=0 84// j -> returns_twice (like setjmp) 85// u -> arguments are not evaluated for their side-effects 86// FIXME: gcc has nonnull 87 88#if defined(BUILTIN) && !defined(LIBBUILTIN) 89# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) 90#endif 91 92// Standard libc/libm functions: 93BUILTIN(__builtin_atan2 , "ddd" , "Fnc") 94BUILTIN(__builtin_atan2f, "fff" , "Fnc") 95BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc") 96BUILTIN(__builtin_abs , "ii" , "ncF") 97BUILTIN(__builtin_copysign, "ddd", "ncF") 98BUILTIN(__builtin_copysignf, "fff", "ncF") 99BUILTIN(__builtin_copysignl, "LdLdLd", "ncF") 100BUILTIN(__builtin_fabs , "dd" , "ncF") 101BUILTIN(__builtin_fabsf, "ff" , "ncF") 102BUILTIN(__builtin_fabsl, "LdLd", "ncF") 103BUILTIN(__builtin_fmod , "ddd" , "Fnc") 104BUILTIN(__builtin_fmodf, "fff" , "Fnc") 105BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc") 106BUILTIN(__builtin_frexp , "ddi*" , "Fn") 107BUILTIN(__builtin_frexpf, "ffi*" , "Fn") 108BUILTIN(__builtin_frexpl, "LdLdi*", "Fn") 109BUILTIN(__builtin_huge_val, "d", "nc") 110BUILTIN(__builtin_huge_valf, "f", "nc") 111BUILTIN(__builtin_huge_vall, "Ld", "nc") 112BUILTIN(__builtin_inf , "d" , "nc") 113BUILTIN(__builtin_inff , "f" , "nc") 114BUILTIN(__builtin_infl , "Ld" , "nc") 115BUILTIN(__builtin_labs , "LiLi" , "Fnc") 116BUILTIN(__builtin_llabs, "LLiLLi", "Fnc") 117BUILTIN(__builtin_ldexp , "ddi" , "Fnc") 118BUILTIN(__builtin_ldexpf, "ffi" , "Fnc") 119BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc") 120BUILTIN(__builtin_modf , "ddd*" , "Fn") 121BUILTIN(__builtin_modff, "fff*" , "Fn") 122BUILTIN(__builtin_modfl, "LdLdLd*", "Fn") 123BUILTIN(__builtin_nan, "dcC*" , "ncF") 124BUILTIN(__builtin_nanf, "fcC*" , "ncF") 125BUILTIN(__builtin_nanl, "LdcC*", "ncF") 126BUILTIN(__builtin_nans, "dcC*" , "ncF") 127BUILTIN(__builtin_nansf, "fcC*" , "ncF") 128BUILTIN(__builtin_nansl, "LdcC*", "ncF") 129BUILTIN(__builtin_powi , "ddi" , "Fnc") 130BUILTIN(__builtin_powif, "ffi" , "Fnc") 131BUILTIN(__builtin_powil, "LdLdi", "Fnc") 132BUILTIN(__builtin_pow , "ddd" , "Fnc") 133BUILTIN(__builtin_powf, "fff" , "Fnc") 134BUILTIN(__builtin_powl, "LdLdLd", "Fnc") 135 136// Standard unary libc/libm functions with double/float/long double variants: 137BUILTIN(__builtin_acos , "dd" , "Fnc") 138BUILTIN(__builtin_acosf, "ff" , "Fnc") 139BUILTIN(__builtin_acosl, "LdLd", "Fnc") 140BUILTIN(__builtin_acosh , "dd" , "Fnc") 141BUILTIN(__builtin_acoshf, "ff" , "Fnc") 142BUILTIN(__builtin_acoshl, "LdLd", "Fnc") 143BUILTIN(__builtin_asin , "dd" , "Fnc") 144BUILTIN(__builtin_asinf, "ff" , "Fnc") 145BUILTIN(__builtin_asinl, "LdLd", "Fnc") 146BUILTIN(__builtin_asinh , "dd" , "Fnc") 147BUILTIN(__builtin_asinhf, "ff" , "Fnc") 148BUILTIN(__builtin_asinhl, "LdLd", "Fnc") 149BUILTIN(__builtin_atan , "dd" , "Fnc") 150BUILTIN(__builtin_atanf, "ff" , "Fnc") 151BUILTIN(__builtin_atanl, "LdLd", "Fnc") 152BUILTIN(__builtin_atanh , "dd", "Fnc") 153BUILTIN(__builtin_atanhf, "ff", "Fnc") 154BUILTIN(__builtin_atanhl, "LdLd", "Fnc") 155BUILTIN(__builtin_cbrt , "dd", "Fnc") 156BUILTIN(__builtin_cbrtf, "ff", "Fnc") 157BUILTIN(__builtin_cbrtl, "LdLd", "Fnc") 158BUILTIN(__builtin_ceil , "dd" , "Fnc") 159BUILTIN(__builtin_ceilf, "ff" , "Fnc") 160BUILTIN(__builtin_ceill, "LdLd", "Fnc") 161BUILTIN(__builtin_cos , "dd" , "Fnc") 162BUILTIN(__builtin_cosf, "ff" , "Fnc") 163BUILTIN(__builtin_cosh , "dd" , "Fnc") 164BUILTIN(__builtin_coshf, "ff" , "Fnc") 165BUILTIN(__builtin_coshl, "LdLd", "Fnc") 166BUILTIN(__builtin_cosl, "LdLd", "Fnc") 167BUILTIN(__builtin_erf , "dd", "Fnc") 168BUILTIN(__builtin_erff, "ff", "Fnc") 169BUILTIN(__builtin_erfl, "LdLd", "Fnc") 170BUILTIN(__builtin_erfc , "dd", "Fnc") 171BUILTIN(__builtin_erfcf, "ff", "Fnc") 172BUILTIN(__builtin_erfcl, "LdLd", "Fnc") 173BUILTIN(__builtin_exp , "dd" , "Fnc") 174BUILTIN(__builtin_expf, "ff" , "Fnc") 175BUILTIN(__builtin_expl, "LdLd", "Fnc") 176BUILTIN(__builtin_exp2 , "dd" , "Fnc") 177BUILTIN(__builtin_exp2f, "ff" , "Fnc") 178BUILTIN(__builtin_exp2l, "LdLd", "Fnc") 179BUILTIN(__builtin_expm1 , "dd", "Fnc") 180BUILTIN(__builtin_expm1f, "ff", "Fnc") 181BUILTIN(__builtin_expm1l, "LdLd", "Fnc") 182BUILTIN(__builtin_fdim, "ddd", "Fnc") 183BUILTIN(__builtin_fdimf, "fff", "Fnc") 184BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc") 185BUILTIN(__builtin_floor , "dd" , "Fnc") 186BUILTIN(__builtin_floorf, "ff" , "Fnc") 187BUILTIN(__builtin_floorl, "LdLd", "Fnc") 188BUILTIN(__builtin_fma, "dddd", "Fnc") 189BUILTIN(__builtin_fmaf, "ffff", "Fnc") 190BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc") 191BUILTIN(__builtin_fmax, "ddd", "Fnc") 192BUILTIN(__builtin_fmaxf, "fff", "Fnc") 193BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc") 194BUILTIN(__builtin_fmin, "ddd", "Fnc") 195BUILTIN(__builtin_fminf, "fff", "Fnc") 196BUILTIN(__builtin_fminl, "LdLdLd", "Fnc") 197BUILTIN(__builtin_hypot , "ddd" , "Fnc") 198BUILTIN(__builtin_hypotf, "fff" , "Fnc") 199BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc") 200BUILTIN(__builtin_ilogb , "id", "Fnc") 201BUILTIN(__builtin_ilogbf, "if", "Fnc") 202BUILTIN(__builtin_ilogbl, "iLd", "Fnc") 203BUILTIN(__builtin_lgamma , "dd", "Fnc") 204BUILTIN(__builtin_lgammaf, "ff", "Fnc") 205BUILTIN(__builtin_lgammal, "LdLd", "Fnc") 206BUILTIN(__builtin_llrint, "LLid", "Fnc") 207BUILTIN(__builtin_llrintf, "LLif", "Fnc") 208BUILTIN(__builtin_llrintl, "LLiLd", "Fnc") 209BUILTIN(__builtin_llround , "LLid", "Fnc") 210BUILTIN(__builtin_llroundf, "LLif", "Fnc") 211BUILTIN(__builtin_llroundl, "LLiLd", "Fnc") 212BUILTIN(__builtin_log , "dd" , "Fnc") 213BUILTIN(__builtin_log10 , "dd" , "Fnc") 214BUILTIN(__builtin_log10f, "ff" , "Fnc") 215BUILTIN(__builtin_log10l, "LdLd", "Fnc") 216BUILTIN(__builtin_log1p , "dd" , "Fnc") 217BUILTIN(__builtin_log1pf, "ff" , "Fnc") 218BUILTIN(__builtin_log1pl, "LdLd", "Fnc") 219BUILTIN(__builtin_log2, "dd" , "Fnc") 220BUILTIN(__builtin_log2f, "ff" , "Fnc") 221BUILTIN(__builtin_log2l, "LdLd" , "Fnc") 222BUILTIN(__builtin_logb , "dd", "Fnc") 223BUILTIN(__builtin_logbf, "ff", "Fnc") 224BUILTIN(__builtin_logbl, "LdLd", "Fnc") 225BUILTIN(__builtin_logf, "ff" , "Fnc") 226BUILTIN(__builtin_logl, "LdLd", "Fnc") 227BUILTIN(__builtin_lrint , "Lid", "Fnc") 228BUILTIN(__builtin_lrintf, "Lif", "Fnc") 229BUILTIN(__builtin_lrintl, "LiLd", "Fnc") 230BUILTIN(__builtin_lround , "Lid", "Fnc") 231BUILTIN(__builtin_lroundf, "Lif", "Fnc") 232BUILTIN(__builtin_lroundl, "LiLd", "Fnc") 233BUILTIN(__builtin_nearbyint , "dd", "Fnc") 234BUILTIN(__builtin_nearbyintf, "ff", "Fnc") 235BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc") 236BUILTIN(__builtin_nextafter , "ddd", "Fnc") 237BUILTIN(__builtin_nextafterf, "fff", "Fnc") 238BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc") 239BUILTIN(__builtin_nexttoward , "ddd", "Fnc") 240BUILTIN(__builtin_nexttowardf, "fff", "Fnc") 241BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc") 242BUILTIN(__builtin_remainder , "ddd", "Fnc") 243BUILTIN(__builtin_remainderf, "fff", "Fnc") 244BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc") 245BUILTIN(__builtin_remquo , "dddi*", "Fn") 246BUILTIN(__builtin_remquof, "fffi*", "Fn") 247BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn") 248BUILTIN(__builtin_rint , "dd", "Fnc") 249BUILTIN(__builtin_rintf, "ff", "Fnc") 250BUILTIN(__builtin_rintl, "LdLd", "Fnc") 251BUILTIN(__builtin_round, "dd" , "Fnc") 252BUILTIN(__builtin_roundf, "ff" , "Fnc") 253BUILTIN(__builtin_roundl, "LdLd" , "Fnc") 254BUILTIN(__builtin_scalbln , "ddLi", "Fnc") 255BUILTIN(__builtin_scalblnf, "ffLi", "Fnc") 256BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc") 257BUILTIN(__builtin_scalbn , "ddi", "Fnc") 258BUILTIN(__builtin_scalbnf, "ffi", "Fnc") 259BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc") 260BUILTIN(__builtin_sin , "dd" , "Fnc") 261BUILTIN(__builtin_sinf, "ff" , "Fnc") 262BUILTIN(__builtin_sinh , "dd" , "Fnc") 263BUILTIN(__builtin_sinhf, "ff" , "Fnc") 264BUILTIN(__builtin_sinhl, "LdLd", "Fnc") 265BUILTIN(__builtin_sinl, "LdLd", "Fnc") 266BUILTIN(__builtin_sqrt , "dd" , "Fnc") 267BUILTIN(__builtin_sqrtf, "ff" , "Fnc") 268BUILTIN(__builtin_sqrtl, "LdLd", "Fnc") 269BUILTIN(__builtin_tan , "dd" , "Fnc") 270BUILTIN(__builtin_tanf, "ff" , "Fnc") 271BUILTIN(__builtin_tanh , "dd" , "Fnc") 272BUILTIN(__builtin_tanhf, "ff" , "Fnc") 273BUILTIN(__builtin_tanhl, "LdLd", "Fnc") 274BUILTIN(__builtin_tanl, "LdLd", "Fnc") 275BUILTIN(__builtin_tgamma , "dd", "Fnc") 276BUILTIN(__builtin_tgammaf, "ff", "Fnc") 277BUILTIN(__builtin_tgammal, "LdLd", "Fnc") 278BUILTIN(__builtin_trunc , "dd", "Fnc") 279BUILTIN(__builtin_truncf, "ff", "Fnc") 280BUILTIN(__builtin_truncl, "LdLd", "Fnc") 281 282// C99 complex builtins 283BUILTIN(__builtin_cabs, "dXd", "Fnc") 284BUILTIN(__builtin_cabsf, "fXf", "Fnc") 285BUILTIN(__builtin_cabsl, "LdXLd", "Fnc") 286BUILTIN(__builtin_cacos, "XdXd", "Fnc") 287BUILTIN(__builtin_cacosf, "XfXf", "Fnc") 288BUILTIN(__builtin_cacosh, "XdXd", "Fnc") 289BUILTIN(__builtin_cacoshf, "XfXf", "Fnc") 290BUILTIN(__builtin_cacoshl, "XLdXLd", "Fnc") 291BUILTIN(__builtin_cacosl, "XLdXLd", "Fnc") 292BUILTIN(__builtin_carg, "dXd", "Fnc") 293BUILTIN(__builtin_cargf, "fXf", "Fnc") 294BUILTIN(__builtin_cargl, "LdXLd", "Fnc") 295BUILTIN(__builtin_casin, "XdXd", "Fnc") 296BUILTIN(__builtin_casinf, "XfXf", "Fnc") 297BUILTIN(__builtin_casinh, "XdXd", "Fnc") 298BUILTIN(__builtin_casinhf, "XfXf", "Fnc") 299BUILTIN(__builtin_casinhl, "XLdXLd", "Fnc") 300BUILTIN(__builtin_casinl, "XLdXLd", "Fnc") 301BUILTIN(__builtin_catan, "XdXd", "Fnc") 302BUILTIN(__builtin_catanf, "XfXf", "Fnc") 303BUILTIN(__builtin_catanh, "XdXd", "Fnc") 304BUILTIN(__builtin_catanhf, "XfXf", "Fnc") 305BUILTIN(__builtin_catanhl, "XLdXLd", "Fnc") 306BUILTIN(__builtin_catanl, "XLdXLd", "Fnc") 307BUILTIN(__builtin_ccos, "XdXd", "Fnc") 308BUILTIN(__builtin_ccosf, "XfXf", "Fnc") 309BUILTIN(__builtin_ccosl, "XLdXLd", "Fnc") 310BUILTIN(__builtin_ccosh, "XdXd", "Fnc") 311BUILTIN(__builtin_ccoshf, "XfXf", "Fnc") 312BUILTIN(__builtin_ccoshl, "XLdXLd", "Fnc") 313BUILTIN(__builtin_cexp, "XdXd", "Fnc") 314BUILTIN(__builtin_cexpf, "XfXf", "Fnc") 315BUILTIN(__builtin_cexpl, "XLdXLd", "Fnc") 316BUILTIN(__builtin_cimag, "dXd", "Fnc") 317BUILTIN(__builtin_cimagf, "fXf", "Fnc") 318BUILTIN(__builtin_cimagl, "LdXLd", "Fnc") 319BUILTIN(__builtin_conj, "XdXd", "Fnc") 320BUILTIN(__builtin_conjf, "XfXf", "Fnc") 321BUILTIN(__builtin_conjl, "XLdXLd", "Fnc") 322BUILTIN(__builtin_clog, "XdXd", "Fnc") 323BUILTIN(__builtin_clogf, "XfXf", "Fnc") 324BUILTIN(__builtin_clogl, "XLdXLd", "Fnc") 325BUILTIN(__builtin_cproj, "XdXd", "Fnc") 326BUILTIN(__builtin_cprojf, "XfXf", "Fnc") 327BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc") 328BUILTIN(__builtin_cpow, "XdXdXd", "Fnc") 329BUILTIN(__builtin_cpowf, "XfXfXf", "Fnc") 330BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fnc") 331BUILTIN(__builtin_creal, "dXd", "Fnc") 332BUILTIN(__builtin_crealf, "fXf", "Fnc") 333BUILTIN(__builtin_creall, "LdXLd", "Fnc") 334BUILTIN(__builtin_csin, "XdXd", "Fnc") 335BUILTIN(__builtin_csinf, "XfXf", "Fnc") 336BUILTIN(__builtin_csinl, "XLdXLd", "Fnc") 337BUILTIN(__builtin_csinh, "XdXd", "Fnc") 338BUILTIN(__builtin_csinhf, "XfXf", "Fnc") 339BUILTIN(__builtin_csinhl, "XLdXLd", "Fnc") 340BUILTIN(__builtin_csqrt, "XdXd", "Fnc") 341BUILTIN(__builtin_csqrtf, "XfXf", "Fnc") 342BUILTIN(__builtin_csqrtl, "XLdXLd", "Fnc") 343BUILTIN(__builtin_ctan, "XdXd", "Fnc") 344BUILTIN(__builtin_ctanf, "XfXf", "Fnc") 345BUILTIN(__builtin_ctanl, "XLdXLd", "Fnc") 346BUILTIN(__builtin_ctanh, "XdXd", "Fnc") 347BUILTIN(__builtin_ctanhf, "XfXf", "Fnc") 348BUILTIN(__builtin_ctanhl, "XLdXLd", "Fnc") 349 350// FP Comparisons. 351BUILTIN(__builtin_isgreater , "i.", "nc") 352BUILTIN(__builtin_isgreaterequal, "i.", "nc") 353BUILTIN(__builtin_isless , "i.", "nc") 354BUILTIN(__builtin_islessequal , "i.", "nc") 355BUILTIN(__builtin_islessgreater , "i.", "nc") 356BUILTIN(__builtin_isunordered , "i.", "nc") 357 358// Unary FP classification 359BUILTIN(__builtin_fpclassify, "iiiii.", "nc") 360BUILTIN(__builtin_isfinite, "i.", "nc") 361BUILTIN(__builtin_isinf, "i.", "nc") 362BUILTIN(__builtin_isinf_sign, "i.", "nc") 363BUILTIN(__builtin_isnan, "i.", "nc") 364BUILTIN(__builtin_isnormal, "i.", "nc") 365 366// FP signbit builtins 367BUILTIN(__builtin_signbit, "id", "nc") 368BUILTIN(__builtin_signbitf, "if", "nc") 369BUILTIN(__builtin_signbitl, "iLd", "nc") 370 371// Builtins for arithmetic. 372BUILTIN(__builtin_clzs , "iUs" , "nc") 373BUILTIN(__builtin_clz , "iUi" , "nc") 374BUILTIN(__builtin_clzl , "iULi" , "nc") 375BUILTIN(__builtin_clzll, "iULLi", "nc") 376// TODO: int clzimax(uintmax_t) 377BUILTIN(__builtin_ctzs , "iUs" , "nc") 378BUILTIN(__builtin_ctz , "iUi" , "nc") 379BUILTIN(__builtin_ctzl , "iULi" , "nc") 380BUILTIN(__builtin_ctzll, "iULLi", "nc") 381// TODO: int ctzimax(uintmax_t) 382BUILTIN(__builtin_ffs , "ii" , "nc") 383BUILTIN(__builtin_ffsl , "iLi" , "nc") 384BUILTIN(__builtin_ffsll, "iLLi", "nc") 385BUILTIN(__builtin_parity , "iUi" , "nc") 386BUILTIN(__builtin_parityl , "iULi" , "nc") 387BUILTIN(__builtin_parityll, "iULLi", "nc") 388BUILTIN(__builtin_popcount , "iUi" , "nc") 389BUILTIN(__builtin_popcountl , "iULi" , "nc") 390BUILTIN(__builtin_popcountll, "iULLi", "nc") 391 392// FIXME: These type signatures are not correct for targets with int != 32-bits 393// or with ULL != 64-bits. 394BUILTIN(__builtin_bswap16, "UsUs", "nc") 395BUILTIN(__builtin_bswap32, "UiUi", "nc") 396BUILTIN(__builtin_bswap64, "ULLiULLi", "nc") 397 398// Random GCC builtins 399BUILTIN(__builtin_constant_p, "i.", "nctu") 400BUILTIN(__builtin_classify_type, "i.", "nctu") 401BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc") 402BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc") 403BUILTIN(__builtin_va_start, "vA.", "nt") 404BUILTIN(__builtin_va_end, "vA", "n") 405BUILTIN(__builtin_va_copy, "vAA", "n") 406BUILTIN(__builtin_stdarg_start, "vA.", "n") 407BUILTIN(__builtin_bcmp, "iv*v*z", "n") 408BUILTIN(__builtin_bcopy, "vv*v*z", "n") 409BUILTIN(__builtin_bzero, "vv*z", "nF") 410BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:") 411BUILTIN(__builtin_memchr, "v*vC*iz", "nF") 412BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF") 413BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF") 414BUILTIN(__builtin_memmove, "v*v*vC*z", "nF") 415BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF") 416BUILTIN(__builtin_memset, "v*v*iz", "nF") 417BUILTIN(__builtin_printf, "icC*.", "Fp:0:") 418BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF") 419BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF") 420BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF") 421BUILTIN(__builtin_strcat, "c*c*cC*", "nF") 422BUILTIN(__builtin_strchr, "c*cC*i", "nF") 423BUILTIN(__builtin_strcmp, "icC*cC*", "nF") 424BUILTIN(__builtin_strcpy, "c*c*cC*", "nF") 425BUILTIN(__builtin_strcspn, "zcC*cC*", "nF") 426BUILTIN(__builtin_strdup, "c*cC*", "nF") 427BUILTIN(__builtin_strlen, "zcC*", "nF") 428BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF") 429BUILTIN(__builtin_strncat, "c*c*cC*z", "nF") 430BUILTIN(__builtin_strncmp, "icC*cC*z", "nF") 431BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF") 432BUILTIN(__builtin_strndup, "c*cC*z", "nF") 433BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF") 434BUILTIN(__builtin_strrchr, "c*cC*i", "nF") 435BUILTIN(__builtin_strspn, "zcC*cC*", "nF") 436BUILTIN(__builtin_strstr, "c*cC*cC*", "nF") 437BUILTIN(__builtin_return_address, "v*IUi", "n") 438BUILTIN(__builtin_extract_return_addr, "v*v*", "n") 439BUILTIN(__builtin_frame_address, "v*IUi", "n") 440BUILTIN(__builtin_flt_rounds, "i", "nc") 441BUILTIN(__builtin_setjmp, "iv**", "j") 442BUILTIN(__builtin_longjmp, "vv**i", "r") 443BUILTIN(__builtin_unwind_init, "v", "") 444BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc") 445BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") 446BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") 447BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") 448 449// GCC exception builtins 450BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! 451BUILTIN(__builtin_frob_return_addr, "v*v*", "n") 452BUILTIN(__builtin_dwarf_cfa, "v*", "n") 453BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n") 454BUILTIN(__builtin_dwarf_sp_column, "Ui", "n") 455BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t 456 457// GCC Object size checking builtins 458BUILTIN(__builtin_object_size, "zvC*i", "nu") 459BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF") 460BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF") 461BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF") 462BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF") 463BUILTIN(__builtin___memset_chk, "v*v*izz", "nF") 464BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF") 465BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF") 466BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF") 467BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF") 468BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF") 469BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF") 470BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF") 471BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF") 472BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:") 473BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:") 474BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:") 475BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:") 476BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:") 477BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:") 478BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:") 479BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:") 480 481BUILTIN(__builtin_expect, "LiLiLi" , "nc") 482BUILTIN(__builtin_prefetch, "vvC*.", "nc") 483BUILTIN(__builtin_readcyclecounter, "ULLi", "n") 484BUILTIN(__builtin_trap, "v", "nr") 485BUILTIN(__builtin_debugtrap, "v", "n") 486BUILTIN(__builtin_unreachable, "v", "nr") 487BUILTIN(__builtin_shufflevector, "v." , "nc") 488BUILTIN(__builtin_alloca, "v*z" , "n") 489 490// "Overloaded" Atomic operator builtins. These are overloaded to support data 491// types of i8, i16, i32, i64, and i128. The front-end sees calls to the 492// non-suffixed version of these (which has a bogus type) and transforms them to 493// the right overloaded version in Sema (plus casts). 494 495// FIXME: These assume that char -> i8, short -> i16, int -> i32, 496// long long -> i64. 497 498BUILTIN(__sync_fetch_and_add, "v.", "t") 499BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt") 500BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt") 501BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt") 502BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt") 503BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt") 504 505BUILTIN(__sync_fetch_and_sub, "v.", "t") 506BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt") 507BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt") 508BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt") 509BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt") 510BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt") 511 512BUILTIN(__sync_fetch_and_or, "v.", "t") 513BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt") 514BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt") 515BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt") 516BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt") 517BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt") 518 519BUILTIN(__sync_fetch_and_and, "v.", "t") 520BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn") 521BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn") 522BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn") 523BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn") 524BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn") 525 526BUILTIN(__sync_fetch_and_xor, "v.", "t") 527BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn") 528BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn") 529BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn") 530BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn") 531BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn") 532 533 534BUILTIN(__sync_add_and_fetch, "v.", "t") 535BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn") 536BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn") 537BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn") 538BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn") 539BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") 540 541BUILTIN(__sync_sub_and_fetch, "v.", "t") 542BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn") 543BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn") 544BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn") 545BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn") 546BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") 547 548BUILTIN(__sync_or_and_fetch, "v.", "t") 549BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn") 550BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn") 551BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn") 552BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn") 553BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") 554 555BUILTIN(__sync_and_and_fetch, "v.", "t") 556BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn") 557BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn") 558BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn") 559BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn") 560BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") 561 562BUILTIN(__sync_xor_and_fetch, "v.", "t") 563BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn") 564BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn") 565BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn") 566BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn") 567BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") 568 569BUILTIN(__sync_bool_compare_and_swap, "v.", "t") 570BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn") 571BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn") 572BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn") 573BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn") 574BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn") 575 576BUILTIN(__sync_val_compare_and_swap, "v.", "t") 577BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn") 578BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn") 579BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn") 580BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn") 581BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn") 582 583BUILTIN(__sync_lock_test_and_set, "v.", "t") 584BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn") 585BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn") 586BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn") 587BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn") 588BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn") 589 590BUILTIN(__sync_lock_release, "v.", "t") 591BUILTIN(__sync_lock_release_1, "vcD*.", "tn") 592BUILTIN(__sync_lock_release_2, "vsD*.", "tn") 593BUILTIN(__sync_lock_release_4, "viD*.", "tn") 594BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn") 595BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn") 596 597BUILTIN(__sync_swap, "v.", "t") 598BUILTIN(__sync_swap_1, "ccD*c.", "tn") 599BUILTIN(__sync_swap_2, "ssD*s.", "tn") 600BUILTIN(__sync_swap_4, "iiD*i.", "tn") 601BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn") 602BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn") 603 604// Some of our atomics builtins are handled by AtomicExpr rather than 605// as normal builtin CallExprs. This macro is used for such builtins. 606#ifndef ATOMIC_BUILTIN 607#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS) 608#endif 609 610// C11 _Atomic operations for <stdatomic.h>. 611ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t") 612ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t") 613ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t") 614ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t") 615ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t") 616ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t") 617ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t") 618ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t") 619ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t") 620ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t") 621ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t") 622BUILTIN(__c11_atomic_thread_fence, "vi", "n") 623BUILTIN(__c11_atomic_signal_fence, "vi", "n") 624BUILTIN(__c11_atomic_is_lock_free, "iz", "n") 625 626// GNU atomic builtins. 627ATOMIC_BUILTIN(__atomic_load, "v.", "t") 628ATOMIC_BUILTIN(__atomic_load_n, "v.", "t") 629ATOMIC_BUILTIN(__atomic_store, "v.", "t") 630ATOMIC_BUILTIN(__atomic_store_n, "v.", "t") 631ATOMIC_BUILTIN(__atomic_exchange, "v.", "t") 632ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t") 633ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t") 634ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t") 635ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t") 636ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t") 637ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t") 638ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t") 639ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t") 640ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t") 641ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t") 642ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t") 643ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t") 644ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t") 645ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t") 646ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t") 647BUILTIN(__atomic_test_and_set, "bvD*i", "n") 648BUILTIN(__atomic_clear, "vvD*i", "n") 649BUILTIN(__atomic_thread_fence, "vi", "n") 650BUILTIN(__atomic_signal_fence, "vi", "n") 651BUILTIN(__atomic_always_lock_free, "izvCD*", "n") 652BUILTIN(__atomic_is_lock_free, "izvCD*", "n") 653 654#undef ATOMIC_BUILTIN 655 656// Non-overloaded atomic builtins. 657BUILTIN(__sync_synchronize, "v.", "n") 658// GCC does not support these, they are a Clang extension. 659BUILTIN(__sync_fetch_and_min, "iiD*i", "n") 660BUILTIN(__sync_fetch_and_max, "iiD*i", "n") 661BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n") 662BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n") 663 664// Random libc builtins. 665BUILTIN(__builtin_abort, "v", "Fnr") 666BUILTIN(__builtin_index, "c*cC*i", "Fn") 667BUILTIN(__builtin_rindex, "c*cC*i", "Fn") 668 669// Microsoft builtins. 670BUILTIN(__assume, "vb", "n") 671BUILTIN(__noop, "v.", "n") 672BUILTIN(__debugbreak, "v", "n") 673 674 675// C99 library functions 676// C99 stdlib.h 677LIBBUILTIN(abort, "v", "fr", "stdlib.h", ALL_LANGUAGES) 678LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h", ALL_LANGUAGES) 679LIBBUILTIN(exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) 680LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) 681LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) 682LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) 683// C99 string.h 684LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) 685LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES) 686LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) 687LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) 688LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) 689LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) 690LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES) 691LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) 692LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) 693LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) 694LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h", ALL_LANGUAGES) 695LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) 696LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) 697LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) 698LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) 699LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) 700LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) 701LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) 702LIBBUILTIN(memset, "v*v*iz", "f", "string.h", ALL_LANGUAGES) 703LIBBUILTIN(strerror, "c*i", "f", "string.h", ALL_LANGUAGES) 704LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES) 705// C99 stdio.h 706LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h", ALL_LANGUAGES) 707LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) 708LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h", ALL_LANGUAGES) 709LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) 710LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h", ALL_LANGUAGES) 711LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h", ALL_LANGUAGES) 712LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES) 713LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES) 714LIBBUILTIN(scanf, "icC*R.", "fs:0:", "stdio.h", ALL_LANGUAGES) 715LIBBUILTIN(fscanf, "iP*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) 716LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) 717LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) 718LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) 719LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) 720// C99 721LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) 722 723// Non-C library functions 724// FIXME: Non-C-standard stuff shouldn't be builtins in non-GNU mode! 725LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_LANGUAGES) 726// POSIX string.h 727LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) 728LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) 729LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_LANGUAGES) 730LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_LANGUAGES) 731// POSIX strings.h 732LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) 733LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) 734LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_LANGUAGES) 735// In some systems str[n]casejmp is a macro that expands to _str[n]icmp. 736// We undefine then here to avoid wrong name. 737#undef strcasecmp 738#undef strncasecmp 739LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_LANGUAGES) 740LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_LANGUAGES) 741// POSIX unistd.h 742LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES) 743LIBBUILTIN(vfork, "p", "fj", "unistd.h", ALL_LANGUAGES) 744// POSIX setjmp.h 745 746// In some systems setjmp is a macro that expands to _setjmp. We undefine 747// it here to avoid having two identical LIBBUILTIN entries. 748#undef setjmp 749LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) 750LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) 751LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) 752LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) 753LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) 754LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) 755LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) 756LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES) 757 758LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) 759LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_LANGUAGES) 760// non-standard but very common 761LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) 762LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) 763// id objc_msgSend(id, SEL, ...) 764LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG) 765// long double objc_msgSend_fpret(id self, SEL op, ...) 766LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG) 767// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...) 768LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG) 769// void objc_msgSend_stret (id, SEL, ...) 770LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG) 771// id objc_msgSendSuper(struct objc_super *super, SEL op, ...) 772LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG) 773// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...) 774LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG) 775// id objc_getClass(const char *name) 776LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) 777// id objc_getMetaClass(const char *name) 778LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) 779// void objc_enumerationMutation(id) 780LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG) 781 782// id objc_read_weak(id *location) 783LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG) 784// id objc_assign_weak(id value, id *location) 785LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) 786// id objc_assign_ivar(id value, id dest, ptrdiff_t offset) 787LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG) 788// id objc_assign_global(id val, id *dest) 789LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) 790// id objc_assign_strongCast(id val, id *dest 791LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) 792 793// id objc_exception_extract(void *localExceptionData) 794LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG) 795// void objc_exception_try_enter(void *localExceptionData) 796LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) 797// void objc_exception_try_exit(void *localExceptionData) 798LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) 799// int objc_exception_match(Class exceptionClass, id exception) 800LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG) 801// void objc_exception_throw(id exception) 802LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG) 803 804// int objc_sync_enter(id obj) 805LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG) 806// int objc_sync_exit(id obj) 807LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG) 808 809BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") 810 811// void NSLog(NSString *fmt, ...) 812LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) 813// void NSLogv(NSString *fmt, va_list args) 814LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) 815 816// Builtin math library functions 817LIBBUILTIN(acos, "dd", "fe", "math.h", ALL_LANGUAGES) 818LIBBUILTIN(acosl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 819LIBBUILTIN(acosf, "ff", "fe", "math.h", ALL_LANGUAGES) 820 821LIBBUILTIN(asin, "dd", "fe", "math.h", ALL_LANGUAGES) 822LIBBUILTIN(asinl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 823LIBBUILTIN(asinf, "ff", "fe", "math.h", ALL_LANGUAGES) 824 825LIBBUILTIN(atan, "dd", "fe", "math.h", ALL_LANGUAGES) 826LIBBUILTIN(atanl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 827LIBBUILTIN(atanf, "ff", "fe", "math.h", ALL_LANGUAGES) 828 829LIBBUILTIN(atan2, "ddd", "fe", "math.h", ALL_LANGUAGES) 830LIBBUILTIN(atan2l, "LdLdLd", "fe", "math.h", ALL_LANGUAGES) 831LIBBUILTIN(atan2f, "fff", "fe", "math.h", ALL_LANGUAGES) 832 833LIBBUILTIN(ceil, "dd", "fc", "math.h", ALL_LANGUAGES) 834LIBBUILTIN(ceill, "LdLd", "fc", "math.h", ALL_LANGUAGES) 835LIBBUILTIN(ceilf, "ff", "fc", "math.h", ALL_LANGUAGES) 836 837LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES) 838LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) 839LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) 840 841LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES) 842LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) 843LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) 844 845LIBBUILTIN(copysign, "ddd", "fc", "math.h", ALL_LANGUAGES) 846LIBBUILTIN(copysignl, "LdLdLd", "fc", "math.h", ALL_LANGUAGES) 847LIBBUILTIN(copysignf, "fff", "fc", "math.h", ALL_LANGUAGES) 848 849LIBBUILTIN(cos, "dd", "fe", "math.h", ALL_LANGUAGES) 850LIBBUILTIN(cosl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 851LIBBUILTIN(cosf, "ff", "fe", "math.h", ALL_LANGUAGES) 852 853LIBBUILTIN(exp, "dd", "fe", "math.h", ALL_LANGUAGES) 854LIBBUILTIN(expl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 855LIBBUILTIN(expf, "ff", "fe", "math.h", ALL_LANGUAGES) 856 857LIBBUILTIN(exp2, "dd", "fe", "math.h", ALL_LANGUAGES) 858LIBBUILTIN(exp2l, "LdLd", "fe", "math.h", ALL_LANGUAGES) 859LIBBUILTIN(exp2f, "ff", "fe", "math.h", ALL_LANGUAGES) 860 861LIBBUILTIN(fabs, "dd", "fc", "math.h", ALL_LANGUAGES) 862LIBBUILTIN(fabsl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 863LIBBUILTIN(fabsf, "ff", "fc", "math.h", ALL_LANGUAGES) 864 865LIBBUILTIN(floor, "dd", "fc", "math.h", ALL_LANGUAGES) 866LIBBUILTIN(floorl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 867LIBBUILTIN(floorf, "ff", "fc", "math.h", ALL_LANGUAGES) 868 869LIBBUILTIN(fma, "dddd", "fc", "math.h", ALL_LANGUAGES) 870LIBBUILTIN(fmal, "LdLdLdLd", "fc", "math.h", ALL_LANGUAGES) 871LIBBUILTIN(fmaf, "ffff", "fc", "math.h", ALL_LANGUAGES) 872 873LIBBUILTIN(fmax, "ddd", "fc", "math.h", ALL_LANGUAGES) 874LIBBUILTIN(fmaxl, "LdLdLd", "fc", "math.h", ALL_LANGUAGES) 875LIBBUILTIN(fmaxf, "fff", "fc", "math.h", ALL_LANGUAGES) 876 877LIBBUILTIN(fmin, "ddd", "fc", "math.h", ALL_LANGUAGES) 878LIBBUILTIN(fminl, "LdLdLd", "fc", "math.h", ALL_LANGUAGES) 879LIBBUILTIN(fminf, "fff", "fc", "math.h", ALL_LANGUAGES) 880 881LIBBUILTIN(log, "dd", "fe", "math.h", ALL_LANGUAGES) 882LIBBUILTIN(logl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 883LIBBUILTIN(logf, "ff", "fe", "math.h", ALL_LANGUAGES) 884 885LIBBUILTIN(log2, "dd", "fe", "math.h", ALL_LANGUAGES) 886LIBBUILTIN(log2l, "LdLd", "fe", "math.h", ALL_LANGUAGES) 887LIBBUILTIN(log2f, "ff", "fe", "math.h", ALL_LANGUAGES) 888 889LIBBUILTIN(nearbyint, "dd", "fc", "math.h", ALL_LANGUAGES) 890LIBBUILTIN(nearbyintl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 891LIBBUILTIN(nearbyintf, "ff", "fc", "math.h", ALL_LANGUAGES) 892 893LIBBUILTIN(pow, "ddd", "fe", "math.h", ALL_LANGUAGES) 894LIBBUILTIN(powl, "LdLdLd", "fe", "math.h", ALL_LANGUAGES) 895LIBBUILTIN(powf, "fff", "fe", "math.h", ALL_LANGUAGES) 896 897LIBBUILTIN(rint, "dd", "fc", "math.h", ALL_LANGUAGES) 898LIBBUILTIN(rintl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 899LIBBUILTIN(rintf, "ff", "fc", "math.h", ALL_LANGUAGES) 900 901LIBBUILTIN(round, "dd", "fc", "math.h", ALL_LANGUAGES) 902LIBBUILTIN(roundl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 903LIBBUILTIN(roundf, "ff", "fc", "math.h", ALL_LANGUAGES) 904 905LIBBUILTIN(sin, "dd", "fe", "math.h", ALL_LANGUAGES) 906LIBBUILTIN(sinl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 907LIBBUILTIN(sinf, "ff", "fe", "math.h", ALL_LANGUAGES) 908 909LIBBUILTIN(sqrt, "dd", "fe", "math.h", ALL_LANGUAGES) 910LIBBUILTIN(sqrtl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 911LIBBUILTIN(sqrtf, "ff", "fe", "math.h", ALL_LANGUAGES) 912 913LIBBUILTIN(tan, "dd", "fe", "math.h", ALL_LANGUAGES) 914LIBBUILTIN(tanl, "LdLd", "fe", "math.h", ALL_LANGUAGES) 915LIBBUILTIN(tanf, "ff", "fe", "math.h", ALL_LANGUAGES) 916 917LIBBUILTIN(trunc, "dd", "fc", "math.h", ALL_LANGUAGES) 918LIBBUILTIN(truncl, "LdLd", "fc", "math.h", ALL_LANGUAGES) 919LIBBUILTIN(truncf, "ff", "fc", "math.h", ALL_LANGUAGES) 920 921// Blocks runtime Builtin math library functions 922LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES) 923LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) 924// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. 925 926// Annotation function 927BUILTIN(__builtin_annotation, "v.", "tn") 928 929// Multiprecision Arithmetic Builtins. 930BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n") 931BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n") 932BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n") 933BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n") 934BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n") 935BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n") 936BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n") 937BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n") 938 939#undef BUILTIN 940#undef LIBBUILTIN 941