1//===--- Builtins.td - Builtins function info database-----------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9include "clang/Basic/BuiltinsBase.td" 10 11class FPMathTemplate : Template<["float", "double", "long double"], 12 ["f", "", "l"]>; 13 14class FPMathWithF16Template : 15 Template<["float", "double", "long double", "__fp16"], 16 ["f", "", "l", "f16"]>; 17 18class FPMathWithF16F128Template : 19 Template<["float", "double", "long double", "__fp16", "__float128"], 20 ["f", "", "l", "f16", "f128"]>; 21 22class FPMathWithF128Template : 23 Template<["float", "double", "long double", "__float128"], 24 ["f", "", "l", "f128"]>; 25 26class F16F128MathTemplate : Template<["__fp16", "__float128"], 27 ["f16", "f128"]>; 28 29class IntMathTemplate : Template<["int", "long int", "long long int"], 30 ["", "l", "ll"], /*AsPrefix=*/1>; 31 32class MSInt8_16_32Template : Template<["char", "short", "msint32_t"], 33 ["8", "16", ""]>; 34 35class Int8_16_32_64Template 36 : Template<["char", "short", "int", "long long int"], 37 ["8", "16", "32", "64"]>; 38 39class MSInt8_16_32_64Template 40 : Template<["char", "short", "msint32_t", "long long int"], 41 ["8", "16", "", "64"]>; 42 43class MSInt16_32Template : Template<["short", "msint32_t"], 44 ["16", ""]>; 45 46class MSUInt16_32_64Template : 47 Template<["unsigned short", "unsigned int", "uint64_t"], 48 ["16", "", "64"]>; 49 50class MSInt32_64Template : Template<["msint32_t", "int64_t"], 51 ["", "64"]>; 52 53class FloatDoubleTemplate : Template<["float", "double"], 54 ["f", ""]>; 55 56// FIXME: These assume that char -> i8, short -> i16, int -> i32, 57// long long -> i64. 58class SyncBuiltinsTemplate : 59 Template<["char", "short", "int", "long long int", "__int128_t"], 60 ["1", "2", "4", "8", "16"]>; 61 62class BitInt8_16_32_64BuiltinsTemplate : 63 Template<["unsigned char", "unsigned short", "uint32_t", "uint64_t"], 64 ["8", "16", "32", "64"]>; 65 66class BitShort_Int_Long_LongLongTemplate : 67 Template<["short", "int", "long int", "long long int"], 68 ["s", "", "l", "ll"]>; 69 70class BitInt_Long_LongLongTemplate : 71 Template<["int", "long int", "long long int"], 72 ["", "l", "ll"]>; 73 74// Most of the types used in the prototypes are types from C, C++ or ObjC. There 75// are a few builtin-specific types and qualifiers. 76// 77// builtin-specific types: 78// - __builtin_va_list: This is the internal representation for va_lists 79// - __builtin_va_list_ref: A reference-like type to __builtin_va_list 80// - msint32_t: 'int' size if target is LP64, 'L' otherwise. 81// 82// builtin-specific qualifiers: 83// - _Constant: Argument has to constant-fold to an integer constant expression 84 85// __fp16 and __float128 builtin variants of libc/libm functions. 86def AcosF16F128 : Builtin, F16F128MathTemplate { 87 let Spellings = ["__builtin_acos"]; 88 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 89 ConstIgnoringErrnoAndExceptions]; 90 let Prototype = "T(T)"; 91} 92 93def AcoshF128 : Builtin { 94 let Spellings = ["__builtin_acoshf128"]; 95 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 96 ConstIgnoringErrnoAndExceptions]; 97 let Prototype = "__float128(__float128)"; 98} 99 100def AsinF16F128 : Builtin, F16F128MathTemplate { 101 let Spellings = ["__builtin_asin"]; 102 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 103 ConstIgnoringErrnoAndExceptions]; 104 let Prototype = "T(T)"; 105} 106 107def AsinhF128 : Builtin { 108 let Spellings = ["__builtin_asinhf128"]; 109 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 110 ConstIgnoringErrnoAndExceptions]; 111 let Prototype = "__float128(__float128)"; 112} 113 114def AtanF16F128 : Builtin, F16F128MathTemplate { 115 let Spellings = ["__builtin_atan"]; 116 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 117 ConstIgnoringErrnoAndExceptions]; 118 let Prototype = "T(T)"; 119} 120 121def AtanhF128 : Builtin { 122 let Spellings = ["__builtin_atanhf128"]; 123 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 124 ConstIgnoringErrnoAndExceptions]; 125 let Prototype = "__float128(__float128)"; 126} 127 128def CbrtF128 : Builtin { 129 let Spellings = ["__builtin_cbrtf128"]; 130 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 131 let Prototype = "__float128(__float128)"; 132} 133 134def CeilF16F128 : Builtin, F16F128MathTemplate { 135 let Spellings = ["__builtin_ceil"]; 136 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 137 let Prototype = "T(T)"; 138} 139 140def CosF16F128 : Builtin, F16F128MathTemplate { 141 let Spellings = ["__builtin_cos"]; 142 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 143 let Prototype = "T(T)"; 144} 145 146def CoshF16F128 : Builtin, F16F128MathTemplate { 147 let Spellings = ["__builtin_cosh"]; 148 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 149 let Prototype = "T(T)"; 150} 151 152def ErfF128 : Builtin { 153 let Spellings = ["__builtin_erff128"]; 154 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 155 let Prototype = "__float128(__float128)"; 156} 157 158def ErfcF128 : Builtin { 159 let Spellings = ["__builtin_erfcf128"]; 160 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 161 let Prototype = "__float128(__float128)"; 162} 163 164def ExpF16F128 : Builtin, F16F128MathTemplate { 165 let Spellings = ["__builtin_exp"]; 166 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 167 let Prototype = "T(T)"; 168} 169 170def Exp2F16F128 : Builtin, F16F128MathTemplate { 171 let Spellings = ["__builtin_exp2"]; 172 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 173 let Prototype = "T(T)"; 174} 175 176def Exp10F16F128 : Builtin, F16F128MathTemplate { 177 let Spellings = ["__builtin_exp10"]; 178 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 179 let Prototype = "T(T)"; 180} 181 182def Expm1F128 : Builtin { 183 let Spellings = ["__builtin_expm1f128"]; 184 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 185 let Prototype = "__float128(__float128)"; 186} 187 188def FdimF128 : Builtin { 189 let Spellings = ["__builtin_fdimf128"]; 190 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 191 let Prototype = "__float128(__float128, __float128)"; 192} 193 194def FloorF16F128 : Builtin, F16F128MathTemplate { 195 let Spellings = ["__builtin_floor"]; 196 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 197 let Prototype = "T(T)"; 198} 199 200def FmaF16F128 : Builtin, F16F128MathTemplate { 201 let Spellings = ["__builtin_fma"]; 202 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 203 let Prototype = "T(T, T, T)"; 204} 205 206def FmaxF16F128 : Builtin, F16F128MathTemplate { 207 let Spellings = ["__builtin_fmax"]; 208 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 209 let Prototype = "T(T, T)"; 210} 211 212def FminF16F128 : Builtin, F16F128MathTemplate { 213 let Spellings = ["__builtin_fmin"]; 214 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 215 let Prototype = "T(T, T)"; 216} 217 218def FmaximumNumF16F128 : Builtin, F16F128MathTemplate { 219 let Spellings = ["__builtin_fmaximum_num"]; 220 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 221 let Prototype = "T(T, T)"; 222} 223 224def FminimumNumF16F128 : Builtin, F16F128MathTemplate { 225 let Spellings = ["__builtin_fminimum_num"]; 226 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 227 let Prototype = "T(T, T)"; 228} 229 230def Atan2F16F128 : Builtin, F16F128MathTemplate { 231 let Spellings = ["__builtin_atan2"]; 232 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 233 let Prototype = "T(T, T)"; 234} 235 236def CopysignF16 : Builtin { 237 let Spellings = ["__builtin_copysignf16"]; 238 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 239 let Prototype = "__fp16(__fp16, __fp16)"; 240} 241 242def CopysignF128 : Builtin { 243 let Spellings = ["__builtin_copysignf128"]; 244 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 245 let Prototype = "__float128(__float128, __float128)"; 246} 247 248def FabsF16 : Builtin { 249 let Spellings = ["__builtin_fabsf16"]; 250 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 251 let Prototype = "__fp16(__fp16)"; 252} 253 254def FabsF128 : Builtin { 255 let Spellings = ["__builtin_fabsf128"]; 256 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 257 let Prototype = "__float128(__float128)"; 258} 259 260def FmodF16F128 : F16F128MathTemplate, Builtin { 261 let Spellings = ["__builtin_fmod"]; 262 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 263 let Prototype = "T(T, T)"; 264} 265 266def FrexpF16F128 : F16F128MathTemplate, Builtin { 267 let Spellings = ["__builtin_frexp"]; 268 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 269 let Prototype = "T(T, int*)"; 270} 271 272def HugeVal : Builtin, FPMathWithF128Template { 273 let Spellings = ["__builtin_huge_val"]; 274 let Attributes = [NoThrow, Const, Constexpr]; 275 let Prototype = "T()"; 276} 277 278def HugeValF16 : Builtin { 279 let Spellings = ["__builtin_huge_valf16"]; 280 let Attributes = [NoThrow, Const, Constexpr]; 281 let Prototype = "_Float16()"; 282} 283 284def Inf : Builtin, FPMathWithF128Template { 285 let Spellings = ["__builtin_inf"]; 286 let Attributes = [NoThrow, Const, Constexpr]; 287 let Prototype = "T()"; 288} 289 290def InfF16 : Builtin { 291 let Spellings = ["__builtin_inff16"]; 292 let Attributes = [NoThrow, Const, Constexpr]; 293 let Prototype = "_Float16()"; 294} 295 296def LdexpF16F128 : F16F128MathTemplate, Builtin { 297 let Spellings = ["__builtin_ldexp"]; 298 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 299 let Prototype = "T(T, int)"; 300} 301 302def ModfF128 : Builtin { 303 let Spellings = ["__builtin_modff128"]; 304 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 305 let Prototype = "__float128(__float128, __float128*)"; 306} 307 308// This isn't a FPMathWithF16F128Template because the f16 309// version takes a _Float16 for some reason. 310def NanF16 : Builtin { 311 let Spellings = ["__builtin_nanf16"]; 312 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr]; 313 let Prototype = "_Float16(char const*)"; 314} 315 316def NanF128 : Builtin { 317 let Spellings = ["__builtin_nanf128"]; 318 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr]; 319 let Prototype = "__float128(char const*)"; 320} 321 322def Nans : Builtin, 323 Template<["float", "double", "long double", "_Float16", "__float128"], 324 ["f", "", "l", "f16", "f128"]> { 325 let Spellings = ["__builtin_nans"]; 326 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr]; 327 let Prototype = "T(char const*)"; 328} 329 330def PowI : Builtin, FPMathTemplate { 331 let Spellings = ["__builtin_powi"]; 332 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 333 let Prototype = "T(T, int)"; 334} 335 336def PowF16F128 : Builtin, F16F128MathTemplate { 337 let Spellings = ["__builtin_pow"]; 338 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 339 let Prototype = "T(T, T)"; 340} 341 342def HypotF128 : Builtin { 343 let Spellings = ["__builtin_hypotf128"]; 344 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 345 let Prototype = "__float128(__float128, __float128)"; 346} 347 348def ILogbF128 : Builtin { 349 let Spellings = ["__builtin_ilogbf128"]; 350 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 351 let Prototype = "int(__float128)"; 352} 353 354def LgammaF128 : Builtin { 355 let Spellings = ["__builtin_lgammaf128"]; 356 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 357 let Prototype = "__float128(__float128)"; 358} 359 360def LLrintF128 : Builtin { 361 let Spellings = ["__builtin_llrintf128"]; 362 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 363 let Prototype = "long long int(__float128)"; 364} 365 366def LLroundF128 : Builtin { 367 let Spellings = ["__builtin_llroundf128"]; 368 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 369 let Prototype = "long long int(__float128)"; 370} 371 372def Log10F16F128 : Builtin, F16F128MathTemplate { 373 let Spellings = ["__builtin_log10"]; 374 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 375 let Prototype = "T(T)"; 376} 377 378def Log1pF128 : Builtin { 379 let Spellings = ["__builtin_log1pf128"]; 380 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 381 let Prototype = "__float128(__float128)"; 382} 383 384def Log2F16F128 : Builtin, F16F128MathTemplate { 385 let Spellings = ["__builtin_log2"]; 386 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 387 let Prototype = "T(T)"; 388} 389 390def LogbF128 : Builtin { 391 let Spellings = ["__builtin_logbf128"]; 392 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 393 let Prototype = "__float128(__float128)"; 394} 395 396def LogF16F128 : Builtin, F16F128MathTemplate { 397 let Spellings = ["__builtin_log"]; 398 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 399 let Prototype = "T(T)"; 400} 401 402def LrintF128 : Builtin { 403 let Spellings = ["__builtin_lrintf128"]; 404 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 405 let Prototype = "long int(__float128)"; 406} 407 408def LroundF128 : Builtin { 409 let Spellings = ["__builtin_lroundf128"]; 410 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 411 let Prototype = "long int(__float128)"; 412} 413 414def NearbyintF128 : Builtin { 415 let Spellings = ["__builtin_nearbyintf128"]; 416 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 417 let Prototype = "__float128(__float128)"; 418} 419 420def NextafterF128 : Builtin { 421 let Spellings = ["__builtin_nextafterf128"]; 422 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 423 let Prototype = "__float128(__float128, __float128)"; 424} 425 426def NexttowardF128 : Builtin { 427 let Spellings = ["__builtin_nexttowardf128"]; 428 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 429 let Prototype = "__float128(__float128, __float128)"; 430} 431 432def RemainderF128 : Builtin { 433 let Spellings = ["__builtin_remainderf128"]; 434 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions]; 435 let Prototype = "__float128(__float128, __float128)"; 436} 437 438def RemquoF128 : Builtin { 439 let Spellings = ["__builtin_remquof128"]; 440 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 441 let Prototype = "__float128(__float128, __float128, int*)"; 442} 443 444def RintF16F128 : Builtin, F16F128MathTemplate { 445 let Spellings = ["__builtin_rint"]; 446 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 447 let Prototype = "T(T)"; 448} 449 450def RoundF16F128 : Builtin, F16F128MathTemplate { 451 let Spellings = ["__builtin_round"]; 452 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 453 let Prototype = "T(T)"; 454} 455 456def RoundevenF16F128 : Builtin, F16F128MathTemplate { 457 let Spellings = ["__builtin_roundeven"]; 458 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 459 let Prototype = "T(T)"; 460} 461 462def ScanlblnF128 : Builtin { 463 let Spellings = ["__builtin_scalblnf128"]; 464 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 465 ConstIgnoringErrnoAndExceptions]; 466 let Prototype = "__float128(__float128, long int)"; 467} 468 469def ScanlbnF128 : Builtin { 470 let Spellings = ["__builtin_scalbnf128"]; 471 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 472 ConstIgnoringErrnoAndExceptions]; 473 let Prototype = "__float128(__float128, int)"; 474} 475 476def SinF16F128 : Builtin, F16F128MathTemplate { 477 let Spellings = ["__builtin_sin"]; 478 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 479 ConstIgnoringErrnoAndExceptions]; 480 let Prototype = "T(T)"; 481} 482 483def SinhF16F128 : Builtin, F16F128MathTemplate { 484 let Spellings = ["__builtin_sinh"]; 485 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 486 ConstIgnoringErrnoAndExceptions]; 487 let Prototype = "T(T)"; 488} 489 490def SqrtF16F128 : Builtin, F16F128MathTemplate { 491 let Spellings = ["__builtin_sqrt"]; 492 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 493 ConstIgnoringErrnoAndExceptions]; 494 let Prototype = "T(T)"; 495} 496 497def TanF16F128 : Builtin, F16F128MathTemplate { 498 let Spellings = ["__builtin_tan"]; 499 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 500 ConstIgnoringErrnoAndExceptions]; 501 let Prototype = "T(T)"; 502} 503 504def TanhF16F128 : Builtin, F16F128MathTemplate { 505 let Spellings = ["__builtin_tanh"]; 506 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 507 ConstIgnoringErrnoAndExceptions]; 508 let Prototype = "T(T)"; 509} 510 511def TgammaF128 : Builtin { 512 let Spellings = ["__builtin_tgammaf128"]; 513 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 514 ConstIgnoringErrnoAndExceptions]; 515 let Prototype = "__float128(__float128)"; 516} 517 518def TruncF16F128 : Builtin, F16F128MathTemplate { 519 let Spellings = ["__builtin_trunc"]; 520 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const]; 521 let Prototype = "T(T)"; 522} 523 524// Access to floating point environment. 525def BuiltinFltRounds : Builtin { 526 let Spellings = ["__builtin_flt_rounds"]; 527 let Attributes = [NoThrow]; 528 let Prototype = "int()"; 529} 530 531def BuiltinSetFltRounds : Builtin { 532 let Spellings = ["__builtin_set_flt_rounds"]; 533 let Attributes = [NoThrow]; 534 let Prototype = "void(int)"; 535} 536 537// GCC-compatible C99 CMPLX implementation. 538def BuiltinComplex : Builtin { 539 let Spellings = ["__builtin_complex"]; 540 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 541 let Prototype = "void(...)"; 542} 543 544// FP Comparison functions. 545def IsGreater : Builtin { 546 let Spellings = ["__builtin_isgreater"]; 547 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 548 CustomTypeChecking, Constexpr]; 549 let Prototype = "int(...)"; 550} 551 552def IsGreaterEqual : Builtin { 553 let Spellings = ["__builtin_isgreaterequal"]; 554 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 555 CustomTypeChecking, Constexpr]; 556 let Prototype = "int(...)"; 557} 558 559def IsLess : Builtin { 560 let Spellings = ["__builtin_isless"]; 561 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 562 CustomTypeChecking, Constexpr]; 563 let Prototype = "int(...)"; 564} 565 566def IsLessEqual : Builtin { 567 let Spellings = ["__builtin_islessequal"]; 568 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 569 CustomTypeChecking, Constexpr]; 570 let Prototype = "int(...)"; 571} 572 573def IsLessGreater : Builtin { 574 let Spellings = ["__builtin_islessgreater"]; 575 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 576 CustomTypeChecking, Constexpr]; 577 let Prototype = "int(...)"; 578} 579 580def IsUnordered : Builtin { 581 let Spellings = ["__builtin_isunordered"]; 582 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 583 CustomTypeChecking, Constexpr]; 584 let Prototype = "int(...)"; 585} 586 587// Unary FP classification. 588def FPClassify : Builtin { 589 let Spellings = ["__builtin_fpclassify"]; 590 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 591 CustomTypeChecking, Constexpr]; 592 let Prototype = "int(int, int, int, int, int, ...)"; 593} 594 595def IsFinite : Builtin { 596 let Spellings = ["__builtin_isfinite"]; 597 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 598 CustomTypeChecking, Constexpr]; 599 let Prototype = "int(...)"; 600} 601 602def IsInf : Builtin { 603 let Spellings = ["__builtin_isinf"]; 604 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 605 CustomTypeChecking, Constexpr]; 606 let Prototype = "int(...)"; 607} 608 609def IsInfSign : Builtin { 610 let Spellings = ["__builtin_isinf_sign"]; 611 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 612 CustomTypeChecking, Constexpr]; 613 let Prototype = "int(...)"; 614} 615 616def IsNan : Builtin { 617 let Spellings = ["__builtin_isnan"]; 618 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 619 CustomTypeChecking, Constexpr]; 620 let Prototype = "int(...)"; 621} 622 623def IsNormal : Builtin { 624 let Spellings = ["__builtin_isnormal"]; 625 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 626 CustomTypeChecking, Constexpr]; 627 let Prototype = "int(...)"; 628} 629 630def IsSubnormal : Builtin { 631 let Spellings = ["__builtin_issubnormal"]; 632 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 633 CustomTypeChecking, Constexpr]; 634 let Prototype = "int(...)"; 635} 636 637def IsZero : Builtin { 638 let Spellings = ["__builtin_iszero"]; 639 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 640 CustomTypeChecking, Constexpr]; 641 let Prototype = "int(...)"; 642} 643 644def IsSignaling : Builtin { 645 let Spellings = ["__builtin_issignaling"]; 646 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 647 CustomTypeChecking, Constexpr]; 648 let Prototype = "int(...)"; 649} 650 651def IsFPClass : Builtin { 652 let Spellings = ["__builtin_isfpclass"]; 653 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 654 let Prototype = "int(...)"; 655} 656 657// FP signbit builtins. 658def Signbit : Builtin { 659 let Spellings = ["__builtin_signbit"]; 660 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 661 CustomTypeChecking, Constexpr]; 662 let Prototype = "int(...)"; 663} 664 665def SignbitF : Builtin { 666 let Spellings = ["__builtin_signbitf"]; 667 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 668 Constexpr]; 669 let Prototype = "int(float)"; 670} 671 672def SignbitL : Builtin { 673 let Spellings = ["__builtin_signbitl"]; 674 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 675 Constexpr]; 676 let Prototype = "int(long double)"; 677} 678 679// Special FP builtins. 680def Canonicalize : Builtin, FPMathWithF16Template { 681 let Spellings = ["__builtin_canonicalize"]; 682 let Attributes = [NoThrow, Const]; 683 let Prototype = "T(T)"; 684} 685 686// Builtins for arithmetic. 687def Clz : Builtin, BitShort_Int_Long_LongLongTemplate { 688 let Spellings = ["__builtin_clz"]; 689 let Attributes = [NoThrow, Const, Constexpr]; 690 let Prototype = "int(unsigned T)"; 691} 692 693def Clzg : Builtin { 694 let Spellings = ["__builtin_clzg"]; 695 let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking]; 696 let Prototype = "int(...)"; 697} 698 699def Ctz : Builtin, BitShort_Int_Long_LongLongTemplate { 700 let Spellings = ["__builtin_ctz"]; 701 let Attributes = [NoThrow, Const, Constexpr]; 702 let Prototype = "int(unsigned T)"; 703} 704 705def Ctzg : Builtin { 706 let Spellings = ["__builtin_ctzg"]; 707 let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking]; 708 let Prototype = "int(...)"; 709} 710 711def FFS : Builtin, BitInt_Long_LongLongTemplate { 712 let Spellings = ["__builtin_ffs"]; 713 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr]; 714 let Prototype = "int(T)"; 715} 716 717def Parity : Builtin, BitInt_Long_LongLongTemplate { 718 let Spellings = ["__builtin_parity"]; 719 let Attributes = [NoThrow, Const, Constexpr]; 720 let Prototype = "int(unsigned T)"; 721} 722 723def Popcount : Builtin, BitInt_Long_LongLongTemplate { 724 let Spellings = ["__builtin_popcount"]; 725 let Attributes = [NoThrow, Const, Constexpr]; 726 let Prototype = "int(unsigned T)"; 727} 728 729def Popcountg : Builtin { 730 let Spellings = ["__builtin_popcountg"]; 731 let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking]; 732 let Prototype = "int(...)"; 733} 734 735def Clrsb : Builtin, BitInt_Long_LongLongTemplate { 736 let Spellings = ["__builtin_clrsb"]; 737 let Attributes = [NoThrow, Const, Constexpr]; 738 let Prototype = "int(T)"; 739} 740 741// The following builtins rely on that char == 8 bits, short == 16 bits and that 742// there exists native types on the target that are 32- and 64-bits wide, unless 743// these conditions are fulfilled these builtins will operate on a not intended 744// bitwidth. 745def BSwap : Builtin, Template<["unsigned short", "uint32_t", "uint64_t"], 746 ["16", "32", "64"]> { 747 let Spellings = ["__builtin_bswap"]; 748 let Attributes = [NoThrow, Const, Constexpr]; 749 let Prototype = "T(T)"; 750} 751 752def Bitreverse : BitInt8_16_32_64BuiltinsTemplate, Builtin { 753 let Spellings = ["__builtin_bitreverse"]; 754 let Attributes = [NoThrow, Const, Constexpr]; 755 let Prototype = "T(T)"; 756} 757 758def RotateLeft : BitInt8_16_32_64BuiltinsTemplate, Builtin { 759 let Spellings = ["__builtin_rotateleft"]; 760 let Attributes = [NoThrow, Const, Constexpr]; 761 let Prototype = "T(T, T)"; 762} 763 764def RotateRight : BitInt8_16_32_64BuiltinsTemplate, Builtin { 765 let Spellings = ["__builtin_rotateright"]; 766 let Attributes = [NoThrow, Const, Constexpr]; 767 let Prototype = "T(T, T)"; 768} 769 770// Random GCC builtins 771// FIXME: The builtins marked FunctionWithBuiltinPrefix below should be 772// merged with the library definitions. They are currently not because 773// the attributes are different. 774 775// Builtins for checking CPU features based on the GCC builtins. 776def BuiltinCPUIs : Builtin { 777 let Spellings = ["__builtin_cpu_is"]; 778 let Attributes = [NoThrow, Const]; 779 let Prototype = "bool(char const*)"; 780} 781 782def BuiltinCPUSupports : Builtin { 783 let Spellings = ["__builtin_cpu_supports"]; 784 let Attributes = [NoThrow, Const]; 785 let Prototype = "bool(char const*)"; 786} 787 788def BuiltinCPUInit : Builtin { 789 let Spellings = ["__builtin_cpu_init"]; 790 let Attributes = [NoThrow]; 791 let Prototype = "void()"; 792} 793 794def BuiltinCalloc : Builtin { 795 let Spellings = ["__builtin_calloc"]; 796 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 797 let Prototype = "void*(size_t, size_t)"; 798} 799 800def BuiltinConstantP : Builtin { 801 let Spellings = ["__builtin_constant_p"]; 802 let Attributes = [NoThrow, Const, CustomTypeChecking, UnevaluatedArguments, Constexpr]; 803 let Prototype = "int(...)"; 804} 805 806def BuiltinClassifyType : Builtin { 807 let Spellings = ["__builtin_classify_type"]; 808 let Attributes = [NoThrow, Const, CustomTypeChecking, UnevaluatedArguments, Constexpr]; 809 let Prototype = "int(...)"; 810} 811 812def BuiltinCFStringMakeConstantString : Builtin { 813 let Spellings = ["__builtin___CFStringMakeConstantString"]; 814 let Attributes = [NoThrow, Const, Constexpr]; 815 let Prototype = "constant_CFString const*(char const*)"; 816} 817 818def BuiltinNSStringMakeConstantString : Builtin { 819 let Spellings = ["__builtin___NSStringMakeConstantString"]; 820 let Attributes = [NoThrow, Const, Constexpr]; 821 let Prototype = "constant_CFString const*(char const*)"; 822} 823 824def BuiltinVaStart : Builtin { 825 let Spellings = ["__builtin_va_start"]; 826 let Attributes = [NoThrow, CustomTypeChecking]; 827 let Prototype = "void(__builtin_va_list_ref, ...)"; 828} 829 830def BuiltinStdargStart : Builtin { 831 let Spellings = ["__builtin_stdarg_start"]; 832 let Attributes = [NoThrow, CustomTypeChecking]; 833 let Prototype = "void(__builtin_va_list_ref, ...)"; 834} 835 836def BuiltinAssumeAligned : Builtin { 837 let Spellings = ["__builtin_assume_aligned"]; 838 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 839 let Prototype = "void*(void const*, size_t, ...)"; 840} 841 842def BuiltinFree : Builtin { 843 let Spellings = ["__builtin_free"]; 844 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 845 let Prototype = "void(void*)"; 846} 847 848def BuiltinMalloc : Builtin { 849 let Spellings = ["__builtin_malloc"]; 850 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 851 let Prototype = "void*(size_t)"; 852} 853 854def BuiltinMemcpyInline : Builtin { 855 let Spellings = ["__builtin_memcpy_inline"]; 856 let Attributes = [NoThrow]; 857 let Prototype = "void(void*, void const*, _Constant size_t)"; 858} 859 860def BuiltinMempcpy : Builtin { 861 let Spellings = ["__builtin_mempcpy"]; 862 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 863 let Prototype = "void*(void*, void const*, size_t)"; 864} 865 866def BuiltinMemsetInline : Builtin { 867 let Spellings = ["__builtin_memset_inline"]; 868 let Attributes = [NoThrow]; 869 let Prototype = "void(void*, int, _Constant size_t)"; 870} 871 872def BuiltinStrcspn : Builtin { 873 let Spellings = ["__builtin_strcspn"]; 874 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 875 let Prototype = "size_t(char const*, char const*)"; 876} 877 878def BuiltinRealloc : Builtin { 879 let Spellings = ["__builtin_realloc"]; 880 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 881 let Prototype = "void*(void*, size_t)"; 882} 883 884def BuiltinReturnAddress : Builtin { 885 let Spellings = ["__builtin_return_address"]; 886 let Attributes = [NoThrow]; 887 let Prototype = "void*(_Constant unsigned int)"; 888} 889 890def ExtractReturnAddr : Builtin { 891 let Spellings = ["__builtin_extract_return_addr"]; 892 let Attributes = [NoThrow]; 893 let Prototype = "void*(void*)"; 894} 895 896def FrameAddress : Builtin { 897 let Spellings = ["__builtin_frame_address"]; 898 let Attributes = [NoThrow]; 899 let Prototype = "void*(_Constant unsigned int)"; 900} 901 902def ClearCache : Builtin { 903 let Spellings = ["__builtin___clear_cache"]; 904 let Attributes = [NoThrow]; 905 let Prototype = "void(char*, char*)"; 906} 907 908def BuiltinSetjmp : Builtin { 909 let Spellings = ["__builtin_setjmp"]; 910 let Attributes = [ReturnsTwice]; 911 let Prototype = "int(void**)"; 912} 913 914def BuiltinLongjmp : Builtin { 915 let Spellings = ["__builtin_longjmp"]; 916 let Attributes = [NoReturn]; 917 let Prototype = "void(void**, int)"; 918} 919 920def UnwindInit : Builtin { 921 let Spellings = ["__builtin_unwind_init"]; 922 let Prototype = "void()"; 923} 924 925def EHReturnDataRegNo : Builtin { 926 let Spellings = ["__builtin_eh_return_data_regno"]; 927 let Attributes = [NoThrow, Const, Constexpr]; 928 let Prototype = "int(_Constant int)"; 929} 930 931def ThreadPointer : Builtin { 932 let Spellings = ["__builtin_thread_pointer"]; 933 let Attributes = [NoThrow, Const]; 934 let Prototype = "void*()"; 935} 936 937def Launder : Builtin { 938 let Spellings = ["__builtin_launder"]; 939 let Attributes = [NoThrow, CustomTypeChecking, Constexpr]; 940 let Prototype = "void*(void*)"; 941} 942 943def IsConstantEvaluated : LangBuiltin<"CXX_LANG"> { 944 let Spellings = ["__builtin_is_constant_evaluated"]; 945 let Attributes = [NoThrow, Constexpr]; 946 let Prototype = "bool()"; 947} 948 949def IsWithinLifetime : LangBuiltin<"CXX_LANG"> { 950 let Spellings = ["__builtin_is_within_lifetime"]; 951 let Attributes = [NoThrow, CustomTypeChecking, Consteval]; 952 let Prototype = "bool(void*)"; 953} 954 955// GCC exception builtins 956def EHReturn : Builtin { 957 let Spellings = ["__builtin_eh_return"]; 958 let Attributes = [NoReturn]; 959 // FIXME: Takes intptr_t, not size_t! 960 let Prototype = "void(size_t, void*)"; 961} 962 963def FrobReturnAddr : Builtin { 964 let Spellings = ["__builtin_frob_return_addr"]; 965 let Attributes = [NoThrow]; 966 let Prototype = "void*(void*)"; 967} 968 969def DWARF_CFA : Builtin { 970 let Spellings = ["__builtin_dwarf_cfa"]; 971 let Attributes = [NoThrow]; 972 let Prototype = "void*()"; 973} 974 975def InitDWARFRegSizeTable : Builtin { 976 let Spellings = ["__builtin_init_dwarf_reg_size_table"]; 977 let Attributes = [NoThrow]; 978 let Prototype = "void(void*)"; 979} 980 981def DWARFSpColumn : Builtin { 982 let Spellings = ["__builtin_dwarf_sp_column"]; 983 let Attributes = [NoThrow]; 984 let Prototype = "unsigned int()"; 985} 986 987def ExtendPointer : Builtin { 988 let Spellings = ["__builtin_extend_pointer"]; 989 let Attributes = [NoThrow]; 990 // _Unwind_Word == uint64_t 991 let Prototype = "unsigned long long int(void*)"; 992} 993 994// GCC Object size checking builtins. 995def ObjectSize : Builtin { 996 let Spellings = ["__builtin_object_size"]; 997 let Attributes = [NoThrow, UnevaluatedArguments, Constexpr]; 998 let Prototype = "size_t(void const*, int)"; 999} 1000 1001def DynamicObjectSize : Builtin { // Clang only 1002 let Spellings = ["__builtin_dynamic_object_size"]; 1003 let Attributes = [NoThrow, UnevaluatedArguments, Constexpr]; 1004 let Prototype = "size_t(void const*, int)"; 1005} 1006 1007def MemcpyChk : Builtin { 1008 let Spellings = ["__builtin___memcpy_chk"]; 1009 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1010 let Prototype = "void*(void*, void const*, size_t, size_t)"; 1011} 1012 1013def MemccpyChk : Builtin { 1014 let Spellings = ["__builtin___memccpy_chk"]; 1015 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1016 let Prototype = "void*(void*, void const*, int, size_t, size_t)"; 1017} 1018 1019def MemmoveChk : Builtin { 1020 let Spellings = ["__builtin___memmove_chk"]; 1021 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1022 let Prototype = "void*(void*, void const*, size_t, size_t)"; 1023} 1024 1025def MempcpyChk : Builtin { 1026 let Spellings = ["__builtin___mempcpy_chk"]; 1027 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1028 let Prototype = "void*(void*, void const*, size_t, size_t)"; 1029} 1030 1031def MemsetChk : Builtin { 1032 let Spellings = ["__builtin___memset_chk"]; 1033 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1034 let Prototype = "void*(void*, int, size_t, size_t)"; 1035} 1036 1037def StpcpyChk : Builtin { 1038 let Spellings = ["__builtin___stpcpy_chk"]; 1039 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1040 let Prototype = "char*(char*, char const*, size_t)"; 1041} 1042 1043def StrcatChk : Builtin { 1044 let Spellings = ["__builtin___strcat_chk"]; 1045 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1046 let Prototype = "char*(char*, char const*, size_t)"; 1047} 1048 1049def StrcpyChk : Builtin { 1050 let Spellings = ["__builtin___strcpy_chk"]; 1051 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1052 let Prototype = "char*(char*, char const*, size_t)"; 1053} 1054 1055def StrlcatChk : Builtin { 1056 let Spellings = ["__builtin___strlcat_chk"]; 1057 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1058 let Prototype = "size_t(char*, char const*, size_t, size_t)"; 1059} 1060 1061def StrlcpyChk : Builtin { 1062 let Spellings = ["__builtin___strlcpy_chk"]; 1063 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1064 let Prototype = "size_t(char*, char const*, size_t, size_t)"; 1065} 1066 1067def StrncatChk : Builtin { 1068 let Spellings = ["__builtin___strncat_chk"]; 1069 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1070 let Prototype = "char*(char*, char const*, size_t, size_t)"; 1071} 1072 1073def StrncpyChk : Builtin { 1074 let Spellings = ["__builtin___strncpy_chk"]; 1075 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1076 let Prototype = "char*(char*, char const*, size_t, size_t)"; 1077} 1078 1079def StpncpyChk : Builtin { 1080 let Spellings = ["__builtin___stpncpy_chk"]; 1081 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1082 let Prototype = "char*(char*, char const*, size_t, size_t)"; 1083} 1084 1085def SNPrintfChk : Builtin { 1086 let Spellings = ["__builtin___snprintf_chk"]; 1087 let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<4>]; 1088 let Prototype = "int(char* restrict, size_t, int, size_t, char const* restrict, ...)"; 1089} 1090 1091def SPrintfChk : Builtin { 1092 let Spellings = ["__builtin___sprintf_chk"]; 1093 let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<3>]; 1094 let Prototype = "int(char* restrict, int, size_t, char const* restrict, ...)"; 1095} 1096 1097def VSNPrintfChk : Builtin { 1098 let Spellings = ["__builtin___vsnprintf_chk"]; 1099 let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<4>]; 1100 let Prototype = "int(char* restrict, size_t, int, size_t, char const* restrict, __builtin_va_list)"; 1101} 1102 1103def VSPrintfChk : Builtin { 1104 let Spellings = ["__builtin___vsprintf_chk"]; 1105 let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<3>]; 1106 let Prototype = "int(char* restrict, int, size_t, char const* restrict, __builtin_va_list)"; 1107} 1108 1109def FPrintfChk : Builtin { 1110 let Spellings = ["__builtin___fprintf_chk"]; 1111 let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<2>]; 1112 let Prototype = "int(FILE* restrict, int, char const* restrict, ...)"; 1113} 1114 1115def PrintfChk : Builtin { 1116 let Spellings = ["__builtin___printf_chk"]; 1117 let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<1>]; 1118 let Prototype = "int(int, char const* restrict, ...)"; 1119} 1120 1121def VFPrintfChk : Builtin { 1122 let Spellings = ["__builtin___vfprintf_chk"]; 1123 let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<2>]; 1124 let Prototype = "int(FILE* restrict, int, char const* restrict, __builtin_va_list)"; 1125} 1126 1127def VPrintfChk : Builtin { 1128 let Spellings = ["__builtin___vprintf_chk"]; 1129 let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<1>]; 1130 let Prototype = "int(int, char const* restrict, __builtin_va_list)"; 1131} 1132 1133def Unpredictable : Builtin { 1134 let Spellings = ["__builtin_unpredictable"]; 1135 let Attributes = [NoThrow, Const]; 1136 let Prototype = "long int(long int)"; 1137} 1138 1139def Expect : Builtin { 1140 let Spellings = ["__builtin_expect"]; 1141 let Attributes = [NoThrow, Const, Constexpr]; 1142 let Prototype = "long int(long int, long int)"; 1143} 1144 1145def ExpectWithProbability : Builtin { 1146 let Spellings = ["__builtin_expect_with_probability"]; 1147 let Attributes = [NoThrow, Const, Constexpr]; 1148 let Prototype = "long int(long int, long int, double)"; 1149} 1150 1151def Prefetch : Builtin { 1152 let Spellings = ["__builtin_prefetch"]; 1153 let Attributes = [NoThrow, Const]; 1154 let Prototype = "void(void const*, ...)"; 1155} 1156 1157def ReadCycleCounter : Builtin { 1158 let Spellings = ["__builtin_readcyclecounter"]; 1159 let Attributes = [NoThrow]; 1160 let Prototype = "unsigned long long int()"; 1161} 1162 1163def ReadSteadyCounter : Builtin { 1164 let Spellings = ["__builtin_readsteadycounter"]; 1165 let Attributes = [NoThrow]; 1166 let Prototype = "unsigned long long int()"; 1167} 1168 1169def Trap : Builtin { 1170 let Spellings = ["__builtin_trap"]; 1171 let Attributes = [NoThrow, NoReturn]; 1172 let Prototype = "void()"; 1173} 1174 1175def VerboseTrap : Builtin { 1176 let Spellings = ["__builtin_verbose_trap"]; 1177 let Attributes = [NoThrow, NoReturn]; 1178 let Prototype = "void(char const*, char const*)"; 1179} 1180 1181def Debugtrap : Builtin { 1182 let Spellings = ["__builtin_debugtrap"]; 1183 let Attributes = [NoThrow]; 1184 let Prototype = "void()"; 1185} 1186 1187def Unreachable : Builtin { 1188 let Spellings = ["__builtin_unreachable"]; 1189 let Attributes = [NoThrow, NoReturn]; 1190 let Prototype = "void()"; 1191} 1192 1193def AllowRuntimeCheck : Builtin { 1194 let Spellings = ["__builtin_allow_runtime_check"]; 1195 let Attributes = [NoThrow, Pure, Const]; 1196 let Prototype = "bool(char const*)"; 1197} 1198 1199def ShuffleVector : Builtin { 1200 let Spellings = ["__builtin_shufflevector"]; 1201 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1202 let Prototype = "void(...)"; 1203} 1204 1205def ConvertVector : Builtin { 1206 let Spellings = ["__builtin_convertvector"]; 1207 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1208 let Prototype = "void(...)"; 1209} 1210 1211def AllocaUninitialized : Builtin { 1212 let Spellings = ["__builtin_alloca_uninitialized"]; 1213 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1214 let Prototype = "void*(size_t)"; 1215} 1216 1217def AllocaWithAlign : Builtin { 1218 let Spellings = ["__builtin_alloca_with_align"]; 1219 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1220 let Prototype = "void*(size_t, _Constant size_t)"; 1221} 1222 1223def AllocaWithAlignUninitialized : Builtin { 1224 let Spellings = ["__builtin_alloca_with_align_uninitialized"]; 1225 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 1226 let Prototype = "void*(size_t, _Constant size_t)"; 1227} 1228 1229def CallWithStaticChain : Builtin { 1230 let Spellings = ["__builtin_call_with_static_chain"]; 1231 let Attributes = [NoThrow, CustomTypeChecking]; 1232 let Prototype = "void(...)"; 1233} 1234 1235def NondetermenisticValue : Builtin { 1236 let Spellings = ["__builtin_nondeterministic_value"]; 1237 let Attributes = [NoThrow, CustomTypeChecking]; 1238 let Prototype = "void(...)"; 1239} 1240 1241def ElementwiseAbs : Builtin { 1242 let Spellings = ["__builtin_elementwise_abs"]; 1243 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1244 let Prototype = "void(...)"; 1245} 1246 1247def ElementwiseACos : Builtin { 1248 let Spellings = ["__builtin_elementwise_acos"]; 1249 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1250 let Prototype = "void(...)"; 1251} 1252 1253def ElementwiseASin : Builtin { 1254 let Spellings = ["__builtin_elementwise_asin"]; 1255 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1256 let Prototype = "void(...)"; 1257} 1258 1259def ElementwiseATan : Builtin { 1260 let Spellings = ["__builtin_elementwise_atan"]; 1261 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1262 let Prototype = "void(...)"; 1263} 1264 1265def ElementwiseATan2 : Builtin { 1266 let Spellings = ["__builtin_elementwise_atan2"]; 1267 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1268 let Prototype = "void(...)"; 1269} 1270 1271def ElementwiseBitreverse : Builtin { 1272 let Spellings = ["__builtin_elementwise_bitreverse"]; 1273 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1274 let Prototype = "void(...)"; 1275} 1276 1277def ElementwiseMax : Builtin { 1278 let Spellings = ["__builtin_elementwise_max"]; 1279 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1280 let Prototype = "void(...)"; 1281} 1282 1283def ElementwiseMin : Builtin { 1284 let Spellings = ["__builtin_elementwise_min"]; 1285 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1286 let Prototype = "void(...)"; 1287} 1288 1289def ElementwiseMaximum : Builtin { 1290 let Spellings = ["__builtin_elementwise_maximum"]; 1291 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1292 let Prototype = "void(...)"; 1293} 1294 1295def ElementwiseMinimum : Builtin { 1296 let Spellings = ["__builtin_elementwise_minimum"]; 1297 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1298 let Prototype = "void(...)"; 1299} 1300 1301def ElementwiseCeil : Builtin { 1302 let Spellings = ["__builtin_elementwise_ceil"]; 1303 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1304 let Prototype = "void(...)"; 1305} 1306 1307def ElementwiseCos : Builtin { 1308 let Spellings = ["__builtin_elementwise_cos"]; 1309 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1310 let Prototype = "void(...)"; 1311} 1312 1313def ElementwiseCosh : Builtin { 1314 let Spellings = ["__builtin_elementwise_cosh"]; 1315 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1316 let Prototype = "void(...)"; 1317} 1318 1319def ElementwiseExp : Builtin { 1320 let Spellings = ["__builtin_elementwise_exp"]; 1321 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1322 let Prototype = "void(...)"; 1323} 1324 1325def ElementwiseExp2 : Builtin { 1326 let Spellings = ["__builtin_elementwise_exp2"]; 1327 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1328 let Prototype = "void(...)"; 1329} 1330 1331def ElementwiseFloor : Builtin { 1332 let Spellings = ["__builtin_elementwise_floor"]; 1333 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1334 let Prototype = "void(...)"; 1335} 1336 1337def ElementwiseLog : Builtin { 1338 let Spellings = ["__builtin_elementwise_log"]; 1339 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1340 let Prototype = "void(...)"; 1341} 1342 1343def ElementwiseLog2 : Builtin { 1344 let Spellings = ["__builtin_elementwise_log2"]; 1345 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1346 let Prototype = "void(...)"; 1347} 1348 1349def ElementwiseLog10 : Builtin { 1350 let Spellings = ["__builtin_elementwise_log10"]; 1351 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1352 let Prototype = "void(...)"; 1353} 1354 1355def ElementwisePopcount : Builtin { 1356 let Spellings = ["__builtin_elementwise_popcount"]; 1357 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1358 let Prototype = "void(...)"; 1359} 1360 1361def ElementwiseFmod : Builtin { 1362 let Spellings = ["__builtin_elementwise_fmod"]; 1363 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1364 let Prototype = "void(...)"; 1365} 1366 1367def ElementwisePow : Builtin { 1368 let Spellings = ["__builtin_elementwise_pow"]; 1369 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1370 let Prototype = "void(...)"; 1371} 1372 1373def ElementwiseRoundEven : Builtin { 1374 let Spellings = ["__builtin_elementwise_roundeven"]; 1375 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1376 let Prototype = "void(...)"; 1377} 1378 1379def ElementwiseRound : Builtin { 1380 let Spellings = ["__builtin_elementwise_round"]; 1381 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1382 let Prototype = "void(...)"; 1383} 1384 1385def ElementwiseRint : Builtin { 1386 let Spellings = ["__builtin_elementwise_rint"]; 1387 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1388 let Prototype = "void(...)"; 1389} 1390 1391def ElementwiseNearbyInt : Builtin { 1392 let Spellings = ["__builtin_elementwise_nearbyint"]; 1393 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1394 let Prototype = "void(...)"; 1395} 1396 1397def ElementwiseSin : Builtin { 1398 let Spellings = ["__builtin_elementwise_sin"]; 1399 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1400 let Prototype = "void(...)"; 1401} 1402 1403def ElementwiseSinh : Builtin { 1404 let Spellings = ["__builtin_elementwise_sinh"]; 1405 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1406 let Prototype = "void(...)"; 1407} 1408 1409def ElementwiseSqrt : Builtin { 1410 let Spellings = ["__builtin_elementwise_sqrt"]; 1411 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1412 let Prototype = "void(...)"; 1413} 1414 1415def ElementwiseTan : Builtin { 1416 let Spellings = ["__builtin_elementwise_tan"]; 1417 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1418 let Prototype = "void(...)"; 1419} 1420 1421def ElementwiseTanh : Builtin { 1422 let Spellings = ["__builtin_elementwise_tanh"]; 1423 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1424 let Prototype = "void(...)"; 1425} 1426 1427def ElementwiseTrunc : Builtin { 1428 let Spellings = ["__builtin_elementwise_trunc"]; 1429 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1430 let Prototype = "void(...)"; 1431} 1432 1433def ElementwiseCanonicalize : Builtin { 1434 let Spellings = ["__builtin_elementwise_canonicalize"]; 1435 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1436 let Prototype = "void(...)"; 1437} 1438 1439def ElementwiseCopysign : Builtin { 1440 let Spellings = ["__builtin_elementwise_copysign"]; 1441 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1442 let Prototype = "void(...)"; 1443} 1444 1445def ElementwiseFma : Builtin { 1446 let Spellings = ["__builtin_elementwise_fma"]; 1447 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1448 let Prototype = "void(...)"; 1449} 1450 1451def ElementwiseAddSat : Builtin { 1452 let Spellings = ["__builtin_elementwise_add_sat"]; 1453 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1454 let Prototype = "void(...)"; 1455} 1456 1457def ElementwiseSubSat : Builtin { 1458 let Spellings = ["__builtin_elementwise_sub_sat"]; 1459 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1460 let Prototype = "void(...)"; 1461} 1462 1463def ReduceMax : Builtin { 1464 let Spellings = ["__builtin_reduce_max"]; 1465 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1466 let Prototype = "void(...)"; 1467} 1468 1469def ReduceMin : Builtin { 1470 let Spellings = ["__builtin_reduce_min"]; 1471 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1472 let Prototype = "void(...)"; 1473} 1474 1475def ReduceMaximum : Builtin { 1476 let Spellings = ["__builtin_reduce_maximum"]; 1477 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1478 let Prototype = "void(...)"; 1479} 1480 1481def ReduceMinimum : Builtin { 1482 let Spellings = ["__builtin_reduce_minimum"]; 1483 let Attributes = [NoThrow, Const, CustomTypeChecking]; 1484 let Prototype = "void(...)"; 1485} 1486 1487def ReduceXor : Builtin { 1488 let Spellings = ["__builtin_reduce_xor"]; 1489 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1490 let Prototype = "void(...)"; 1491} 1492 1493def ReduceOr : Builtin { 1494 let Spellings = ["__builtin_reduce_or"]; 1495 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1496 let Prototype = "void(...)"; 1497} 1498 1499def ReduceAnd : Builtin { 1500 let Spellings = ["__builtin_reduce_and"]; 1501 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1502 let Prototype = "void(...)"; 1503} 1504 1505def ReduceAdd : Builtin { 1506 let Spellings = ["__builtin_reduce_add"]; 1507 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1508 let Prototype = "void(...)"; 1509} 1510 1511def ReduceMul : Builtin { 1512 let Spellings = ["__builtin_reduce_mul"]; 1513 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 1514 let Prototype = "void(...)"; 1515} 1516 1517def MatrixTranspose : Builtin { 1518 let Spellings = ["__builtin_matrix_transpose"]; 1519 let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking]; 1520 let Prototype = "void(...)"; 1521} 1522 1523def MatrixColumnMajorLoad : Builtin { 1524 let Spellings = ["__builtin_matrix_column_major_load"]; 1525 let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking]; 1526 let Prototype = "void(...)"; 1527} 1528 1529def MatrixColumnMajorStore : Builtin { 1530 let Spellings = ["__builtin_matrix_column_major_store"]; 1531 let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking]; 1532 let Prototype = "void(...)"; 1533} 1534 1535// "Overloaded" Atomic operator builtins. These are overloaded to support data 1536// types of i8, i16, i32, i64, and i128. The front-end sees calls to the 1537// non-suffixed version of these (which has a bogus type) and transforms them to 1538// the right overloaded version in Sema (plus casts). 1539 1540def SyncFetchAndAdd : Builtin { 1541 let Spellings = ["__sync_fetch_and_add"]; 1542 let Attributes = [CustomTypeChecking]; 1543 let Prototype = "void(...)"; 1544} 1545 1546def SyncFetchAndAddN : Builtin, SyncBuiltinsTemplate { 1547 let Spellings = ["__sync_fetch_and_add_"]; 1548 let Attributes = [CustomTypeChecking, NoThrow]; 1549 let Prototype = "T(T volatile*, T, ...)"; 1550} 1551 1552def SyncFetchAndSub : Builtin { 1553 let Spellings = ["__sync_fetch_and_sub"]; 1554 let Attributes = [CustomTypeChecking]; 1555 let Prototype = "void(...)"; 1556} 1557 1558def SyncFetchAndSubN : Builtin, SyncBuiltinsTemplate { 1559 let Spellings = ["__sync_fetch_and_sub_"]; 1560 let Attributes = [CustomTypeChecking, NoThrow]; 1561 let Prototype = "T(T volatile*, T, ...)"; 1562} 1563 1564def SyncFetchAndOr : Builtin { 1565 let Spellings = ["__sync_fetch_and_or"]; 1566 let Attributes = [CustomTypeChecking]; 1567 let Prototype = "void(...)"; 1568} 1569 1570def SyncFetchAndOrN : Builtin, SyncBuiltinsTemplate { 1571 let Spellings = ["__sync_fetch_and_or_"]; 1572 let Attributes = [CustomTypeChecking, NoThrow]; 1573 let Prototype = "T(T volatile*, T, ...)"; 1574} 1575 1576def SyncFetchAndAnd : Builtin { 1577 let Spellings = ["__sync_fetch_and_and"]; 1578 let Attributes = [CustomTypeChecking]; 1579 let Prototype = "void(...)"; 1580} 1581 1582def SyncFetchAndAndN : Builtin, SyncBuiltinsTemplate { 1583 let Spellings = ["__sync_fetch_and_and_"]; 1584 let Attributes = [CustomTypeChecking, NoThrow]; 1585 let Prototype = "T(T volatile*, T, ...)"; 1586} 1587 1588def SyncFetchAndXor : Builtin { 1589 let Spellings = ["__sync_fetch_and_xor"]; 1590 let Attributes = [CustomTypeChecking]; 1591 let Prototype = "void(...)"; 1592} 1593 1594def SyncFetchAndXorN : Builtin, SyncBuiltinsTemplate { 1595 let Spellings = ["__sync_fetch_and_xor_"]; 1596 let Attributes = [CustomTypeChecking, NoThrow]; 1597 let Prototype = "T(T volatile*, T, ...)"; 1598} 1599 1600def SyncFetchAndNand : Builtin { 1601 let Spellings = ["__sync_fetch_and_nand"]; 1602 let Attributes = [CustomTypeChecking]; 1603 let Prototype = "void(...)"; 1604} 1605 1606def SyncFetchAndNandN : Builtin, SyncBuiltinsTemplate { 1607 let Spellings = ["__sync_fetch_and_nand_"]; 1608 let Attributes = [CustomTypeChecking, NoThrow]; 1609 let Prototype = "T(T volatile*, T, ...)"; 1610} 1611 1612def SyncAddAndFetch : Builtin { 1613 let Spellings = ["__sync_add_and_fetch"]; 1614 let Attributes = [CustomTypeChecking]; 1615 let Prototype = "void(...)"; 1616} 1617 1618def SyncAddAndFetchN : Builtin, SyncBuiltinsTemplate { 1619 let Spellings = ["__sync_add_and_fetch_"]; 1620 let Attributes = [CustomTypeChecking, NoThrow]; 1621 let Prototype = "T(T volatile*, T, ...)"; 1622} 1623 1624def SyncSubAndFetch : Builtin { 1625 let Spellings = ["__sync_sub_and_fetch"]; 1626 let Attributes = [CustomTypeChecking]; 1627 let Prototype = "void(...)"; 1628} 1629 1630def SyncSubAndFetchN : Builtin, SyncBuiltinsTemplate { 1631 let Spellings = ["__sync_sub_and_fetch_"]; 1632 let Attributes = [CustomTypeChecking, NoThrow]; 1633 let Prototype = "T(T volatile*, T, ...)"; 1634} 1635 1636def SyncOrAndFetch : Builtin { 1637 let Spellings = ["__sync_or_and_fetch"]; 1638 let Attributes = [CustomTypeChecking]; 1639 let Prototype = "void(...)"; 1640} 1641 1642def SyncOrAndFetchN : Builtin, SyncBuiltinsTemplate { 1643 let Spellings = ["__sync_or_and_fetch_"]; 1644 let Attributes = [CustomTypeChecking, NoThrow]; 1645 let Prototype = "T(T volatile*, T, ...)"; 1646} 1647 1648def SyncAndAndFetch : Builtin { 1649 let Spellings = ["__sync_and_and_fetch"]; 1650 let Attributes = [CustomTypeChecking]; 1651 let Prototype = "void(...)"; 1652} 1653 1654def SyncAndAndFetchN : Builtin, SyncBuiltinsTemplate { 1655 let Spellings = ["__sync_and_and_fetch_"]; 1656 let Attributes = [CustomTypeChecking, NoThrow]; 1657 let Prototype = "T(T volatile*, T, ...)"; 1658} 1659 1660def SyncXorAndFetch : Builtin { 1661 let Spellings = ["__sync_xor_and_fetch"]; 1662 let Attributes = [CustomTypeChecking]; 1663 let Prototype = "void(...)"; 1664} 1665 1666def SyncXorAndFetchN : Builtin, SyncBuiltinsTemplate { 1667 let Spellings = ["__sync_xor_and_fetch_"]; 1668 let Attributes = [CustomTypeChecking, NoThrow]; 1669 let Prototype = "T(T volatile*, T, ...)"; 1670} 1671 1672def SyncNandAndFetch : Builtin { 1673 let Spellings = ["__sync_nand_and_fetch"]; 1674 let Attributes = [CustomTypeChecking]; 1675 let Prototype = "void(...)"; 1676} 1677 1678def SyncNandAndFetchN : Builtin, SyncBuiltinsTemplate { 1679 let Spellings = ["__sync_nand_and_fetch_"]; 1680 let Attributes = [CustomTypeChecking, NoThrow]; 1681 let Prototype = "T(T volatile*, T, ...)"; 1682} 1683 1684def SyncBoolCompareAndSwap : Builtin { 1685 let Spellings = ["__sync_bool_compare_and_swap"]; 1686 let Attributes = [CustomTypeChecking]; 1687 let Prototype = "void(...)"; 1688} 1689 1690def SyncBoolCompareAndSwapN : Builtin, SyncBuiltinsTemplate { 1691 let Spellings = ["__sync_bool_compare_and_swap_"]; 1692 let Attributes = [CustomTypeChecking, NoThrow]; 1693 let Prototype = "bool(T volatile*, T, T, ...)"; 1694} 1695 1696def SyncValCompareAndSwap : Builtin { 1697 let Spellings = ["__sync_val_compare_and_swap"]; 1698 let Attributes = [CustomTypeChecking]; 1699 let Prototype = "void(...)"; 1700} 1701 1702def SynLockValCompareAndSwapN : Builtin, SyncBuiltinsTemplate { 1703 let Spellings = ["__sync_val_compare_and_swap_"]; 1704 let Attributes = [CustomTypeChecking, NoThrow]; 1705 let Prototype = "T(T volatile*, T, T, ...)"; 1706} 1707 1708def SyncLockTestAndSet : Builtin { 1709 let Spellings = ["__sync_lock_test_and_set"]; 1710 let Attributes = [CustomTypeChecking]; 1711 let Prototype = "void(...)"; 1712} 1713 1714def SynLockLockTestAndSetN : Builtin, SyncBuiltinsTemplate { 1715 let Spellings = ["__sync_lock_test_and_set_"]; 1716 let Attributes = [CustomTypeChecking, NoThrow]; 1717 let Prototype = "T(T volatile*, T, ...)"; 1718} 1719 1720def SyncLockRelease : Builtin { 1721 let Spellings = ["__sync_lock_release"]; 1722 let Attributes = [CustomTypeChecking]; 1723 let Prototype = "void(...)"; 1724} 1725 1726def SyncLockReleaseN : Builtin, SyncBuiltinsTemplate { 1727 let Spellings = ["__sync_lock_release_"]; 1728 let Attributes = [CustomTypeChecking, NoThrow]; 1729 let Prototype = "void(T volatile*, ...)"; 1730} 1731 1732def SyncSwap : Builtin { 1733 let Spellings = ["__sync_swap"]; 1734 let Attributes = [CustomTypeChecking]; 1735 let Prototype = "void(...)"; 1736} 1737 1738def SyncSwapN : Builtin, SyncBuiltinsTemplate { 1739 let Spellings = ["__sync_swap_"]; 1740 let Attributes = [CustomTypeChecking, NoThrow]; 1741 let Prototype = "T(T volatile*, T, ...)"; 1742} 1743 1744// C11 _Atomic operations for <stdatomic.h>. 1745def C11AtomicInit : AtomicBuiltin { 1746 let Spellings = ["__c11_atomic_init"]; 1747 let Attributes = [CustomTypeChecking]; 1748 let Prototype = "void(...)"; 1749} 1750 1751def C11AtomicLoad : AtomicBuiltin { 1752 let Spellings = ["__c11_atomic_load"]; 1753 let Attributes = [CustomTypeChecking]; 1754 let Prototype = "void(...)"; 1755} 1756 1757def C11AtomicStore : AtomicBuiltin { 1758 let Spellings = ["__c11_atomic_store"]; 1759 let Attributes = [CustomTypeChecking]; 1760 let Prototype = "void(...)"; 1761} 1762 1763def C11AtomicExchange : AtomicBuiltin { 1764 let Spellings = ["__c11_atomic_exchange"]; 1765 let Attributes = [CustomTypeChecking]; 1766 let Prototype = "void(...)"; 1767} 1768 1769def C11AtomicCompareExchangeStrong : AtomicBuiltin { 1770 let Spellings = ["__c11_atomic_compare_exchange_strong"]; 1771 let Attributes = [CustomTypeChecking]; 1772 let Prototype = "void(...)"; 1773} 1774 1775def C11AtomicCompareExchangeWeak : AtomicBuiltin { 1776 let Spellings = ["__c11_atomic_compare_exchange_weak"]; 1777 let Attributes = [CustomTypeChecking]; 1778 let Prototype = "void(...)"; 1779} 1780 1781def C11AtomicFetchAdd : AtomicBuiltin { 1782 let Spellings = ["__c11_atomic_fetch_add"]; 1783 let Attributes = [CustomTypeChecking]; 1784 let Prototype = "void(...)"; 1785} 1786 1787def C11AtomicFetchSub : AtomicBuiltin { 1788 let Spellings = ["__c11_atomic_fetch_sub"]; 1789 let Attributes = [CustomTypeChecking]; 1790 let Prototype = "void(...)"; 1791} 1792 1793def C11AtomicFetchAnd : AtomicBuiltin { 1794 let Spellings = ["__c11_atomic_fetch_and"]; 1795 let Attributes = [CustomTypeChecking]; 1796 let Prototype = "void(...)"; 1797} 1798 1799def C11AtomicFetchOr : AtomicBuiltin { 1800 let Spellings = ["__c11_atomic_fetch_or"]; 1801 let Attributes = [CustomTypeChecking]; 1802 let Prototype = "void(...)"; 1803} 1804 1805def C11AtomicFetchXor : AtomicBuiltin { 1806 let Spellings = ["__c11_atomic_fetch_xor"]; 1807 let Attributes = [CustomTypeChecking]; 1808 let Prototype = "void(...)"; 1809} 1810 1811def C11AtomicFetchNand : AtomicBuiltin { 1812 let Spellings = ["__c11_atomic_fetch_nand"]; 1813 let Attributes = [CustomTypeChecking]; 1814 let Prototype = "void(...)"; 1815} 1816 1817def C11AtomicFetchMax : AtomicBuiltin { 1818 let Spellings = ["__c11_atomic_fetch_max"]; 1819 let Attributes = [CustomTypeChecking]; 1820 let Prototype = "void(...)"; 1821} 1822 1823def C11AtomicFetchMin : AtomicBuiltin { 1824 let Spellings = ["__c11_atomic_fetch_min"]; 1825 let Attributes = [CustomTypeChecking]; 1826 let Prototype = "void(...)"; 1827} 1828 1829def C11AtomicThreadFence : Builtin { 1830 let Spellings = ["__c11_atomic_thread_fence"]; 1831 let Attributes = [NoThrow]; 1832 let Prototype = "void(int)"; 1833} 1834 1835def C11AtomicSignalFence : Builtin { 1836 let Spellings = ["__c11_atomic_signal_fence"]; 1837 let Attributes = [NoThrow]; 1838 let Prototype = "void(int)"; 1839} 1840 1841def C11AtomicIsLockFree : Builtin { 1842 let Spellings = ["__c11_atomic_is_lock_free"]; 1843 let Attributes = [NoThrow, Constexpr]; 1844 let Prototype = "bool(size_t)"; 1845} 1846 1847// GNU atomic builtins. 1848def AtomicLoad : AtomicBuiltin { 1849 let Spellings = ["__atomic_load"]; 1850 let Attributes = [CustomTypeChecking]; 1851 let Prototype = "void(...)"; 1852} 1853 1854def AtomicLoadN : AtomicBuiltin { 1855 let Spellings = ["__atomic_load_n"]; 1856 let Attributes = [CustomTypeChecking]; 1857 let Prototype = "void(...)"; 1858} 1859 1860def AtomicStore : AtomicBuiltin { 1861 let Spellings = ["__atomic_store"]; 1862 let Attributes = [CustomTypeChecking]; 1863 let Prototype = "void(...)"; 1864} 1865 1866def AtomicStoreN : AtomicBuiltin { 1867 let Spellings = ["__atomic_store_n"]; 1868 let Attributes = [CustomTypeChecking]; 1869 let Prototype = "void(...)"; 1870} 1871 1872def AtomicExchange : AtomicBuiltin { 1873 let Spellings = ["__atomic_exchange"]; 1874 let Attributes = [CustomTypeChecking]; 1875 let Prototype = "void(...)"; 1876} 1877 1878def AtomicExchangeN : AtomicBuiltin { 1879 let Spellings = ["__atomic_exchange_n"]; 1880 let Attributes = [CustomTypeChecking]; 1881 let Prototype = "void(...)"; 1882} 1883 1884def AtomicCompareExchange : AtomicBuiltin { 1885 let Spellings = ["__atomic_compare_exchange"]; 1886 let Attributes = [CustomTypeChecking]; 1887 let Prototype = "void(...)"; 1888} 1889 1890def AtomicCompareExchangeN : AtomicBuiltin { 1891 let Spellings = ["__atomic_compare_exchange_n"]; 1892 let Attributes = [CustomTypeChecking]; 1893 let Prototype = "void(...)"; 1894} 1895 1896def AtomicFetchAdd : AtomicBuiltin { 1897 let Spellings = ["__atomic_fetch_add"]; 1898 let Attributes = [CustomTypeChecking]; 1899 let Prototype = "void(...)"; 1900} 1901 1902def AtomicFetchSub : AtomicBuiltin { 1903 let Spellings = ["__atomic_fetch_sub"]; 1904 let Attributes = [CustomTypeChecking]; 1905 let Prototype = "void(...)"; 1906} 1907 1908def AtomicFetchAnd : AtomicBuiltin { 1909 let Spellings = ["__atomic_fetch_and"]; 1910 let Attributes = [CustomTypeChecking]; 1911 let Prototype = "void(...)"; 1912} 1913 1914def AtomicFetchOr : AtomicBuiltin { 1915 let Spellings = ["__atomic_fetch_or"]; 1916 let Attributes = [CustomTypeChecking]; 1917 let Prototype = "void(...)"; 1918} 1919 1920def AtomicFetchXor : AtomicBuiltin { 1921 let Spellings = ["__atomic_fetch_xor"]; 1922 let Attributes = [CustomTypeChecking]; 1923 let Prototype = "void(...)"; 1924} 1925 1926def AtomicFetchNand : AtomicBuiltin { 1927 let Spellings = ["__atomic_fetch_nand"]; 1928 let Attributes = [CustomTypeChecking]; 1929 let Prototype = "void(...)"; 1930} 1931 1932def AtomicAddFetch : AtomicBuiltin { 1933 let Spellings = ["__atomic_add_fetch"]; 1934 let Attributes = [CustomTypeChecking]; 1935 let Prototype = "void(...)"; 1936} 1937 1938def AtomicSubFetch : AtomicBuiltin { 1939 let Spellings = ["__atomic_sub_fetch"]; 1940 let Attributes = [CustomTypeChecking]; 1941 let Prototype = "void(...)"; 1942} 1943 1944def AtomicAndFetch : AtomicBuiltin { 1945 let Spellings = ["__atomic_and_fetch"]; 1946 let Attributes = [CustomTypeChecking]; 1947 let Prototype = "void(...)"; 1948} 1949 1950def AtomicOrFetch : AtomicBuiltin { 1951 let Spellings = ["__atomic_or_fetch"]; 1952 let Attributes = [CustomTypeChecking]; 1953 let Prototype = "void(...)"; 1954} 1955 1956def AtomicXorFetch : AtomicBuiltin { 1957 let Spellings = ["__atomic_xor_fetch"]; 1958 let Attributes = [CustomTypeChecking]; 1959 let Prototype = "void(...)"; 1960} 1961 1962def AtomicMaxFetch : AtomicBuiltin { 1963 let Spellings = ["__atomic_max_fetch"]; 1964 let Attributes = [CustomTypeChecking]; 1965 let Prototype = "void(...)"; 1966} 1967 1968def AtomicMinFetch : AtomicBuiltin { 1969 let Spellings = ["__atomic_min_fetch"]; 1970 let Attributes = [CustomTypeChecking]; 1971 let Prototype = "void(...)"; 1972} 1973 1974def AtomicNandFetch : AtomicBuiltin { 1975 let Spellings = ["__atomic_nand_fetch"]; 1976 let Attributes = [CustomTypeChecking]; 1977 let Prototype = "void(...)"; 1978} 1979 1980def AtomicTestAndSet : AtomicBuiltin { 1981 let Spellings = ["__atomic_test_and_set"]; 1982 let Attributes = [NoThrow, CustomTypeChecking]; 1983 let Prototype = "bool(...)"; 1984} 1985 1986def AtomicClear : AtomicBuiltin { 1987 let Spellings = ["__atomic_clear"]; 1988 let Attributes = [NoThrow, CustomTypeChecking]; 1989 let Prototype = "void(...)"; 1990} 1991 1992def AtomicThreadFence : Builtin { 1993 let Spellings = ["__atomic_thread_fence"]; 1994 let Attributes = [NoThrow]; 1995 let Prototype = "void(int)"; 1996} 1997 1998def ScopedAtomicThreadFence : Builtin { 1999 let Spellings = ["__scoped_atomic_thread_fence"]; 2000 let Attributes = [NoThrow]; 2001 let Prototype = "void(int, int)"; 2002} 2003 2004def AtomicSignalFence : Builtin { 2005 let Spellings = ["__atomic_signal_fence"]; 2006 let Attributes = [NoThrow]; 2007 let Prototype = "void(int)"; 2008} 2009 2010def AtomicAlwaysLockFree : Builtin { 2011 let Spellings = ["__atomic_always_lock_free"]; 2012 let Attributes = [NoThrow, Constexpr]; 2013 let Prototype = "bool(size_t, void const volatile*)"; 2014} 2015 2016def AtomicIsLockFree : Builtin { 2017 let Spellings = ["__atomic_is_lock_free"]; 2018 let Attributes = [NoThrow, Constexpr]; 2019 let Prototype = "bool(size_t, void const volatile*)"; 2020} 2021 2022// GNU atomic builtins with atomic scopes. 2023def ScopedAtomicLoad : AtomicBuiltin { 2024 let Spellings = ["__scoped_atomic_load"]; 2025 let Attributes = [CustomTypeChecking]; 2026 let Prototype = "void(...)"; 2027} 2028 2029def ScopedAtomicLoadN : AtomicBuiltin { 2030 let Spellings = ["__scoped_atomic_load_n"]; 2031 let Attributes = [CustomTypeChecking]; 2032 let Prototype = "void(...)"; 2033} 2034 2035def ScopedAtomicStore : AtomicBuiltin { 2036 let Spellings = ["__scoped_atomic_store"]; 2037 let Attributes = [CustomTypeChecking]; 2038 let Prototype = "void(...)"; 2039} 2040 2041def ScopedAtomicStoreN : AtomicBuiltin { 2042 let Spellings = ["__scoped_atomic_store_n"]; 2043 let Attributes = [CustomTypeChecking]; 2044 let Prototype = "void(...)"; 2045} 2046 2047def ScopedAtomicExchange : AtomicBuiltin { 2048 let Spellings = ["__scoped_atomic_exchange"]; 2049 let Attributes = [CustomTypeChecking]; 2050 let Prototype = "void(...)"; 2051} 2052 2053def ScopedAtomicExchangeN : AtomicBuiltin { 2054 let Spellings = ["__scoped_atomic_exchange_n"]; 2055 let Attributes = [CustomTypeChecking]; 2056 let Prototype = "void(...)"; 2057} 2058 2059def ScopedAtomicCompareExchange : AtomicBuiltin { 2060 let Spellings = ["__scoped_atomic_compare_exchange"]; 2061 let Attributes = [CustomTypeChecking]; 2062 let Prototype = "void(...)"; 2063} 2064 2065def ScopedAtomicCompareExchangeN : AtomicBuiltin { 2066 let Spellings = ["__scoped_atomic_compare_exchange_n"]; 2067 let Attributes = [CustomTypeChecking]; 2068 let Prototype = "void(...)"; 2069} 2070 2071def ScopedAtomicFetchAdd : AtomicBuiltin { 2072 let Spellings = ["__scoped_atomic_fetch_add"]; 2073 let Attributes = [CustomTypeChecking]; 2074 let Prototype = "void(...)"; 2075} 2076 2077def ScopedAtomicFetchSub : AtomicBuiltin { 2078 let Spellings = ["__scoped_atomic_fetch_sub"]; 2079 let Attributes = [CustomTypeChecking]; 2080 let Prototype = "void(...)"; 2081} 2082 2083def ScopedAtomicFetchAnd : AtomicBuiltin { 2084 let Spellings = ["__scoped_atomic_fetch_and"]; 2085 let Attributes = [CustomTypeChecking]; 2086 let Prototype = "void(...)"; 2087} 2088 2089def ScopedAtomicFetchOr : AtomicBuiltin { 2090 let Spellings = ["__scoped_atomic_fetch_or"]; 2091 let Attributes = [CustomTypeChecking]; 2092 let Prototype = "void(...)"; 2093} 2094 2095def ScopedAtomicFetchXor : AtomicBuiltin { 2096 let Spellings = ["__scoped_atomic_fetch_xor"]; 2097 let Attributes = [CustomTypeChecking]; 2098 let Prototype = "void(...)"; 2099} 2100 2101def ScopedAtomicFetchNand : AtomicBuiltin { 2102 let Spellings = ["__scoped_atomic_fetch_nand"]; 2103 let Attributes = [CustomTypeChecking]; 2104 let Prototype = "void(...)"; 2105} 2106 2107def ScopedAtomicFetchMin : AtomicBuiltin { 2108 let Spellings = ["__scoped_atomic_fetch_min"]; 2109 let Attributes = [CustomTypeChecking]; 2110 let Prototype = "void(...)"; 2111} 2112 2113def ScopedAtomicFetchMax : AtomicBuiltin { 2114 let Spellings = ["__scoped_atomic_fetch_max"]; 2115 let Attributes = [CustomTypeChecking]; 2116 let Prototype = "void(...)"; 2117} 2118 2119def ScopedAtomicAddFetch : AtomicBuiltin { 2120 let Spellings = ["__scoped_atomic_add_fetch"]; 2121 let Attributes = [CustomTypeChecking]; 2122 let Prototype = "void(...)"; 2123} 2124 2125def ScopedAtomicSubFetch : AtomicBuiltin { 2126 let Spellings = ["__scoped_atomic_sub_fetch"]; 2127 let Attributes = [CustomTypeChecking]; 2128 let Prototype = "void(...)"; 2129} 2130 2131def ScopedAtomicAndFetch : AtomicBuiltin { 2132 let Spellings = ["__scoped_atomic_and_fetch"]; 2133 let Attributes = [CustomTypeChecking]; 2134 let Prototype = "void(...)"; 2135} 2136 2137def ScopedAtomicOrFetch : AtomicBuiltin { 2138 let Spellings = ["__scoped_atomic_or_fetch"]; 2139 let Attributes = [CustomTypeChecking]; 2140 let Prototype = "void(...)"; 2141} 2142 2143def ScopedAtomicXorFetch : AtomicBuiltin { 2144 let Spellings = ["__scoped_atomic_xor_fetch"]; 2145 let Attributes = [CustomTypeChecking]; 2146 let Prototype = "void(...)"; 2147} 2148 2149def ScopedAtomicNandFetch : AtomicBuiltin { 2150 let Spellings = ["__scoped_atomic_nand_fetch"]; 2151 let Attributes = [CustomTypeChecking]; 2152 let Prototype = "void(...)"; 2153} 2154 2155def ScopedAtomicMinFetch : AtomicBuiltin { 2156 let Spellings = ["__scoped_atomic_min_fetch"]; 2157 let Attributes = [CustomTypeChecking]; 2158 let Prototype = "void(...)"; 2159} 2160 2161def ScopedAtomicMaxFetch : AtomicBuiltin { 2162 let Spellings = ["__scoped_atomic_max_fetch"]; 2163 let Attributes = [CustomTypeChecking]; 2164 let Prototype = "void(...)"; 2165} 2166 2167// OpenCL 2.0 atomic builtins. 2168def OpenCLAtomicInit : AtomicBuiltin { 2169 let Spellings = ["__opencl_atomic_init"]; 2170 let Attributes = [CustomTypeChecking]; 2171 let Prototype = "void(...)"; 2172} 2173 2174def OpenCLAtomicLoad : AtomicBuiltin { 2175 let Spellings = ["__opencl_atomic_load"]; 2176 let Attributes = [CustomTypeChecking]; 2177 let Prototype = "void(...)"; 2178} 2179 2180def OpenCLAtomicStore : AtomicBuiltin { 2181 let Spellings = ["__opencl_atomic_store"]; 2182 let Attributes = [CustomTypeChecking]; 2183 let Prototype = "void(...)"; 2184} 2185 2186def OpenCLAtomicCompareExchangeWeak : AtomicBuiltin { 2187 let Spellings = ["__opencl_atomic_compare_exchange_weak"]; 2188 let Attributes = [CustomTypeChecking]; 2189 let Prototype = "void(...)"; 2190} 2191 2192def OpenCLAtomicCompareExchangeStrong : AtomicBuiltin { 2193 let Spellings = ["__opencl_atomic_compare_exchange_strong"]; 2194 let Attributes = [CustomTypeChecking]; 2195 let Prototype = "void(...)"; 2196} 2197 2198def OpenCLAtomicExchange : AtomicBuiltin { 2199 let Spellings = ["__opencl_atomic_exchange"]; 2200 let Attributes = [CustomTypeChecking]; 2201 let Prototype = "void(...)"; 2202} 2203 2204def OpenCLAtomicFetchAdd : AtomicBuiltin { 2205 let Spellings = ["__opencl_atomic_fetch_add"]; 2206 let Attributes = [CustomTypeChecking]; 2207 let Prototype = "void(...)"; 2208} 2209 2210def OpenCLAtomicFetchSub : AtomicBuiltin { 2211 let Spellings = ["__opencl_atomic_fetch_sub"]; 2212 let Attributes = [CustomTypeChecking]; 2213 let Prototype = "void(...)"; 2214} 2215 2216def OpenCLAtomicFetchAnd : AtomicBuiltin { 2217 let Spellings = ["__opencl_atomic_fetch_and"]; 2218 let Attributes = [CustomTypeChecking]; 2219 let Prototype = "void(...)"; 2220} 2221 2222def OpenCLAtomicFetchOr : AtomicBuiltin { 2223 let Spellings = ["__opencl_atomic_fetch_or"]; 2224 let Attributes = [CustomTypeChecking]; 2225 let Prototype = "void(...)"; 2226} 2227 2228def OpenCLAtomicFetchXor : AtomicBuiltin { 2229 let Spellings = ["__opencl_atomic_fetch_xor"]; 2230 let Attributes = [CustomTypeChecking]; 2231 let Prototype = "void(...)"; 2232} 2233 2234def OpenCLAtomicFetchMin : AtomicBuiltin { 2235 let Spellings = ["__opencl_atomic_fetch_min"]; 2236 let Attributes = [CustomTypeChecking]; 2237 let Prototype = "void(...)"; 2238} 2239 2240def OpenCLAtomicFetchMax : AtomicBuiltin { 2241 let Spellings = ["__opencl_atomic_fetch_max"]; 2242 let Attributes = [CustomTypeChecking]; 2243 let Prototype = "void(...)"; 2244} 2245 2246// GCC does not support these, they are a Clang extension. 2247def AtomicFetchMax : AtomicBuiltin { 2248 let Spellings = ["__atomic_fetch_max"]; 2249 let Attributes = [CustomTypeChecking]; 2250 let Prototype = "void(...)"; 2251} 2252 2253def AtomicFetchMin : AtomicBuiltin { 2254 let Spellings = ["__atomic_fetch_min"]; 2255 let Attributes = [CustomTypeChecking]; 2256 let Prototype = "void(...)"; 2257} 2258 2259// HIP atomic builtins. 2260def HipAtomicLoad : AtomicBuiltin { 2261 let Spellings = ["__hip_atomic_load"]; 2262 let Attributes = [CustomTypeChecking]; 2263 let Prototype = "void(...)"; 2264} 2265 2266def HipAtomicStore : AtomicBuiltin { 2267 let Spellings = ["__hip_atomic_store"]; 2268 let Attributes = [CustomTypeChecking]; 2269 let Prototype = "void(...)"; 2270} 2271 2272def HipAtomicCompareExchangeWeak : AtomicBuiltin { 2273 let Spellings = ["__hip_atomic_compare_exchange_weak"]; 2274 let Attributes = [CustomTypeChecking]; 2275 let Prototype = "void(...)"; 2276} 2277 2278def HipAtomicCompareExchangeStrong : AtomicBuiltin { 2279 let Spellings = ["__hip_atomic_compare_exchange_strong"]; 2280 let Attributes = [CustomTypeChecking]; 2281 let Prototype = "void(...)"; 2282} 2283 2284def HipAtomicExchange : AtomicBuiltin { 2285 let Spellings = ["__hip_atomic_exchange"]; 2286 let Attributes = [CustomTypeChecking]; 2287 let Prototype = "void(...)"; 2288} 2289 2290def HipAtomicFetchAdd : AtomicBuiltin { 2291 let Spellings = ["__hip_atomic_fetch_add"]; 2292 let Attributes = [CustomTypeChecking]; 2293 let Prototype = "void(...)"; 2294} 2295 2296def HipAtomicFetchSub : AtomicBuiltin { 2297 let Spellings = ["__hip_atomic_fetch_sub"]; 2298 let Attributes = [CustomTypeChecking]; 2299 let Prototype = "void(...)"; 2300} 2301 2302def HipAtomicFetchAnd : AtomicBuiltin { 2303 let Spellings = ["__hip_atomic_fetch_and"]; 2304 let Attributes = [CustomTypeChecking]; 2305 let Prototype = "void(...)"; 2306} 2307 2308def HipAtomicFetchOr : AtomicBuiltin { 2309 let Spellings = ["__hip_atomic_fetch_or"]; 2310 let Attributes = [CustomTypeChecking]; 2311 let Prototype = "void(...)"; 2312} 2313 2314def HipAtomicFetchXor : AtomicBuiltin { 2315 let Spellings = ["__hip_atomic_fetch_xor"]; 2316 let Attributes = [CustomTypeChecking]; 2317 let Prototype = "void(...)"; 2318} 2319 2320def HipAtomicFetchMin : AtomicBuiltin { 2321 let Spellings = ["__hip_atomic_fetch_min"]; 2322 let Attributes = [CustomTypeChecking]; 2323 let Prototype = "void(...)"; 2324} 2325 2326def HipAtomicFetchMax : AtomicBuiltin { 2327 let Spellings = ["__hip_atomic_fetch_max"]; 2328 let Attributes = [CustomTypeChecking]; 2329 let Prototype = "void(...)"; 2330} 2331 2332// Non-overloaded atomic builtins. 2333def SyncSynchronize : Builtin { 2334 let Spellings = ["__sync_synchronize"]; 2335 let Attributes = [NoThrow]; 2336 let Prototype = "void()"; 2337} 2338 2339// GCC does not support these, they are a Clang extension. 2340def SyncFetchAndMin : Builtin { 2341 let Spellings = ["__sync_fetch_and_min"]; 2342 let Attributes = [NoThrow]; 2343 let Prototype = "int(int volatile*, int)"; 2344} 2345 2346def SyncFetchAndMax : Builtin { 2347 let Spellings = ["__sync_fetch_and_max"]; 2348 let Attributes = [NoThrow]; 2349 let Prototype = "int(int volatile*, int)"; 2350} 2351 2352def SyncFetchAndUMin : Builtin { 2353 let Spellings = ["__sync_fetch_and_umin"]; 2354 let Attributes = [NoThrow]; 2355 let Prototype = "unsigned int(unsigned int volatile*, unsigned int)"; 2356} 2357 2358def SyncFetchAndUMax : Builtin { 2359 let Spellings = ["__sync_fetch_and_umax"]; 2360 let Attributes = [NoThrow]; 2361 let Prototype = "unsigned int(unsigned int volatile*, unsigned int)"; 2362} 2363 2364// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399 2365def WarnMemsetZeroLen : Builtin { 2366 let Spellings = ["__warn_memset_zero_len"]; 2367 let Attributes = [NoThrow, Pure]; 2368 let Prototype = "void()"; 2369} 2370 2371// Microsoft builtins. These are only active with -fms-extensions. 2372def Alloca : MSLangBuiltin { 2373 let Spellings = ["_alloca"]; 2374 let Attributes = [NoThrow]; 2375 let Prototype = "void*(size_t)"; 2376} 2377 2378def MSAnnotation : MSLangBuiltin { 2379 let Spellings = ["__annotation"]; 2380 let Attributes = [NoThrow]; 2381 let Prototype = "wchar_t const*(...)"; 2382} 2383 2384def MSAssume : MSLangBuiltin { 2385 let Spellings = ["__assume"]; 2386 let Attributes = [NoThrow, Constexpr]; 2387 let Prototype = "void(bool)"; 2388} 2389 2390def Bittest : MSLangBuiltin, MSInt32_64Template { 2391 let Spellings = ["_bittest"]; 2392 let Attributes = [NoThrow]; 2393 let Prototype = "unsigned char(T const*, T)"; 2394} 2395 2396def BittestAndComplement : MSLangBuiltin, MSInt32_64Template { 2397 let Spellings = ["_bittestandcomplement"]; 2398 let Attributes = [NoThrow]; 2399 let Prototype = "unsigned char(T*, T)"; 2400} 2401 2402def BittestAndReset : MSLangBuiltin, MSInt32_64Template { 2403 let Spellings = ["_bittestandreset"]; 2404 let Attributes = [NoThrow]; 2405 let Prototype = "unsigned char(T*, T)"; 2406} 2407 2408def BittestAndSet : MSLangBuiltin, MSInt32_64Template { 2409 let Spellings = ["_bittestandset"]; 2410 let Attributes = [NoThrow]; 2411 let Prototype = "unsigned char(T*, T)"; 2412} 2413 2414def MSByteswap : MSLibBuiltin<"stdlib.h">, 2415 Template<["unsigned short", "msuint32_t", "unsigned long long int"], 2416 ["_ushort", "_ulong", "_uint64"]> { 2417 let Spellings = ["_byteswap"]; 2418 let Attributes = [NoThrow, Const]; 2419 let Prototype = "T(T)"; 2420} 2421 2422def Debugbreak : MSLangBuiltin { 2423 let Spellings = ["__debugbreak"]; 2424 let Attributes = [NoThrow]; 2425 let Prototype = "void()"; 2426} 2427 2428def ExceptionCode : MSLangBuiltin { 2429 let Spellings = ["__exception_code", "_exception_code"]; 2430 let Attributes = [NoThrow]; 2431 let Prototype = "msuint32_t()"; 2432} 2433 2434def ExceptionInfo : MSLangBuiltin { 2435 let Spellings = ["__exception_info", "_exception_info"]; 2436 let Attributes = [NoThrow]; 2437 let Prototype = "void*()"; 2438} 2439 2440def AbnormalTermination : MSLangBuiltin { 2441 let Spellings = ["__abnormal_termination", "_abnormal_termination"]; 2442 let Attributes = [NoThrow]; 2443 let Prototype = "int()"; 2444} 2445 2446def GetExceptionInfo : MSLangBuiltin { 2447 let Spellings = ["__GetExceptionInfo"]; 2448 let Attributes = [NoThrow, CustomTypeChecking, UnevaluatedArguments]; 2449 let Prototype = "void*(...)"; 2450 let Namespace = "std"; 2451} 2452 2453def InterlockedAnd : MSLangBuiltin, MSInt8_16_32Template { 2454 let Spellings = ["_InterlockedAnd"]; 2455 let Attributes = [NoThrow]; 2456 let Prototype = "T(T volatile*, T)"; 2457} 2458 2459def InterlockedCompareExchange : MSLangBuiltin, MSInt8_16_32_64Template { 2460 let Spellings = ["_InterlockedCompareExchange"]; 2461 let Attributes = [NoThrow]; 2462 let Prototype = "T(T volatile*, T, T)"; 2463} 2464 2465def InterlockedCompareExchangePointer : MSLangBuiltin { 2466 let Spellings = ["_InterlockedCompareExchangePointer"]; 2467 let Attributes = [NoThrow]; 2468 let Prototype = "void*(void* volatile*, void*, void*)"; 2469} 2470 2471def InterlockedCompareExchangePointer_nf : MSLangBuiltin { 2472 let Spellings = ["_InterlockedCompareExchangePointer_nf"]; 2473 let Attributes = [NoThrow]; 2474 let Prototype = "void*(void* volatile*, void*, void*)"; 2475} 2476 2477def InterlockedDecrement : MSLangBuiltin, MSInt16_32Template { 2478 let Spellings = ["_InterlockedDecrement"]; 2479 let Attributes = [NoThrow]; 2480 let Prototype = "T(T volatile*)"; 2481} 2482 2483def InterlockedExchange : MSLangBuiltin, MSInt8_16_32Template { 2484 let Spellings = ["_InterlockedExchange"]; 2485 let Attributes = [NoThrow]; 2486 let Prototype = "T(T volatile*, T)"; 2487} 2488 2489def InterlockedExchangeAdd : MSLangBuiltin, MSInt8_16_32Template { 2490 let Spellings = ["_InterlockedExchangeAdd"]; 2491 let Attributes = [NoThrow]; 2492 let Prototype = "T(T volatile*, T)"; 2493} 2494 2495def InterlockedExchangePointer : MSLangBuiltin { 2496 let Spellings = ["_InterlockedExchangePointer"]; 2497 let Attributes = [NoThrow]; 2498 let Prototype = "void*(void* volatile*, void*)"; 2499} 2500 2501def InterlockedExchangeSub : MSLangBuiltin, MSInt8_16_32Template { 2502 let Spellings = ["_InterlockedExchangeSub"]; 2503 let Attributes = [NoThrow]; 2504 let Prototype = "T(T volatile*, T)"; 2505} 2506 2507def InterlockedIncrement : MSLangBuiltin, MSInt16_32Template { 2508 let Spellings = ["_InterlockedIncrement"]; 2509 let Attributes = [NoThrow]; 2510 let Prototype = "T(T volatile*)"; 2511} 2512 2513def InterlockedOr : MSLangBuiltin, MSInt8_16_32Template { 2514 let Spellings = ["_InterlockedOr"]; 2515 let Attributes = [NoThrow]; 2516 let Prototype = "T(T volatile*, T)"; 2517} 2518 2519def InterlockedXor : MSLangBuiltin, MSInt8_16_32Template { 2520 let Spellings = ["_InterlockedXor"]; 2521 let Attributes = [NoThrow]; 2522 let Prototype = "T(T volatile*, T)"; 2523} 2524 2525def InterlockedBittestAndReset : MSLangBuiltin, MSInt32_64Template { 2526 let Spellings = ["_interlockedbittestandreset"]; 2527 let Attributes = [NoThrow]; 2528 let Prototype = "unsigned char(T volatile*, T)"; 2529} 2530 2531def InterlockedBittestAndReset_acq : MSLangBuiltin { 2532 let Spellings = ["_interlockedbittestandreset_acq"]; 2533 let Attributes = [NoThrow]; 2534 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2535} 2536 2537def InterlockedBittestAndReset_nf : MSLangBuiltin { 2538 let Spellings = ["_interlockedbittestandreset_nf"]; 2539 let Attributes = [NoThrow]; 2540 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2541} 2542 2543def InterlockedBittestAndReset_rel : MSLangBuiltin { 2544 let Spellings = ["_interlockedbittestandreset_rel"]; 2545 let Attributes = [NoThrow]; 2546 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2547} 2548 2549def InterlockedBittestAndSet : MSLangBuiltin, MSInt32_64Template { 2550 let Spellings = ["_interlockedbittestandset"]; 2551 let Attributes = [NoThrow]; 2552 let Prototype = "unsigned char(T volatile*, T)"; 2553} 2554 2555def InterlockedBittestAndSet_acq : MSLangBuiltin { 2556 let Spellings = ["_interlockedbittestandset_acq"]; 2557 let Attributes = [NoThrow]; 2558 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2559} 2560 2561def InterlockedBittestAndSet_nf : MSLangBuiltin { 2562 let Spellings = ["_interlockedbittestandset_nf"]; 2563 let Attributes = [NoThrow]; 2564 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2565} 2566 2567def InterlockedBittestAndSet_rel : MSLangBuiltin { 2568 let Spellings = ["_interlockedbittestandset_rel"]; 2569 let Attributes = [NoThrow]; 2570 let Prototype = "unsigned char(msint32_t volatile*, msint32_t)"; 2571} 2572 2573def IsoVolatileLoad : MSLangBuiltin, Int8_16_32_64Template { 2574 let Spellings = ["__iso_volatile_load"]; 2575 let Attributes = [NoThrow]; 2576 let Prototype = "T(T const volatile*)"; 2577} 2578 2579def IsoVolatileStore : MSLangBuiltin, Int8_16_32_64Template { 2580 let Spellings = ["__iso_volatile_store"]; 2581 let Attributes = [NoThrow]; 2582 let Prototype = "void(T volatile*, T)"; 2583} 2584 2585def Noop : MSLangBuiltin { 2586 let Spellings = ["__noop"]; 2587 let Attributes = [NoThrow, Constexpr]; 2588 let Prototype = "int(...)"; 2589} 2590 2591def MSCountLeadingZeroes : MSLangBuiltin, MSUInt16_32_64Template { 2592 let Spellings = ["__lzcnt"]; 2593 let Attributes = [NoThrow, Const, Constexpr]; 2594 let Prototype = "T(T)"; 2595} 2596 2597def MSPopCount : MSLangBuiltin, MSUInt16_32_64Template { 2598 let Spellings = ["__popcnt"]; 2599 let Attributes = [NoThrow, Const, Constexpr]; 2600 let Prototype = "T(T)"; 2601} 2602 2603def MSReturnAddress : MSLangBuiltin { 2604 let Spellings = ["_ReturnAddress"]; 2605 let Attributes = [NoThrow]; 2606 let Prototype = "void*()"; 2607} 2608 2609def Rotl8 : MSLangBuiltin { 2610 let Spellings = ["_rotl8"]; 2611 let Attributes = [NoThrow, Constexpr]; 2612 let Prototype = "unsigned char(unsigned char, unsigned char)"; 2613} 2614 2615def Rotl16 : MSLangBuiltin { 2616 let Spellings = ["_rotl16"]; 2617 let Attributes = [NoThrow, Constexpr]; 2618 let Prototype = "unsigned short(unsigned short, unsigned char)"; 2619} 2620 2621def Rotl : MSLangBuiltin { 2622 let Spellings = ["_rotl"]; 2623 let Attributes = [NoThrow, Constexpr]; 2624 let Prototype = "unsigned int(unsigned int, int)"; 2625} 2626 2627def Lrotl : MSLangBuiltin { 2628 let Spellings = ["_lrotl"]; 2629 let Attributes = [NoThrow, Constexpr]; 2630 let Prototype = "unsigned long int(unsigned long int, int)"; 2631} 2632 2633def Rotl64 : MSLangBuiltin { 2634 let Spellings = ["_rotl64"]; 2635 let Attributes = [NoThrow, Constexpr]; 2636 let Prototype = "uint64_t(uint64_t, int)"; 2637} 2638 2639def Rotr8 : MSLangBuiltin { 2640 let Spellings = ["_rotr8"]; 2641 let Attributes = [NoThrow, Constexpr]; 2642 let Prototype = "unsigned char(unsigned char, unsigned char)"; 2643} 2644 2645def Rotr16 : MSLangBuiltin { 2646 let Spellings = ["_rotr16"]; 2647 let Attributes = [NoThrow, Constexpr]; 2648 let Prototype = "unsigned short(unsigned short, unsigned char)"; 2649} 2650 2651def Rotr : MSLangBuiltin { 2652 let Spellings = ["_rotr"]; 2653 let Attributes = [NoThrow, Constexpr]; 2654 let Prototype = "unsigned int(unsigned int, int)"; 2655} 2656 2657def Lrotr : MSLangBuiltin { 2658 let Spellings = ["_lrotr"]; 2659 let Attributes = [NoThrow, Constexpr]; 2660 let Prototype = "unsigned long int(unsigned long int, int)"; 2661} 2662 2663def Rotr64 : MSLangBuiltin { 2664 let Spellings = ["_rotr64"]; 2665 let Attributes = [NoThrow, Constexpr]; 2666 let Prototype = "uint64_t(uint64_t, int)"; 2667} 2668 2669def MSva_start : MSLangBuiltin { 2670 let Spellings = ["__va_start"]; 2671 let Attributes = [NoThrow, CustomTypeChecking]; 2672 let Prototype = "void(char**, ...)"; 2673} 2674 2675def FastFail : MSLangBuiltin { 2676 let Spellings = ["__fastfail"]; 2677 let Attributes = [NoThrow, NoReturn]; 2678 let Prototype = "void(unsigned int)"; 2679} 2680 2681// Microsoft library builtins. 2682def SetJmpEx : MSLibBuiltin<"setjmpex.h"> { 2683 let Spellings = ["_setjmpex"]; 2684 let Attributes = [IgnoreSignature, ReturnsTwice]; 2685 let Prototype = "int(jmp_buf)"; 2686} 2687 2688// C99 library functions 2689// C99 stdarg.h 2690def VaStart : LibBuiltin<"stdarg.h"> { 2691 let Spellings = ["va_start"]; 2692 let Attributes = [NoThrow]; 2693 let Prototype = "void(__builtin_va_list_ref, ...)"; 2694} 2695 2696def VaEnd : LibBuiltin<"stdarg.h"> { 2697 let Spellings = ["va_end"]; 2698 let Attributes = [NoThrow]; 2699 let Prototype = "void(__builtin_va_list_ref)"; 2700 let AddBuiltinPrefixedAlias = 1; 2701} 2702 2703def VaCopy : LibBuiltin<"stdarg.h"> { 2704 let Spellings = ["va_copy"]; 2705 let Attributes = [NoThrow]; 2706 let Prototype = "void(__builtin_va_list_ref, __builtin_va_list_ref)"; 2707 let AddBuiltinPrefixedAlias = 1; 2708} 2709 2710// C99 stdlib.h 2711def Abort : LibBuiltin<"stdlib.h"> { 2712 let Spellings = ["abort"]; 2713 let Attributes = [NoThrow, NoReturn]; 2714 let Prototype = "void()"; 2715 let AddBuiltinPrefixedAlias = 1; 2716} 2717 2718def Abs : IntMathTemplate, LibBuiltin<"stdlib.h"> { 2719 let Spellings = ["abs"]; 2720 let Attributes = [NoThrow, Const]; 2721 let Prototype = "T(T)"; 2722 let AddBuiltinPrefixedAlias = 1; 2723 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 2724} 2725 2726def Calloc : LibBuiltin<"stdlib.h"> { 2727 let Spellings = ["calloc"]; 2728 let Prototype = "void*(size_t, size_t)"; 2729} 2730 2731def Exit : LibBuiltin<"stdlib.h"> { 2732 let Spellings = ["exit", "_Exit"]; 2733 let Attributes = [NoReturn]; 2734 let Prototype = "void(int)"; 2735} 2736 2737def Malloc : LibBuiltin<"stdlib.h"> { 2738 let Spellings = ["malloc"]; 2739 let Prototype = "void*(size_t)"; 2740} 2741 2742def Realloc : LibBuiltin<"stdlib.h"> { 2743 let Spellings = ["realloc"]; 2744 let Prototype = "void*(void*, size_t)"; 2745} 2746 2747def Free : LibBuiltin<"stdlib.h"> { 2748 let Spellings = ["free"]; 2749 let Prototype = "void(void*)"; 2750} 2751 2752def StrToD : LibBuiltin<"stdlib.h"> { 2753 let Spellings = ["strtod"]; 2754 let Prototype = "double(char const*, char**)"; 2755} 2756 2757def StrToF : LibBuiltin<"stdlib.h"> { 2758 let Spellings = ["strtof"]; 2759 let Prototype = "float(char const*, char**)"; 2760} 2761 2762def StrToLd : LibBuiltin<"stdlib.h"> { 2763 let Spellings = ["strtold"]; 2764 let Prototype = "long double(char const*, char**)"; 2765} 2766 2767def StrToL : LibBuiltin<"stdlib.h"> { 2768 let Spellings = ["strtol"]; 2769 let Prototype = "long int(char const*, char**, int)"; 2770} 2771 2772def StrToLL : LibBuiltin<"stdlib.h"> { 2773 let Spellings = ["strtoll"]; 2774 let Prototype = "long long int(char const*, char**, int)"; 2775} 2776 2777def StrToUL : LibBuiltin<"stdlib.h"> { 2778 let Spellings = ["strtoul"]; 2779 let Prototype = "unsigned long int(char const*, char**, int)"; 2780} 2781 2782def StrToULL : LibBuiltin<"stdlib.h"> { 2783 let Spellings = ["strtoull"]; 2784 let Prototype = "unsigned long long int(char const*, char**, int)"; 2785} 2786 2787// C11 stdlib.h 2788def AlignedAlloc : LibBuiltin<"stdlib.h"> { 2789 let Spellings = ["aligned_alloc"]; 2790 let Prototype = "void*(size_t, size_t)"; 2791} 2792 2793// C99 string.h 2794def MemCpy : LibBuiltin<"string.h"> { 2795 let Spellings = ["memcpy"]; 2796 let Attributes = [NoThrow, Constexpr]; 2797 let Prototype = "void*(void*, void const*, size_t)"; 2798 let AddBuiltinPrefixedAlias = 1; 2799} 2800 2801def BuiltinMemCmp : Builtin { 2802 let Spellings = ["__builtin_memcmp"]; 2803 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr]; 2804 let Prototype = "int(void const*, void const*, size_t)"; 2805} 2806 2807def MemCmp : LibBuiltin<"string.h"> { 2808 let Spellings = ["memcmp"]; 2809 let Attributes = [Constexpr]; 2810 let Prototype = "int(void const*, void const*, size_t)"; 2811} 2812 2813def MemMove : LibBuiltin<"string.h"> { 2814 let Spellings = ["memmove"]; 2815 let Attributes = [NoThrow, Constexpr]; 2816 let Prototype = "void*(void*, void const*, size_t)"; 2817 let AddBuiltinPrefixedAlias = 1; 2818} 2819 2820def StrCpy : LibBuiltin<"string.h"> { 2821 let Spellings = ["strcpy"]; 2822 let Attributes = [NoThrow]; 2823 let Prototype = "char*(char*, char const*)"; 2824 let AddBuiltinPrefixedAlias = 1; 2825} 2826 2827def StrNCpy : LibBuiltin<"string.h"> { 2828 let Spellings = ["strncpy"]; 2829 let Attributes = [NoThrow]; 2830 let Prototype = "char*(char*, char const*, size_t)"; 2831 let AddBuiltinPrefixedAlias = 1; 2832} 2833 2834def StrCmp : LibBuiltin<"string.h"> { 2835 let Spellings = ["strcmp"]; 2836 let Attributes = [NoThrow, Constexpr]; 2837 let Prototype = "int(char const*, char const*)"; 2838 let AddBuiltinPrefixedAlias = 1; 2839} 2840 2841def StrNCmp : LibBuiltin<"string.h"> { 2842 let Spellings = ["strncmp"]; 2843 let Attributes = [NoThrow, Constexpr]; 2844 let Prototype = "int(char const*, char const*, size_t)"; 2845 let AddBuiltinPrefixedAlias = 1; 2846} 2847 2848def StrCat : LibBuiltin<"string.h"> { 2849 let Spellings = ["strcat"]; 2850 let Attributes = [NoThrow]; 2851 let Prototype = "char*(char*, char const*)"; 2852 let AddBuiltinPrefixedAlias = 1; 2853} 2854 2855def StrNCat : LibBuiltin<"string.h"> { 2856 let Spellings = ["strncat"]; 2857 let Attributes = [NoThrow]; 2858 let Prototype = "char*(char*, char const*, size_t)"; 2859 let AddBuiltinPrefixedAlias = 1; 2860} 2861 2862def StrxFrm : LibBuiltin<"string.h"> { 2863 let Spellings = ["strxfrm"]; 2864 let Prototype = "size_t(char*, char const*, size_t)"; 2865} 2866 2867def MemChr : LibBuiltin<"string.h"> { 2868 let Spellings = ["memchr"]; 2869 let Attributes = [NoThrow, Constexpr]; 2870 let Prototype = "void*(void const*, int, size_t)"; 2871 let AddBuiltinPrefixedAlias = 1; 2872} 2873 2874def StrChr : LibBuiltin<"string.h"> { 2875 let Spellings = ["strchr"]; 2876 let Attributes = [NoThrow, Constexpr]; 2877 let Prototype = "char*(char const*, int)"; 2878 let AddBuiltinPrefixedAlias = 1; 2879} 2880 2881def StrcSpn : LibBuiltin<"string.h"> { 2882 let Spellings = ["strcspn"]; 2883 let Prototype = "size_t(char const*, char const*)"; 2884} 2885 2886def StrpBrk : LibBuiltin<"string.h"> { 2887 let Spellings = ["strpbrk"]; 2888 let Attributes = [NoThrow]; 2889 let Prototype = "char*(char const*, char const*)"; 2890 let AddBuiltinPrefixedAlias = 1; 2891} 2892 2893def StrrChr : LibBuiltin<"string.h"> { 2894 let Spellings = ["strrchr"]; 2895 let Attributes = [NoThrow]; 2896 let Prototype = "char*(char const*, int)"; 2897 let AddBuiltinPrefixedAlias = 1; 2898} 2899 2900def StrSpn : LibBuiltin<"string.h"> { 2901 let Spellings = ["strspn"]; 2902 let Attributes = [NoThrow]; 2903 let Prototype = "size_t(char const*, char const*)"; 2904 let AddBuiltinPrefixedAlias = 1; 2905} 2906 2907def StrStr : LibBuiltin<"string.h"> { 2908 let Spellings = ["strstr"]; 2909 let Attributes = [NoThrow]; 2910 let Prototype = "char*(char const*, char const*)"; 2911 let AddBuiltinPrefixedAlias = 1; 2912} 2913 2914def StrTok : LibBuiltin<"string.h"> { 2915 let Spellings = ["strtok"]; 2916 let Prototype = "char*(char*, char const*)"; 2917} 2918 2919def MemSet : LibBuiltin<"string.h"> { 2920 let Spellings = ["memset"]; 2921 let Attributes = [NoThrow]; 2922 let Prototype = "void*(void*, int, size_t)"; 2923 let AddBuiltinPrefixedAlias = 1; 2924} 2925 2926def StrError : LibBuiltin<"string.h"> { 2927 let Spellings = ["strerror"]; 2928 let Prototype = "char*(int)"; 2929} 2930 2931def StrLen : LibBuiltin<"string.h"> { 2932 let Spellings = ["strlen"]; 2933 let Attributes = [NoThrow, Constexpr]; 2934 let Prototype = "size_t(char const*)"; 2935 let AddBuiltinPrefixedAlias = 1; 2936} 2937 2938// C99 stdio.h 2939// FIXME: This list is incomplete. 2940def Printf : LibBuiltin<"stdio.h"> { 2941 let Spellings = ["printf"]; 2942 let Attributes = [PrintfFormat<0>]; 2943 let Prototype = "int(char const*, ...)"; 2944} 2945 2946// FIXME: The builtin and library function should have the same signature. 2947def BuiltinPrintf : Builtin { 2948 let Spellings = ["__builtin_printf"]; 2949 let Attributes = [NoThrow, PrintfFormat<0>, FunctionWithBuiltinPrefix]; 2950 let Prototype = "int(char const* restrict, ...)"; 2951} 2952 2953def FPrintf : LibBuiltin<"stdio.h"> { 2954 let Spellings = ["fprintf"]; 2955 let Attributes = [NoThrow, PrintfFormat<1>]; 2956 let Prototype = "int(FILE* restrict, char const* restrict, ...)"; 2957 let AddBuiltinPrefixedAlias = 1; 2958} 2959 2960def SnPrintf : LibBuiltin<"stdio.h"> { 2961 let Spellings = ["snprintf"]; 2962 let Attributes = [NoThrow, PrintfFormat<2>]; 2963 let Prototype = "int(char* restrict, size_t, char const* restrict, ...)"; 2964 let AddBuiltinPrefixedAlias = 1; 2965} 2966 2967def SPrintf : LibBuiltin<"stdio.h"> { 2968 let Spellings = ["sprintf"]; 2969 let Attributes = [NoThrow, PrintfFormat<1>]; 2970 let Prototype = "int(char* restrict, char const* restrict, ...)"; 2971 let AddBuiltinPrefixedAlias = 1; 2972} 2973 2974def VPrintf : LibBuiltin<"stdio.h"> { 2975 let Spellings = ["vprintf"]; 2976 let Attributes = [NoThrow, VPrintfFormat<0>]; 2977 let Prototype = "int(char const* restrict, __builtin_va_list)"; 2978 let AddBuiltinPrefixedAlias = 1; 2979} 2980 2981def VfPrintf : LibBuiltin<"stdio.h"> { 2982 let Spellings = ["vfprintf"]; 2983 let Attributes = [NoThrow, VPrintfFormat<1>]; 2984 let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)"; 2985 let AddBuiltinPrefixedAlias = 1; 2986} 2987 2988def VsnPrintf : LibBuiltin<"stdio.h"> { 2989 let Spellings = ["vsnprintf"]; 2990 let Attributes = [NoThrow, VPrintfFormat<2>]; 2991 let Prototype = "int(char* restrict, size_t, char const* restrict, __builtin_va_list)"; 2992 let AddBuiltinPrefixedAlias = 1; 2993} 2994 2995def VsPrintf : LibBuiltin<"stdio.h"> { 2996 let Spellings = ["vsprintf"]; 2997 let Attributes = [NoThrow, VPrintfFormat<1>]; 2998 let Prototype = "int(char* restrict, char const* restrict, __builtin_va_list)"; 2999 let AddBuiltinPrefixedAlias = 1; 3000} 3001 3002def Scanf : LibBuiltin<"stdio.h"> { 3003 let Spellings = ["scanf"]; 3004 let Attributes = [ScanfFormat<0>]; 3005 let Prototype = "int(char const* restrict, ...)"; 3006 let AddBuiltinPrefixedAlias = 1; 3007} 3008 3009def FScanf : LibBuiltin<"stdio.h"> { 3010 let Spellings = ["fscanf"]; 3011 let Attributes = [ScanfFormat<1>]; 3012 let Prototype = "int(FILE* restrict, char const* restrict, ...)"; 3013 let AddBuiltinPrefixedAlias = 1; 3014} 3015 3016def SScanf : LibBuiltin<"stdio.h"> { 3017 let Spellings = ["sscanf"]; 3018 let Attributes = [ScanfFormat<1>]; 3019 let Prototype = "int(char const* restrict, char const* restrict, ...)"; 3020 let AddBuiltinPrefixedAlias = 1; 3021} 3022 3023def VScanf : LibBuiltin<"stdio.h"> { 3024 let Spellings = ["vscanf"]; 3025 let Attributes = [VScanfFormat<0>]; 3026 let Prototype = "int(char const* restrict, __builtin_va_list)"; 3027 let AddBuiltinPrefixedAlias = 1; 3028} 3029 3030def VFScanf : LibBuiltin<"stdio.h"> { 3031 let Spellings = ["vfscanf"]; 3032 let Attributes = [VScanfFormat<1>]; 3033 let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)"; 3034 let AddBuiltinPrefixedAlias = 1; 3035} 3036 3037def VSScanf : LibBuiltin<"stdio.h"> { 3038 let Spellings = ["vsscanf"]; 3039 let Attributes = [VScanfFormat<1>]; 3040 let Prototype = "int(char const* restrict, char const* restrict, __builtin_va_list)"; 3041 let AddBuiltinPrefixedAlias = 1; 3042} 3043 3044def Fopen : LibBuiltin<"stdio.h"> { 3045 let Spellings = ["fopen"]; 3046 let Prototype = "FILE*(char const*, char const*)"; 3047} 3048 3049def Fread : LibBuiltin<"stdio.h"> { 3050 let Spellings = ["fread"]; 3051 let Prototype = "size_t(void*, size_t, size_t, FILE*)"; 3052} 3053 3054def Fwrite : LibBuiltin<"stdio.h"> { 3055 let Spellings = ["fwrite"]; 3056 let Prototype = "size_t(void const*, size_t, size_t, FILE*)"; 3057} 3058 3059// C99 ctype.h 3060 3061def IsAlNum : LibBuiltin<"ctype.h"> { 3062 let Spellings = ["isalnum"]; 3063 let Attributes = [NoThrow, Pure]; 3064 let Prototype = "int(int)"; 3065} 3066 3067def IsAlpha : LibBuiltin<"ctype.h"> { 3068 let Spellings = ["isalpha"]; 3069 let Attributes = [NoThrow, Pure]; 3070 let Prototype = "int(int)"; 3071} 3072 3073def IsBlank : LibBuiltin<"ctype.h"> { 3074 let Spellings = ["isblank"]; 3075 let Attributes = [NoThrow, Pure]; 3076 let Prototype = "int(int)"; 3077} 3078 3079def IsCntrl : LibBuiltin<"ctype.h"> { 3080 let Spellings = ["iscntrl"]; 3081 let Attributes = [NoThrow, Pure]; 3082 let Prototype = "int(int)"; 3083} 3084 3085def IsDigit : LibBuiltin<"ctype.h"> { 3086 let Spellings = ["isdigit"]; 3087 let Attributes = [NoThrow, Pure]; 3088 let Prototype = "int(int)"; 3089} 3090 3091def IsGraph : LibBuiltin<"ctype.h"> { 3092 let Spellings = ["isgraph"]; 3093 let Attributes = [NoThrow, Pure]; 3094 let Prototype = "int(int)"; 3095} 3096 3097def IsLower : LibBuiltin<"ctype.h"> { 3098 let Spellings = ["islower"]; 3099 let Attributes = [NoThrow, Pure]; 3100 let Prototype = "int(int)"; 3101} 3102 3103def IsPrint : LibBuiltin<"ctype.h"> { 3104 let Spellings = ["isprint"]; 3105 let Attributes = [NoThrow, Pure]; 3106 let Prototype = "int(int)"; 3107} 3108 3109def IsPunct : LibBuiltin<"ctype.h"> { 3110 let Spellings = ["ispunct"]; 3111 let Attributes = [NoThrow, Pure]; 3112 let Prototype = "int(int)"; 3113} 3114 3115def IsSpace : LibBuiltin<"ctype.h"> { 3116 let Spellings = ["isspace"]; 3117 let Attributes = [NoThrow, Pure]; 3118 let Prototype = "int(int)"; 3119} 3120 3121def IsUpper : LibBuiltin<"ctype.h"> { 3122 let Spellings = ["isupper"]; 3123 let Attributes = [NoThrow, Pure]; 3124 let Prototype = "int(int)"; 3125} 3126 3127def IsXDigit : LibBuiltin<"ctype.h"> { 3128 let Spellings = ["isxdigit"]; 3129 let Attributes = [NoThrow, Pure]; 3130 let Prototype = "int(int)"; 3131} 3132 3133def ToLower : LibBuiltin<"ctype.h"> { 3134 let Spellings = ["tolower"]; 3135 let Attributes = [NoThrow, Pure]; 3136 let Prototype = "int(int)"; 3137} 3138 3139def ToUpper : LibBuiltin<"ctype.h"> { 3140 let Spellings = ["toupper"]; 3141 let Attributes = [NoThrow, Pure]; 3142 let Prototype = "int(int)"; 3143} 3144 3145// C99 wchar.h 3146// FIXME: This list is incomplete. We should cover at least the functions that 3147// take format strings. 3148 3149def WcsChr : LibBuiltin<"wchar.h"> { 3150 let Spellings = ["wcschr"]; 3151 let Attributes = [NoThrow, Pure, Constexpr]; 3152 let Prototype = "wchar_t*(wchar_t const*, wchar_t)"; 3153 let AddBuiltinPrefixedAlias = 1; 3154} 3155 3156def WcsCmp : LibBuiltin<"wchar.h"> { 3157 let Spellings = ["wcscmp"]; 3158 let Attributes = [NoThrow, Pure, Constexpr]; 3159 let Prototype = "int(wchar_t const*, wchar_t const*)"; 3160 let AddBuiltinPrefixedAlias = 1; 3161} 3162 3163def WcsLen : LibBuiltin<"wchar.h"> { 3164 let Spellings = ["wcslen"]; 3165 let Attributes = [NoThrow, Pure, Constexpr]; 3166 let Prototype = "size_t(wchar_t const*)"; 3167 let AddBuiltinPrefixedAlias = 1; 3168} 3169 3170def WcsnCmp : LibBuiltin<"wchar.h"> { 3171 let Spellings = ["wcsncmp"]; 3172 let Attributes = [NoThrow, Pure, Constexpr]; 3173 let Prototype = "int(wchar_t const*, wchar_t const*, size_t)"; 3174 let AddBuiltinPrefixedAlias = 1; 3175} 3176 3177def WMemChr : LibBuiltin<"wchar.h"> { 3178 let Spellings = ["wmemchr"]; 3179 let Attributes = [NoThrow, Constexpr]; 3180 let Prototype = "wchar_t*(wchar_t const*, wchar_t, size_t)"; 3181 let AddBuiltinPrefixedAlias = 1; 3182} 3183 3184def WMemCmp : LibBuiltin<"wchar.h"> { 3185 let Spellings = ["wmemcmp"]; 3186 let Attributes = [NoThrow, Constexpr]; 3187 let Prototype = "int(wchar_t const*, wchar_t const*, size_t)"; 3188 let AddBuiltinPrefixedAlias = 1; 3189} 3190 3191def WMemCpy : LibBuiltin<"wchar.h"> { 3192 let Spellings = ["wmemcpy"]; 3193 let Attributes = [NoThrow, Constexpr]; 3194 let Prototype = "wchar_t*(wchar_t*, wchar_t const*, size_t)"; 3195 let AddBuiltinPrefixedAlias = 1; 3196} 3197 3198def WMemMove : LibBuiltin<"wchar.h"> { 3199 let Spellings = ["wmemmove"]; 3200 let Attributes = [NoThrow, Constexpr]; 3201 let Prototype = "wchar_t*(wchar_t*, wchar_t const*, size_t)"; 3202 let AddBuiltinPrefixedAlias = 1; 3203} 3204 3205// C99 3206 3207// FIXME: MinGW _setjmp has an additional void* parameter. 3208def SetJmp : LibBuiltin<"setjmp.h"> { 3209 let Spellings = ["setjmp", "_setjmp"]; 3210 let Attributes = [ReturnsTwice, IgnoreSignature]; 3211 let Prototype = "int(jmp_buf)"; 3212 let RequiresUndef = 1; 3213} 3214 3215def LongJmp : LibBuiltin<"setjmp.h"> { 3216 let Spellings = ["longjmp"]; 3217 let Attributes = [NoReturn, IgnoreSignature]; 3218 let Prototype = "void(jmp_buf, int)"; 3219} 3220 3221// Non-C library functions, active in GNU mode only. 3222// Functions with [[gnu::returns_twice]] attribute are still active in 3223// all languages, because losing this attribute would result in miscompilation 3224// when these functions are used in non-GNU mode. PR16138. 3225 3226def AllocA : GNULibBuiltin<"stdlib.h"> { 3227 let Spellings = ["alloca"]; 3228 let Attributes = [NoThrow]; 3229 let Prototype = "void*(size_t)"; 3230 let AddBuiltinPrefixedAlias = 1; 3231} 3232 3233// POSIX malloc.h 3234 3235def MemAlign : GNULibBuiltin<"malloc.h"> { 3236 let Spellings = ["memalign"]; 3237 let Prototype = "void*(size_t, size_t)"; 3238} 3239 3240// POSIX string.h 3241 3242def MemcCpy : GNULibBuiltin<"string.h"> { 3243 let Spellings = ["memccpy"]; 3244 let Prototype = "void*(void*, void const*, int, size_t)"; 3245} 3246 3247def MempCpy : GNULibBuiltin<"string.h"> { 3248 let Spellings = ["mempcpy"]; 3249 let Prototype = "void*(void*, void const*, size_t)"; 3250} 3251 3252def StpCpy : GNULibBuiltin<"string.h"> { 3253 let Spellings = ["stpcpy"]; 3254 let Attributes = [NoThrow]; 3255 let Prototype = "char*(char*, char const*)"; 3256 let AddBuiltinPrefixedAlias = 1; 3257} 3258 3259def StpnCpy : GNULibBuiltin<"string.h"> { 3260 let Spellings = ["stpncpy"]; 3261 let Attributes = [NoThrow]; 3262 let Prototype = "char*(char*, char const*, size_t)"; 3263 let AddBuiltinPrefixedAlias = 1; 3264} 3265 3266def StrDup : GNULibBuiltin<"string.h"> { 3267 let Spellings = ["strdup"]; 3268 let Attributes = [NoThrow]; 3269 let Prototype = "char*(char const*)"; 3270 let AddBuiltinPrefixedAlias = 1; 3271} 3272 3273def StrnDup : GNULibBuiltin<"string.h"> { 3274 let Spellings = ["strndup"]; 3275 let Attributes = [NoThrow]; 3276 let Prototype = "char*(char const*, size_t)"; 3277 let AddBuiltinPrefixedAlias = 1; 3278} 3279 3280// POSIX strings.h 3281 3282def Index : GNULibBuiltin<"strings.h"> { 3283 let Spellings = ["index"]; 3284 let Attributes = [NoThrow]; 3285 let Prototype = "char*(char const*, int)"; 3286 let AddBuiltinPrefixedAlias = 1; 3287} 3288 3289def Rindex : GNULibBuiltin<"strings.h"> { 3290 let Spellings = ["rindex"]; 3291 let Attributes = [NoThrow]; 3292 let Prototype = "char*(char const*, int)"; 3293 let AddBuiltinPrefixedAlias = 1; 3294} 3295 3296def BZero : GNULibBuiltin<"strings.h"> { 3297 let Spellings = ["bzero"]; 3298 let Attributes = [NoThrow]; 3299 let Prototype = "void(void*, size_t)"; 3300 let AddBuiltinPrefixedAlias = 1; 3301} 3302 3303def Bcopy : GNULibBuiltin<"strings.h"> { 3304 let Spellings = ["bcopy"]; 3305 let Attributes = [NoThrow]; 3306 let Prototype = "void(void const*, void*, size_t)"; 3307 let AddBuiltinPrefixedAlias = 1; 3308} 3309 3310// FIXME: This should be part of BCmp. 3311def BuiltinBCmp : Builtin { 3312 let Spellings = ["__builtin_bcmp"]; 3313 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr]; 3314 let Prototype = "int(void const*, void const*, size_t)"; 3315} 3316 3317def BCmp : GNULibBuiltin<"strings.h"> { 3318 let Spellings = ["bcmp"]; 3319 let Attributes = [Constexpr]; 3320 let Prototype = "int(void const*, void const*, size_t)"; 3321} 3322 3323def StrCaseCmp : GNULibBuiltin<"strings.h"> { 3324 let Spellings = ["strcasecmp"]; 3325 let Prototype = "int(char const*, char const*)"; 3326 let AddBuiltinPrefixedAlias = 1; 3327 let RequiresUndef = 1; 3328} 3329 3330def StrnCaseCmp : GNULibBuiltin<"strings.h"> { 3331 let Spellings = ["strncasecmp"]; 3332 let Prototype = "int(char const*, char const*, size_t)"; 3333 let AddBuiltinPrefixedAlias = 1; 3334 let RequiresUndef = 1; 3335} 3336 3337def GNU_Exit : GNULibBuiltin<"unistd.h"> { 3338 let Spellings = ["_exit"]; 3339 let Attributes = [NoReturn]; 3340 let Prototype = "void(int)"; 3341} 3342 3343def VFork : LibBuiltin<"unistd.h"> { 3344 let Spellings = ["vfork"]; 3345 let Attributes = [ReturnsTwice, IgnoreSignature]; 3346 let Prototype = "pid_t()"; 3347} 3348 3349// POSIX pthread.h 3350 3351def PthreadCreate : GNULibBuiltin<"pthread.h"> { 3352 let Spellings = ["pthread_create"]; 3353 let Attributes = [FunctionWithoutBuiltinPrefix, Callback<[2, 3]>]; 3354 // Note that we don't have an expressable prototype so we leave it empty. 3355 let Prototype = ""; 3356} 3357 3358def SigSetJmp : LibBuiltin<"setjmp.h"> { 3359 let Spellings = ["sigsetjmp", "__sigsetjmp"]; 3360 let Attributes = [ReturnsTwice, IgnoreSignature]; 3361 let Prototype = "int(sigjmp_buf, int)"; 3362} 3363 3364def SaveCtx : LibBuiltin<"setjmp.h"> { 3365 let Spellings = ["savectx"]; 3366 let Attributes = [ReturnsTwice, IgnoreSignature]; 3367 let Prototype = "int(sigjmp_buf)"; 3368} 3369 3370def GetContext : LibBuiltin<"setjmp.h"> { 3371 let Spellings = ["getcontext"]; 3372 let Attributes = [ReturnsTwice, IgnoreSignature]; 3373 let Prototype = "int(ucontext_t*)"; 3374} 3375 3376def GNU_LongJmp : GNULibBuiltin<"setjmp.h"> { 3377 let Spellings = ["_longjmp"]; 3378 let Attributes = [NoReturn, IgnoreSignature]; 3379 let Prototype = "void(jmp_buf, int)"; 3380} 3381 3382def SigLongJmp : GNULibBuiltin<"setjmp.h"> { 3383 let Spellings = ["siglongjmp"]; 3384 let Attributes = [NoReturn, IgnoreSignature]; 3385 let Prototype = "void(sigjmp_buf, int)"; 3386} 3387 3388// non-standard but very common 3389 3390def StrlCpy : GNULibBuiltin<"string.h"> { 3391 let Spellings = ["strlcpy"]; 3392 let Prototype = "size_t(char*, char const*, size_t)"; 3393} 3394 3395def StrlCat : GNULibBuiltin<"string.h"> { 3396 let Spellings = ["strlcat"]; 3397 let Prototype = "size_t(char*, char const*, size_t)"; 3398} 3399 3400def ObjcMsgSend : ObjCLibBuiltin<"objc_message.h"> { 3401 let Spellings = ["objc_msgSend"]; 3402 let Prototype = "id(id, SEL, ...)"; 3403} 3404 3405def ObjcMsgSendFpret : ObjCLibBuiltin<"objc_message.h"> { 3406 let Spellings = ["objc_msgSend_fpret"]; 3407 let Prototype = "long double(id, SEL, ...)"; 3408} 3409 3410def ObjcMsgSendFp2ret : ObjCLibBuiltin<"objc/message.h"> { 3411 let Spellings = ["objc_msgSend_fp2ret"]; 3412 let Prototype = "_Complex long double(id, SEL, ...)"; 3413} 3414 3415def ObjcMsgSendStret : ObjCLibBuiltin<"objc/message.h"> { 3416 let Spellings = ["objc_msgSend_stret"]; 3417 let Prototype = "void(id, SEL, ...)"; 3418} 3419 3420def ObjcMsgSendSuper : ObjCLibBuiltin<"objc/message.h"> { 3421 let Spellings = ["objc_msgSendSuper"]; 3422 let Prototype = "id(objc_super*, SEL, ...)"; 3423} 3424 3425def ObjcMsgSendSuperStret : ObjCLibBuiltin<"objc/message.h"> { 3426 let Spellings = ["objc_msgSendSuper_stret"]; 3427 let Prototype = "void(objc_super*, SEL, ...)"; 3428} 3429 3430def ObjcGetClass : ObjCLibBuiltin<"objc/runtime.h"> { 3431 let Spellings = ["objc_getClass"]; 3432 let Prototype = "id(char const*)"; 3433} 3434 3435def ObjcGetMetaClass : ObjCLibBuiltin<"objc/runtime.h"> { 3436 let Spellings = ["objc_getMetaClass"]; 3437 let Prototype = "id(char const*)"; 3438} 3439 3440def ObjcEnumerationMutation : ObjCLibBuiltin<"objc/runtime.h"> { 3441 let Spellings = ["objc_enumerationMutation"]; 3442 let Prototype = "void(id)"; 3443} 3444 3445def ObjcReadWeak : ObjCLibBuiltin<"objc/objc-auto.h"> { 3446 let Spellings = ["objc_read_weak"]; 3447 let Prototype = "id(id*)"; 3448} 3449 3450def ObjcAssignWeak : ObjCLibBuiltin<"objc/objc-auto.h"> { 3451 let Spellings = ["objc_assign_weak"]; 3452 let Prototype = "id(id, id*)"; 3453} 3454 3455def ObjcAssignIvar : ObjCLibBuiltin<"objc/objc-auto.h"> { 3456 let Spellings = ["objc_assign_ivar"]; 3457 let Prototype = "id(id, id, ptrdiff_t)"; 3458} 3459 3460def ObjcAssignGlobal : ObjCLibBuiltin<"objc/objc-auto.h"> { 3461 let Spellings = ["objc_assign_global"]; 3462 let Prototype = "id(id, id*)"; 3463} 3464 3465def ObjcAssignStrongCast : ObjCLibBuiltin<"objc/objc-auto.h"> { 3466 let Spellings = ["objc_assign_strongCast"]; 3467 let Prototype = "id(id, id*)"; 3468} 3469 3470def ObjcExceptionExtract : ObjCLibBuiltin<"objc/objc_exception.h"> { 3471 let Spellings = ["objc_exception_extract"]; 3472 let Prototype = "id(void*)"; 3473} 3474 3475def ObjcExceptionTryEnter : ObjCLibBuiltin<"objc/objc_exception.h"> { 3476 let Spellings = ["objc_exception_try_enter"]; 3477 let Prototype = "void(void*)"; 3478} 3479 3480def ObjcExceptionTryExit : ObjCLibBuiltin<"objc/objc_exception.h"> { 3481 let Spellings = ["objc_exception_try_exit"]; 3482 let Prototype = "void(void*)"; 3483} 3484 3485def ObjcExceptionMatch : ObjCLibBuiltin<"objc/objc_exception.h"> { 3486 let Spellings = ["objc_exception_match"]; 3487 let Prototype = "int(id, id)"; 3488} 3489 3490def ObjcExceptionThrow : ObjCLibBuiltin<"objc/objc_exception.h"> { 3491 let Spellings = ["objc_exception_throw"]; 3492 let Prototype = "void(id)"; 3493} 3494 3495def ObjcSyncEnter : ObjCLibBuiltin<"objc_objc_sync.h"> { 3496 let Spellings = ["objc_sync_enter"]; 3497 let Prototype = "int(id)"; 3498} 3499 3500def ObjcSyncExit : ObjCLibBuiltin<"objc_objc_sync.h"> { 3501 let Spellings = ["objc_sync_exit"]; 3502 let Prototype = "int(id)"; 3503} 3504 3505def ObjcMemmoveCollectable : Builtin { 3506 let Spellings = ["__builtin_objc_memmove_collectable"]; 3507 let Attributes = [NoThrow, FunctionWithBuiltinPrefix]; 3508 let Prototype = "void*(void*, void const*, size_t)"; 3509} 3510 3511def NSLog : ObjCLibBuiltin<"foundation_nsobjcruntime.h"> { 3512 let Spellings = ["NSLog"]; 3513 let Attributes = [PrintfFormat<0>]; 3514 let Prototype = "void(id, ...)"; 3515} 3516 3517def NSLogv : ObjCLibBuiltin<"foundation_nsobjcruntime.h"> { 3518 let Spellings = ["NSLogv"]; 3519 let Attributes = [VPrintfFormat<0>]; 3520 let Prototype = "void(id, __builtin_va_list)"; 3521} 3522 3523def Atan2 : FPMathTemplate, LibBuiltin<"math.h"> { 3524 let Spellings = ["atan2"]; 3525 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3526 let Prototype = "T(T, T)"; 3527 let AddBuiltinPrefixedAlias = 1; 3528} 3529 3530def Copysign : FPMathTemplate, LibBuiltin<"math.h"> { 3531 let Spellings = ["copysign"]; 3532 let Attributes = [NoThrow, Const]; 3533 let Prototype = "T(T, T)"; 3534 let AddBuiltinPrefixedAlias = 1; 3535 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3536} 3537 3538def Fabs : FPMathTemplate, LibBuiltin<"math.h"> { 3539 let Spellings = ["fabs"]; 3540 let Attributes = [NoThrow, Const]; 3541 let Prototype = "T(T)"; 3542 let AddBuiltinPrefixedAlias = 1; 3543 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3544} 3545 3546def Finite : FPMathTemplate, GNULibBuiltin<"math.h"> { 3547 let Spellings = ["finite"]; 3548 let Attributes = [NoThrow, Const]; 3549 let Prototype = "int(T)"; 3550 let RequiresUndef = 1; 3551} 3552 3553def OSXFinite : FPMathTemplate, LibBuiltin<"math.h"> { 3554 let Spellings = ["__finite"]; 3555 let Attributes = [NoThrow, Const]; 3556 let Prototype = "int(T)"; 3557} 3558 3559def Fmod : FPMathTemplate, LibBuiltin<"math.h"> { 3560 let Spellings = ["fmod"]; 3561 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3562 let Prototype = "T(T, T)"; 3563 let AddBuiltinPrefixedAlias = 1; 3564} 3565 3566def Frexp : FPMathTemplate, LibBuiltin<"math.h"> { 3567 let Spellings = ["frexp"]; 3568 let Attributes = [NoThrow]; 3569 let Prototype = "T(T, int*)"; 3570 let AddBuiltinPrefixedAlias = 1; 3571} 3572 3573def Sincos : FPMathTemplate, GNULibBuiltin<"math.h"> { 3574 let Spellings = ["sincos"]; 3575 let Attributes = [NoThrow]; 3576 let Prototype = "void(T, T*, T*)"; 3577 let AddBuiltinPrefixedAlias = 1; 3578} 3579 3580def SincosF16F128 : F16F128MathTemplate, Builtin { 3581 let Spellings = ["__builtin_sincos"]; 3582 let Attributes = [FunctionWithBuiltinPrefix, NoThrow]; 3583 let Prototype = "void(T, T*, T*)"; 3584} 3585 3586def Ldexp : FPMathTemplate, LibBuiltin<"math.h"> { 3587 let Spellings = ["ldexp"]; 3588 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3589 let Prototype = "T(T, int)"; 3590 let AddBuiltinPrefixedAlias = 1; 3591} 3592 3593def Modf : FPMathTemplate, LibBuiltin<"math.h"> { 3594 let Spellings = ["modf"]; 3595 let Attributes = [NoThrow]; 3596 let Prototype = "T(T, T*)"; 3597 let AddBuiltinPrefixedAlias = 1; 3598} 3599 3600def Nan : FPMathTemplate, LibBuiltin<"math.h"> { 3601 let Spellings = ["nan"]; 3602 let Attributes = [Pure, NoThrow]; 3603 let Prototype = "T(char const*)"; 3604 let AddBuiltinPrefixedAlias = 1; 3605 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3606} 3607 3608def Pow : FPMathTemplate, LibBuiltin<"math.h"> { 3609 let Spellings = ["pow"]; 3610 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3611 let Prototype = "T(T, T)"; 3612 let AddBuiltinPrefixedAlias = 1; 3613} 3614 3615def Acos : FPMathTemplate, LibBuiltin<"math.h"> { 3616 let Spellings = ["acos"]; 3617 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3618 let Prototype = "T(T)"; 3619 let AddBuiltinPrefixedAlias = 1; 3620} 3621 3622def Acosh : FPMathTemplate, LibBuiltin<"math.h"> { 3623 let Spellings = ["acosh"]; 3624 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3625 let Prototype = "T(T)"; 3626 let AddBuiltinPrefixedAlias = 1; 3627} 3628 3629def Asin : FPMathTemplate, LibBuiltin<"math.h"> { 3630 let Spellings = ["asin"]; 3631 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3632 let Prototype = "T(T)"; 3633 let AddBuiltinPrefixedAlias = 1; 3634} 3635 3636def Asinh : FPMathTemplate, LibBuiltin<"math.h"> { 3637 let Spellings = ["asinh"]; 3638 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3639 let Prototype = "T(T)"; 3640 let AddBuiltinPrefixedAlias = 1; 3641} 3642 3643def Atan : FPMathTemplate, LibBuiltin<"math.h"> { 3644 let Spellings = ["atan"]; 3645 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3646 let Prototype = "T(T)"; 3647 let AddBuiltinPrefixedAlias = 1; 3648} 3649 3650def Atanh : FPMathTemplate, LibBuiltin<"math.h"> { 3651 let Spellings = ["atanh"]; 3652 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3653 let Prototype = "T(T)"; 3654 let AddBuiltinPrefixedAlias = 1; 3655} 3656 3657def Cbrt : FPMathTemplate, LibBuiltin<"math.h"> { 3658 let Spellings = ["cbrt"]; 3659 let Attributes = [NoThrow, Const]; 3660 let Prototype = "T(T)"; 3661 let AddBuiltinPrefixedAlias = 1; 3662} 3663 3664def Ceil : FPMathTemplate, LibBuiltin<"math.h"> { 3665 let Spellings = ["ceil"]; 3666 let Attributes = [NoThrow, Const]; 3667 let Prototype = "T(T)"; 3668 let AddBuiltinPrefixedAlias = 1; 3669} 3670 3671def Cos : FPMathTemplate, LibBuiltin<"math.h"> { 3672 let Spellings = ["cos"]; 3673 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3674 let Prototype = "T(T)"; 3675 let AddBuiltinPrefixedAlias = 1; 3676} 3677 3678def Cosh : FPMathTemplate, LibBuiltin<"math.h"> { 3679 let Spellings = ["cosh"]; 3680 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3681 let Prototype = "T(T)"; 3682 let AddBuiltinPrefixedAlias = 1; 3683} 3684 3685def Erf : FPMathTemplate, LibBuiltin<"math.h"> { 3686 let Spellings = ["erf"]; 3687 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3688 let Prototype = "T(T)"; 3689 let AddBuiltinPrefixedAlias = 1; 3690} 3691 3692def Erfc : FPMathTemplate, LibBuiltin<"math.h"> { 3693 let Spellings = ["erfc"]; 3694 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3695 let Prototype = "T(T)"; 3696 let AddBuiltinPrefixedAlias = 1; 3697} 3698 3699def Exp : FPMathTemplate, LibBuiltin<"math.h"> { 3700 let Spellings = ["exp"]; 3701 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3702 let Prototype = "T(T)"; 3703 let AddBuiltinPrefixedAlias = 1; 3704} 3705 3706def Exp2 : FPMathTemplate, LibBuiltin<"math.h"> { 3707 let Spellings = ["exp2"]; 3708 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3709 let Prototype = "T(T)"; 3710 let AddBuiltinPrefixedAlias = 1; 3711} 3712 3713// FIXME: Why is there no builtin without the prefix? 3714def Exp10 : FPMathTemplate, Builtin { 3715 let Spellings = ["__builtin_exp10"]; 3716 let Attributes = [FunctionWithBuiltinPrefix, NoThrow, 3717 ConstIgnoringErrnoAndExceptions]; 3718 let Prototype = "T(T)"; 3719} 3720 3721def Expm1 : FPMathTemplate, LibBuiltin<"math.h"> { 3722 let Spellings = ["expm1"]; 3723 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3724 let Prototype = "T(T)"; 3725 let AddBuiltinPrefixedAlias = 1; 3726} 3727 3728def Fdim : FPMathTemplate, LibBuiltin<"math.h"> { 3729 let Spellings = ["fdim"]; 3730 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3731 let Prototype = "T(T, T)"; 3732 let AddBuiltinPrefixedAlias = 1; 3733} 3734 3735def Floor : FPMathTemplate, LibBuiltin<"math.h"> { 3736 let Spellings = ["floor"]; 3737 let Attributes = [NoThrow, Const]; 3738 let Prototype = "T(T)"; 3739 let AddBuiltinPrefixedAlias = 1; 3740} 3741 3742def Fma : FPMathTemplate, LibBuiltin<"math.h"> { 3743 let Spellings = ["fma"]; 3744 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3745 let Prototype = "T(T, T, T)"; 3746 let AddBuiltinPrefixedAlias = 1; 3747} 3748 3749def Fmax : FPMathTemplate, LibBuiltin<"math.h"> { 3750 let Spellings = ["fmax"]; 3751 let Attributes = [NoThrow, Const]; 3752 let Prototype = "T(T, T)"; 3753 let AddBuiltinPrefixedAlias = 1; 3754 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3755} 3756 3757def Fmin : FPMathTemplate, LibBuiltin<"math.h"> { 3758 let Spellings = ["fmin"]; 3759 let Attributes = [NoThrow, Const]; 3760 let Prototype = "T(T, T)"; 3761 let AddBuiltinPrefixedAlias = 1; 3762 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3763} 3764 3765def FmaximumNum : FPMathTemplate, LibBuiltin<"math.h"> { 3766 let Spellings = ["fmaximum_num"]; 3767 let Attributes = [NoThrow, Const]; 3768 let Prototype = "T(T, T)"; 3769 let AddBuiltinPrefixedAlias = 1; 3770 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3771} 3772 3773def FminimumNum : FPMathTemplate, LibBuiltin<"math.h"> { 3774 let Spellings = ["fminimum_num"]; 3775 let Attributes = [NoThrow, Const]; 3776 let Prototype = "T(T, T)"; 3777 let AddBuiltinPrefixedAlias = 1; 3778 let OnlyBuiltinPrefixedAliasIsConstexpr = 1; 3779} 3780 3781def Hypot : FPMathTemplate, LibBuiltin<"math.h"> { 3782 let Spellings = ["hypot"]; 3783 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3784 let Prototype = "T(T, T)"; 3785 let AddBuiltinPrefixedAlias = 1; 3786} 3787 3788def Ilogb : FPMathTemplate, LibBuiltin<"math.h"> { 3789 let Spellings = ["ilogb"]; 3790 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3791 let Prototype = "int(T)"; 3792 let AddBuiltinPrefixedAlias = 1; 3793} 3794 3795def Lgamma : FPMathTemplate, LibBuiltin<"math.h"> { 3796 let Spellings = ["lgamma"]; 3797 let Attributes = [NoThrow]; 3798 let Prototype = "T(T)"; 3799 let AddBuiltinPrefixedAlias = 1; 3800} 3801 3802def Llrint : FPMathTemplate, LibBuiltin<"math.h"> { 3803 let Spellings = ["llrint"]; 3804 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3805 let Prototype = "long long int(T)"; 3806 let AddBuiltinPrefixedAlias = 1; 3807} 3808 3809def Llround : FPMathTemplate, LibBuiltin<"math.h"> { 3810 let Spellings = ["llround"]; 3811 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3812 let Prototype = "long long int(T)"; 3813 let AddBuiltinPrefixedAlias = 1; 3814} 3815 3816def Log : FPMathTemplate, LibBuiltin<"math.h"> { 3817 let Spellings = ["log"]; 3818 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3819 let Prototype = "T(T)"; 3820 let AddBuiltinPrefixedAlias = 1; 3821} 3822 3823def Log10 : FPMathTemplate, LibBuiltin<"math.h"> { 3824 let Spellings = ["log10"]; 3825 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3826 let Prototype = "T(T)"; 3827 let AddBuiltinPrefixedAlias = 1; 3828} 3829 3830def Log1p : FPMathTemplate, LibBuiltin<"math.h"> { 3831 let Spellings = ["log1p"]; 3832 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3833 let Prototype = "T(T)"; 3834 let AddBuiltinPrefixedAlias = 1; 3835} 3836 3837def Log2 : FPMathTemplate, LibBuiltin<"math.h"> { 3838 let Spellings = ["log2"]; 3839 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3840 let Prototype = "T(T)"; 3841 let AddBuiltinPrefixedAlias = 1; 3842} 3843 3844def Logb : FPMathTemplate, LibBuiltin<"math.h"> { 3845 let Spellings = ["logb"]; 3846 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3847 let Prototype = "T(T)"; 3848 let AddBuiltinPrefixedAlias = 1; 3849} 3850 3851def Lrint : FPMathTemplate, LibBuiltin<"math.h"> { 3852 let Spellings = ["lrint"]; 3853 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3854 let Prototype = "long int(T)"; 3855 let AddBuiltinPrefixedAlias = 1; 3856} 3857 3858def Lround : FPMathTemplate, LibBuiltin<"math.h"> { 3859 let Spellings = ["lround"]; 3860 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3861 let Prototype = "long int(T)"; 3862 let AddBuiltinPrefixedAlias = 1; 3863} 3864 3865def Nearbyint : FPMathTemplate, LibBuiltin<"math.h"> { 3866 let Spellings = ["nearbyint"]; 3867 let Attributes = [NoThrow, Const]; 3868 let Prototype = "T(T)"; 3869 let AddBuiltinPrefixedAlias = 1; 3870} 3871 3872def Nextafter : FPMathTemplate, LibBuiltin<"math.h"> { 3873 let Spellings = ["nextafter"]; 3874 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3875 let Prototype = "T(T, T)"; 3876 let AddBuiltinPrefixedAlias = 1; 3877} 3878 3879def Nexttoward : FPMathTemplate, LibBuiltin<"math.h"> { 3880 let Spellings = ["nexttoward"]; 3881 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3882 let Prototype = "T(T, long double)"; 3883 let AddBuiltinPrefixedAlias = 1; 3884} 3885 3886def Remainder : FPMathTemplate, LibBuiltin<"math.h"> { 3887 let Spellings = ["remainder"]; 3888 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3889 let Prototype = "T(T, T)"; 3890 let AddBuiltinPrefixedAlias = 1; 3891} 3892 3893def Remquo : FPMathTemplate, LibBuiltin<"math.h"> { 3894 let Spellings = ["remquo"]; 3895 let Attributes = [NoThrow]; 3896 let Prototype = "T(T, T, int*)"; 3897 let AddBuiltinPrefixedAlias = 1; 3898} 3899 3900def Rint : FPMathTemplate, LibBuiltin<"math.h"> { 3901 let Spellings = ["rint"]; 3902 let Attributes = [NoThrow, ConstIgnoringExceptions]; 3903 let Prototype = "T(T)"; 3904 let AddBuiltinPrefixedAlias = 1; 3905} 3906 3907def Round : FPMathTemplate, LibBuiltin<"math.h"> { 3908 let Spellings = ["round"]; 3909 let Attributes = [NoThrow, Const]; 3910 let Prototype = "T(T)"; 3911 let AddBuiltinPrefixedAlias = 1; 3912} 3913 3914def RoundEven : FPMathTemplate, LibBuiltin<"math.h"> { 3915 let Spellings = ["roundeven"]; 3916 let Attributes = [NoThrow, Const]; 3917 let Prototype = "T(T)"; 3918 let AddBuiltinPrefixedAlias = 1; 3919} 3920 3921def Scalbln : FPMathTemplate, LibBuiltin<"math.h"> { 3922 let Spellings = ["scalbln"]; 3923 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3924 let Prototype = "T(T, long int)"; 3925 let AddBuiltinPrefixedAlias = 1; 3926} 3927 3928def Scalbn : FPMathTemplate, LibBuiltin<"math.h"> { 3929 let Spellings = ["scalbn"]; 3930 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3931 let Prototype = "T(T, int)"; 3932 let AddBuiltinPrefixedAlias = 1; 3933} 3934 3935def Sin : FPMathTemplate, LibBuiltin<"math.h"> { 3936 let Spellings = ["sin"]; 3937 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3938 let Prototype = "T(T)"; 3939 let AddBuiltinPrefixedAlias = 1; 3940} 3941 3942def Sinh : FPMathTemplate, LibBuiltin<"math.h"> { 3943 let Spellings = ["sinh"]; 3944 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3945 let Prototype = "T(T)"; 3946 let AddBuiltinPrefixedAlias = 1; 3947} 3948 3949def Sqrt : FPMathTemplate, LibBuiltin<"math.h"> { 3950 let Spellings = ["sqrt"]; 3951 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3952 let Prototype = "T(T)"; 3953 let AddBuiltinPrefixedAlias = 1; 3954} 3955 3956def Tan : FPMathTemplate, LibBuiltin<"math.h"> { 3957 let Spellings = ["tan"]; 3958 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3959 let Prototype = "T(T)"; 3960 let AddBuiltinPrefixedAlias = 1; 3961} 3962 3963def Tanh : FPMathTemplate, LibBuiltin<"math.h"> { 3964 let Spellings = ["tanh"]; 3965 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3966 let Prototype = "T(T)"; 3967 let AddBuiltinPrefixedAlias = 1; 3968} 3969 3970def Tgamma : FPMathTemplate, LibBuiltin<"math.h"> { 3971 let Spellings = ["tgamma"]; 3972 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3973 let Prototype = "T(T)"; 3974 let AddBuiltinPrefixedAlias = 1; 3975} 3976 3977def Trunc : FPMathTemplate, LibBuiltin<"math.h"> { 3978 let Spellings = ["trunc"]; 3979 let Attributes = [NoThrow, Const]; 3980 let Prototype = "T(T)"; 3981 let AddBuiltinPrefixedAlias = 1; 3982} 3983 3984def Cabs : FPMathTemplate, LibBuiltin<"complex.h"> { 3985 let Spellings = ["cabs"]; 3986 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3987 let Prototype = "T(_Complex T)"; 3988 let AddBuiltinPrefixedAlias = 1; 3989} 3990 3991def Cacos : FPMathTemplate, LibBuiltin<"complex.h"> { 3992 let Spellings = ["cacos"]; 3993 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 3994 let Prototype = "_Complex T(_Complex T)"; 3995 let AddBuiltinPrefixedAlias = 1; 3996} 3997 3998def Cacosh : FPMathTemplate, LibBuiltin<"complex.h"> { 3999 let Spellings = ["cacosh"]; 4000 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4001 let Prototype = "_Complex T(_Complex T)"; 4002 let AddBuiltinPrefixedAlias = 1; 4003} 4004 4005def Carg : FPMathTemplate, LibBuiltin<"complex.h"> { 4006 let Spellings = ["carg"]; 4007 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4008 let Prototype = "T(_Complex T)"; 4009 let AddBuiltinPrefixedAlias = 1; 4010} 4011 4012def Casin : FPMathTemplate, LibBuiltin<"complex.h"> { 4013 let Spellings = ["casin"]; 4014 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4015 let Prototype = "_Complex T(_Complex T)"; 4016 let AddBuiltinPrefixedAlias = 1; 4017} 4018 4019def Casinh : FPMathTemplate, LibBuiltin<"complex.h"> { 4020 let Spellings = ["casinh"]; 4021 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4022 let Prototype = "_Complex T(_Complex T)"; 4023 let AddBuiltinPrefixedAlias = 1; 4024} 4025 4026def Catan : FPMathTemplate, LibBuiltin<"complex.h"> { 4027 let Spellings = ["catan"]; 4028 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4029 let Prototype = "_Complex T(_Complex T)"; 4030 let AddBuiltinPrefixedAlias = 1; 4031} 4032 4033def Catanh : FPMathTemplate, LibBuiltin<"complex.h"> { 4034 let Spellings = ["catanh"]; 4035 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4036 let Prototype = "_Complex T(_Complex T)"; 4037 let AddBuiltinPrefixedAlias = 1; 4038} 4039 4040def Ccos : FPMathTemplate, LibBuiltin<"complex.h"> { 4041 let Spellings = ["ccos"]; 4042 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4043 let Prototype = "_Complex T(_Complex T)"; 4044 let AddBuiltinPrefixedAlias = 1; 4045} 4046 4047def Ccosh : FPMathTemplate, LibBuiltin<"complex.h"> { 4048 let Spellings = ["ccosh"]; 4049 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4050 let Prototype = "_Complex T(_Complex T)"; 4051 let AddBuiltinPrefixedAlias = 1; 4052} 4053 4054def Cexp : FPMathTemplate, LibBuiltin<"complex.h"> { 4055 let Spellings = ["cexp"]; 4056 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4057 let Prototype = "_Complex T(_Complex T)"; 4058 let AddBuiltinPrefixedAlias = 1; 4059} 4060 4061def Cimag : FPMathTemplate, LibBuiltin<"complex.h"> { 4062 let Spellings = ["cimag"]; 4063 let Attributes = [NoThrow, Const]; 4064 let Prototype = "T(_Complex T)"; 4065 let AddBuiltinPrefixedAlias = 1; 4066} 4067 4068def Conj : FPMathTemplate, LibBuiltin<"complex.h"> { 4069 let Spellings = ["conj"]; 4070 let Attributes = [NoThrow, Const]; 4071 let Prototype = "_Complex T(_Complex T)"; 4072 let AddBuiltinPrefixedAlias = 1; 4073} 4074 4075def Clog : FPMathTemplate, LibBuiltin<"complex.h"> { 4076 let Spellings = ["clog"]; 4077 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4078 let Prototype = "_Complex T(_Complex T)"; 4079 let AddBuiltinPrefixedAlias = 1; 4080} 4081 4082def Cproj : FPMathTemplate, LibBuiltin<"complex.h"> { 4083 let Spellings = ["cproj"]; 4084 let Attributes = [NoThrow, Const]; 4085 let Prototype = "_Complex T(_Complex T)"; 4086 let AddBuiltinPrefixedAlias = 1; 4087} 4088 4089def Cpow : FPMathTemplate, LibBuiltin<"complex.h"> { 4090 let Spellings = ["cpow"]; 4091 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4092 let Prototype = "_Complex T(_Complex T, _Complex T)"; 4093 let AddBuiltinPrefixedAlias = 1; 4094} 4095 4096def Creal : FPMathTemplate, LibBuiltin<"complex.h"> { 4097 let Spellings = ["creal"]; 4098 let Attributes = [NoThrow, Const]; 4099 let Prototype = "T(_Complex T)"; 4100 let AddBuiltinPrefixedAlias = 1; 4101} 4102 4103def Csin : FPMathTemplate, LibBuiltin<"complex.h"> { 4104 let Spellings = ["csin"]; 4105 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4106 let Prototype = "_Complex T(_Complex T)"; 4107 let AddBuiltinPrefixedAlias = 1; 4108} 4109 4110def Csinh : FPMathTemplate, LibBuiltin<"complex.h"> { 4111 let Spellings = ["csinh"]; 4112 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4113 let Prototype = "_Complex T(_Complex T)"; 4114 let AddBuiltinPrefixedAlias = 1; 4115} 4116 4117def Csqrt : FPMathTemplate, LibBuiltin<"complex.h"> { 4118 let Spellings = ["csqrt"]; 4119 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4120 let Prototype = "_Complex T(_Complex T)"; 4121 let AddBuiltinPrefixedAlias = 1; 4122} 4123 4124def Ctan : FPMathTemplate, LibBuiltin<"complex.h"> { 4125 let Spellings = ["ctan"]; 4126 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4127 let Prototype = "_Complex T(_Complex T)"; 4128 let AddBuiltinPrefixedAlias = 1; 4129} 4130 4131def Ctanh : FPMathTemplate, LibBuiltin<"complex.h"> { 4132 let Spellings = ["ctanh"]; 4133 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4134 let Prototype = "_Complex T(_Complex T)"; 4135 let AddBuiltinPrefixedAlias = 1; 4136} 4137 4138// __sinpi and friends are OS X specific library functions, but otherwise much 4139// like the standard (non-complex) sin (etc). 4140def Sinpi : LibBuiltin<"math.h">, FloatDoubleTemplate { 4141 let Spellings = ["__sinpi"]; 4142 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4143 let Prototype = "T(T)"; 4144} 4145 4146def Cospi : LibBuiltin<"math.h">, FloatDoubleTemplate { 4147 let Spellings = ["__cospi"]; 4148 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4149 let Prototype = "T(T)"; 4150} 4151 4152def Tanpi : LibBuiltin<"math.h">, FloatDoubleTemplate { 4153 let Spellings = ["__tanpi"]; 4154 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4155 let Prototype = "T(T)"; 4156} 4157 4158// Similarly, __exp10 is OS X only 4159def OSXExp10 : LibBuiltin<"math.h">, FloatDoubleTemplate { 4160 let Spellings = ["__exp10"]; 4161 let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions]; 4162 let Prototype = "T(T)"; 4163} 4164 4165// Blocks runtime Builtin math library functions. 4166def BlockObjectAssign : LibBuiltin<"blocks.h"> { 4167 let Spellings = ["_Block_object_assign"]; 4168 let Prototype = "void(void*, void const*, int const)"; 4169} 4170 4171def BlockObjectDispose : LibBuiltin<"blocks.h"> { 4172 let Spellings = ["_Block_object_dispose"]; 4173 let Prototype = "void(void const*, int const)"; 4174} 4175// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. 4176 4177def __Addressof : LangBuiltin<"CXX_LANG"> { 4178 let Spellings = ["__addressof"]; 4179 let Attributes = [FunctionWithoutBuiltinPrefix, NoThrow, Const, 4180 IgnoreSignature, Constexpr]; 4181 let Prototype = "void*(void&)"; 4182 let Namespace = "std"; 4183} 4184 4185def Addressof : CxxLibBuiltin<"memory"> { 4186 let Spellings = ["addressof"]; 4187 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4188 Constexpr]; 4189 let Prototype = "void*(void&)"; 4190 let Namespace = "std"; 4191} 4192 4193def AsConst : CxxLibBuiltin<"utility"> { 4194 let Spellings = ["as_const"]; 4195 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4196 Constexpr]; 4197 let Prototype = "void&(void&)"; 4198 let Namespace = "std"; 4199} 4200 4201def Forward : CxxLibBuiltin<"utility"> { 4202 let Spellings = ["forward"]; 4203 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4204 Constexpr]; 4205 let Prototype = "void&(void&)"; 4206 let Namespace = "std"; 4207} 4208 4209def ForwardLike : CxxLibBuiltin<"utility"> { 4210 let Spellings = ["forward_like"]; 4211 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4212 Constexpr]; 4213 let Prototype = "void&(void&)"; 4214 let Namespace = "std"; 4215} 4216 4217def Move : CxxLibBuiltin<"utility"> { 4218 let Spellings = ["move"]; 4219 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4220 Constexpr]; 4221 let Prototype = "void&(void&)"; 4222 let Namespace = "std"; 4223} 4224 4225def MoveIfNsoexcept : CxxLibBuiltin<"utility"> { 4226 let Spellings = ["move_if_noexcept"]; 4227 let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration, 4228 Constexpr]; 4229 let Prototype = "void&(void&)"; 4230 let Namespace = "std"; 4231} 4232 4233def Annotation : Builtin { 4234 let Spellings = ["__builtin_annotation"]; 4235 let Attributes = [NoThrow, CustomTypeChecking]; 4236 let Prototype = "void(...)"; 4237} 4238 4239// Invariants 4240def Assume : Builtin { 4241 let Spellings = ["__builtin_assume"]; 4242 let Attributes = [NoThrow, Constexpr]; 4243 let Prototype = "void(bool)"; 4244} 4245 4246def AssumeSeparateStorage : Builtin { 4247 let Spellings = ["__builtin_assume_separate_storage"]; 4248 let Attributes = [NoThrow, Constexpr]; 4249 let Prototype = "void(void const volatile*, void const volatile*)"; 4250} 4251 4252// Multiprecision Arithmetic Builtins. 4253 4254class MPATemplate : Template< 4255 ["unsigned char", "unsigned short", "unsigned int", 4256 "unsigned long int", "unsigned long long int"], 4257 ["b", "s", "", 4258 "l", "ll"]>; 4259 4260def Addc : Builtin, MPATemplate { 4261 let Spellings = ["__builtin_addc"]; 4262 let Attributes = [NoThrow, Constexpr]; 4263 // FIXME: Why are these argumentes marked const? 4264 let Prototype = "T(T const, T const, T const, T*)"; 4265} 4266 4267def Subc : Builtin, MPATemplate { 4268 let Spellings = ["__builtin_subc"]; 4269 let Attributes = [NoThrow, Constexpr]; 4270 // FIXME: Why are these argumentes marked const? 4271 let Prototype = "T(T const, T const, T const, T*)"; 4272} 4273 4274// Checked Arithmetic Builtins for Security. 4275def AddOverflow : Builtin { 4276 let Spellings = ["__builtin_add_overflow"]; 4277 let Attributes = [NoThrow, CustomTypeChecking, Constexpr]; 4278 let Prototype = "bool(...)"; 4279} 4280 4281def SubOverflow : Builtin { 4282 let Spellings = ["__builtin_sub_overflow"]; 4283 let Attributes = [NoThrow, CustomTypeChecking, Constexpr]; 4284 let Prototype = "bool(...)"; 4285} 4286 4287def MulOverflow : Builtin { 4288 let Spellings = ["__builtin_mul_overflow"]; 4289 let Attributes = [NoThrow, CustomTypeChecking, Constexpr]; 4290 let Prototype = "bool(...)"; 4291} 4292 4293class UOverflowTemplate : 4294 Template<["unsigned int", "unsigned long int", "unsigned long long int"], 4295 ["_overflow", "l_overflow", "ll_overflow"]>; 4296 4297def UaddOverflow : Builtin, UOverflowTemplate { 4298 let Spellings = ["__builtin_uadd"]; 4299 let Attributes = [NoThrow, Constexpr]; 4300 let Prototype = "bool(T const, T const, T*)"; 4301} 4302 4303def UsubOverflow : Builtin, UOverflowTemplate { 4304 let Spellings = ["__builtin_usub"]; 4305 let Attributes = [NoThrow, Constexpr]; 4306 let Prototype = "bool(T const, T const, T*)"; 4307} 4308 4309def UmulOverflow : Builtin, UOverflowTemplate { 4310 let Spellings = ["__builtin_umul"]; 4311 let Attributes = [NoThrow, Constexpr]; 4312 let Prototype = "bool(T const, T const, T*)"; 4313} 4314 4315class SOverflowTemplate : 4316 Template<["int", "long int", "long long int"], 4317 ["_overflow", "l_overflow", "ll_overflow"]>; 4318 4319def SaddOverflow : Builtin, SOverflowTemplate { 4320 let Spellings = ["__builtin_sadd"]; 4321 let Attributes = [NoThrow, Constexpr]; 4322 let Prototype = "bool(T const, T const, T*)"; 4323} 4324 4325def SsubOverflow : Builtin, SOverflowTemplate { 4326 let Spellings = ["__builtin_ssub"]; 4327 let Attributes = [NoThrow, Constexpr]; 4328 let Prototype = "bool(T const, T const, T*)"; 4329} 4330 4331def SmulOverflow : Builtin, SOverflowTemplate { 4332 let Spellings = ["__builtin_smul"]; 4333 let Attributes = [NoThrow, Constexpr]; 4334 let Prototype = "bool(T const, T const, T*)"; 4335} 4336 4337// Clang builtins (not available in GCC). 4338def BuiltinAddressof : Builtin { 4339 let Spellings = ["__builtin_addressof"]; 4340 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 4341 let Prototype = "void*(void&)"; 4342} 4343 4344def BuiltinFunctionStart : Builtin { 4345 let Spellings = ["__builtin_function_start"]; 4346 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 4347 let Prototype = "void*(void&)"; 4348} 4349 4350def BuiltinOperatorNew : Builtin { 4351 let Spellings = ["__builtin_operator_new"]; 4352 let Attributes = [Const, CustomTypeChecking, Constexpr]; 4353 let Prototype = "void*(size_t)"; 4354} 4355 4356def BuiltinOperatorDelete : Builtin { 4357 let Spellings = ["__builtin_operator_delete"]; 4358 let Attributes = [NoThrow, CustomTypeChecking, Constexpr]; 4359 let Prototype = "void(void*)"; 4360} 4361 4362def BuiltinCharMemchr : Builtin { 4363 let Spellings = ["__builtin_char_memchr"]; 4364 let Attributes = [NoThrow, Constexpr]; 4365 let Prototype = "char*(char const*, int, size_t)"; 4366} 4367 4368def BuiltinDumpStruct : Builtin { 4369 let Spellings = ["__builtin_dump_struct"]; 4370 let Attributes = [CustomTypeChecking]; 4371 let Prototype = "void(...)"; 4372} 4373 4374def BuiltinPreserveAccessIndex : Builtin { 4375 let Spellings = ["__builtin_preserve_access_index"]; 4376 let Attributes = [CustomTypeChecking]; 4377 let Prototype = "void(...)"; 4378} 4379 4380def IsAligned : Builtin { 4381 let Spellings = ["__builtin_is_aligned"]; 4382 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 4383 let Prototype = "bool(void const*, size_t)"; 4384} 4385 4386def AlignUp : Builtin { 4387 let Spellings = ["__builtin_align_up"]; 4388 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 4389 let Prototype = "void*(void const*, size_t)"; 4390} 4391 4392def AlignDown : Builtin { 4393 let Spellings = ["__builtin_align_down"]; 4394 let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; 4395 let Prototype = "void*(void const*, size_t)"; 4396} 4397 4398// Safestack builtins. 4399def GetUnsafeStackStart : Builtin { 4400 let Spellings = ["__builtin___get_unsafe_stack_start"]; 4401 let Attributes = [NoThrow, FunctionWithBuiltinPrefix]; 4402 let Prototype = "void*()"; 4403} 4404 4405def GetUnsafeStackBottom : Builtin { 4406 let Spellings = ["__builtin___get_unsafe_stack_bottom"]; 4407 let Attributes = [NoThrow, FunctionWithBuiltinPrefix]; 4408 let Prototype = "void*()"; 4409} 4410 4411def GetUnsafeStackTop : Builtin { 4412 let Spellings = ["__builtin___get_unsafe_stack_top"]; 4413 let Attributes = [NoThrow, FunctionWithBuiltinPrefix]; 4414 let Prototype = "void*()"; 4415} 4416 4417def GetUnsafeStackPtr : Builtin { 4418 let Spellings = ["__builtin___get_unsafe_stack_ptr"]; 4419 let Attributes = [NoThrow, FunctionWithBuiltinPrefix]; 4420 let Prototype = "void*()"; 4421} 4422 4423// Nontemporal loads/stores builtins. 4424def NontemporalStore : Builtin { 4425 let Spellings = ["__builtin_nontemporal_store"]; 4426 let Attributes = [CustomTypeChecking]; 4427 let Prototype = "void(...)"; 4428} 4429 4430def NontemporalLoad : Builtin { 4431 let Spellings = ["__builtin_nontemporal_load"]; 4432 let Attributes = [CustomTypeChecking]; 4433 let Prototype = "void(...)"; 4434} 4435 4436// Coroutine intrinsics 4437def CoroResume : CoroLangBuiltin { 4438 let Spellings = ["__builtin_coro_resume"]; 4439 let Prototype = "void(void*)"; 4440} 4441 4442def CoroDestroy : CoroLangBuiltin { 4443 let Spellings = ["__builtin_coro_destroy"]; 4444 let Prototype = "void(void*)"; 4445} 4446 4447def CoroDone : CoroLangBuiltin { 4448 let Spellings = ["__builtin_coro_done"]; 4449 let Attributes = [NoThrow]; 4450 let Prototype = "bool(void*)"; 4451} 4452 4453def CoroPromise : CoroLangBuiltin { 4454 let Spellings = ["__builtin_coro_promise"]; 4455 let Attributes = [NoThrow]; 4456 let Prototype = "void*(void*, _Constant int, _Constant bool)"; 4457} 4458 4459def CoroSize : CoroLangBuiltin { 4460 let Spellings = ["__builtin_coro_size"]; 4461 let Attributes = [NoThrow]; 4462 let Prototype = "size_t()"; 4463} 4464 4465def CoroAlign : CoroLangBuiltin { 4466 let Spellings = ["__builtin_coro_align"]; 4467 let Attributes = [NoThrow]; 4468 let Prototype = "size_t()"; 4469} 4470 4471def CoroFrame : CoroLangBuiltin { 4472 let Spellings = ["__builtin_coro_frame"]; 4473 let Attributes = [NoThrow]; 4474 let Prototype = "void*()"; 4475} 4476 4477def CoroNoop : CoroLangBuiltin { 4478 let Spellings = ["__builtin_coro_noop"]; 4479 let Attributes = [NoThrow]; 4480 let Prototype = "void*()"; 4481} 4482 4483def CoroFree : CoroLangBuiltin { 4484 let Spellings = ["__builtin_coro_free"]; 4485 let Attributes = [NoThrow]; 4486 let Prototype = "void*(void*)"; 4487} 4488 4489def CoroId : CoroLangBuiltin { 4490 let Spellings = ["__builtin_coro_id"]; 4491 let Attributes = [NoThrow]; 4492 let Prototype = "void*(_Constant int, void*, void*, void*)"; 4493} 4494 4495def CoroAlloc : CoroLangBuiltin { 4496 let Spellings = ["__builtin_coro_alloc"]; 4497 let Attributes = [NoThrow]; 4498 let Prototype = "bool()"; 4499} 4500 4501def CoroBegin : CoroLangBuiltin { 4502 let Spellings = ["__builtin_coro_begin"]; 4503 let Attributes = [NoThrow]; 4504 let Prototype = "void*(void*)"; 4505} 4506 4507def CoroEnd : CoroLangBuiltin { 4508 let Spellings = ["__builtin_coro_end"]; 4509 let Attributes = [NoThrow]; 4510 let Prototype = "bool(void*, _Constant bool)"; 4511} 4512 4513def CoroSuspend : CoroLangBuiltin { 4514 let Spellings = ["__builtin_coro_suspend"]; 4515 let Attributes = [NoThrow]; 4516 let Prototype = "char(_Constant bool)"; 4517} 4518 4519// Pointer authentication builtins. 4520def PtrauthStrip : Builtin { 4521 let Spellings = ["__builtin_ptrauth_strip"]; 4522 let Attributes = [CustomTypeChecking, NoThrow, Const]; 4523 let Prototype = "void*(void*,int)"; 4524} 4525 4526def PtrauthBlendDiscriminator : Builtin { 4527 let Spellings = ["__builtin_ptrauth_blend_discriminator"]; 4528 let Attributes = [CustomTypeChecking, NoThrow, Const]; 4529 let Prototype = "size_t(void*,int)"; 4530} 4531 4532def PtrauthSignUnauthenticated : Builtin { 4533 let Spellings = ["__builtin_ptrauth_sign_unauthenticated"]; 4534 let Attributes = [CustomTypeChecking, NoThrow, Const]; 4535 let Prototype = "void*(void*,int,void*)"; 4536} 4537 4538def PtrauthSignConstant : Builtin { 4539 let Spellings = ["__builtin_ptrauth_sign_constant"]; 4540 let Attributes = [CustomTypeChecking, NoThrow, Const, Constexpr]; 4541 let Prototype = "void*(void*,int,void*)"; 4542} 4543 4544def PtrauthSignGenericData : Builtin { 4545 let Spellings = ["__builtin_ptrauth_sign_generic_data"]; 4546 let Attributes = [CustomTypeChecking, NoThrow, Const]; 4547 let Prototype = "size_t(void*,void*)"; 4548} 4549 4550def PtrauthAuthAndResign : Builtin { 4551 let Spellings = ["__builtin_ptrauth_auth_and_resign"]; 4552 let Attributes = [CustomTypeChecking, NoThrow]; 4553 let Prototype = "void*(void*,int,void*,int,void*)"; 4554} 4555 4556def PtrauthAuth : Builtin { 4557 let Spellings = ["__builtin_ptrauth_auth"]; 4558 let Attributes = [CustomTypeChecking, NoThrow]; 4559 let Prototype = "void*(void*,int,void*)"; 4560} 4561 4562def PtrauthStringDiscriminator : Builtin { 4563 let Spellings = ["__builtin_ptrauth_string_discriminator"]; 4564 let Attributes = [NoThrow, Const, Constexpr]; 4565 let Prototype = "size_t(char const*)"; 4566} 4567 4568// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions. 4569// We need the generic prototype, since the packet type could be anything. 4570def ReadPipe : OCLPipeLangBuiltin { 4571 let Spellings = ["read_pipe"]; 4572 let Attributes = [CustomTypeChecking, NoThrow]; 4573 let Prototype = "int(...)"; 4574} 4575 4576def WritePipe : OCLPipeLangBuiltin { 4577 let Spellings = ["write_pipe"]; 4578 let Attributes = [CustomTypeChecking, NoThrow]; 4579 let Prototype = "int(...)"; 4580} 4581 4582def ReserveReadPipe : OCLPipeLangBuiltin { 4583 let Spellings = ["reserve_read_pipe"]; 4584 let Attributes = [CustomTypeChecking, NoThrow]; 4585 let Prototype = "int(...)"; 4586} 4587 4588def ReserveWritePipe : OCLPipeLangBuiltin { 4589 let Spellings = ["reserve_write_pipe"]; 4590 let Attributes = [CustomTypeChecking, NoThrow]; 4591 let Prototype = "int(...)"; 4592} 4593 4594def CommitWritePipe : OCLPipeLangBuiltin { 4595 let Spellings = ["commit_write_pipe"]; 4596 let Attributes = [CustomTypeChecking, NoThrow]; 4597 let Prototype = "void(...)"; 4598} 4599 4600def CommitReadPipe : OCLPipeLangBuiltin { 4601 let Spellings = ["commit_read_pipe"]; 4602 let Attributes = [CustomTypeChecking, NoThrow]; 4603 let Prototype = "void(...)"; 4604} 4605 4606def SubGroupReserveReadPipe : OCLPipeLangBuiltin { 4607 let Spellings = ["sub_group_reserve_read_pipe"]; 4608 let Attributes = [CustomTypeChecking, NoThrow]; 4609 let Prototype = "int(...)"; 4610} 4611 4612def SubGroupReserveWritePipe : OCLPipeLangBuiltin { 4613 let Spellings = ["sub_group_reserve_write_pipe"]; 4614 let Attributes = [CustomTypeChecking, NoThrow]; 4615 let Prototype = "int(...)"; 4616} 4617 4618def SubGroupCommitWritePipe : OCLPipeLangBuiltin { 4619 let Spellings = ["sub_group_commit_write_pipe"]; 4620 let Attributes = [CustomTypeChecking, NoThrow]; 4621 let Prototype = "void(...)"; 4622} 4623 4624def SubGroupCommitReadPipe : OCLPipeLangBuiltin { 4625 let Spellings = ["sub_group_commit_read_pipe"]; 4626 let Attributes = [CustomTypeChecking, NoThrow]; 4627 let Prototype = "void(...)"; 4628} 4629 4630def WorkGroupReserveReadPipe : OCLPipeLangBuiltin { 4631 let Spellings = ["work_group_reserve_read_pipe"]; 4632 let Attributes = [CustomTypeChecking, NoThrow]; 4633 let Prototype = "int(...)"; 4634} 4635 4636def WorkGroupReserveWritePipe : OCLPipeLangBuiltin { 4637 let Spellings = ["work_group_reserve_write_pipe"]; 4638 let Attributes = [CustomTypeChecking, NoThrow]; 4639 let Prototype = "int(...)"; 4640} 4641 4642def WorkGroupCommitWritePipe : OCLPipeLangBuiltin { 4643 let Spellings = ["work_group_commit_write_pipe"]; 4644 let Attributes = [CustomTypeChecking, NoThrow]; 4645 let Prototype = "void(...)"; 4646} 4647 4648def WorkGroupCommitReadPipe : OCLPipeLangBuiltin { 4649 let Spellings = ["work_group_commit_read_pipe"]; 4650 let Attributes = [CustomTypeChecking, NoThrow]; 4651 let Prototype = "void(...)"; 4652} 4653 4654def GetPipeNumPackets : OCLPipeLangBuiltin { 4655 let Spellings = ["get_pipe_num_packets"]; 4656 let Attributes = [CustomTypeChecking, NoThrow]; 4657 let Prototype = "unsigned int(...)"; 4658} 4659 4660def GetPipeMaxPackets : OCLPipeLangBuiltin { 4661 let Spellings = ["get_pipe_max_packets"]; 4662 let Attributes = [CustomTypeChecking, NoThrow]; 4663 let Prototype = "unsigned int(...)"; 4664} 4665 4666// OpenCL v2.0 s6.13.17 - Enqueue kernel functions. 4667// Custom builtin check allows to perform special check of passed block arguments. 4668def EnqueueKernel : OCL_DSELangBuiltin { 4669 let Spellings = ["enqueue_kernel"]; 4670 let Attributes = [CustomTypeChecking, NoThrow]; 4671 let Prototype = "int(...)"; 4672} 4673 4674def GetKernelWorkGroupSize : OCL_DSELangBuiltin { 4675 let Spellings = ["get_kernel_work_group_size"]; 4676 let Attributes = [CustomTypeChecking, NoThrow]; 4677 let Prototype = "unsigned int(...)"; 4678} 4679 4680def GetKernelPreferredWorkGroupSizeMultiple : OCL_DSELangBuiltin { 4681 let Spellings = ["get_kernel_preferred_work_group_size_multiple"]; 4682 let Attributes = [CustomTypeChecking, NoThrow]; 4683 let Prototype = "unsigned int(...)"; 4684} 4685 4686def GetKernelMaxSubGroupSizeForNDRange : OCL_DSELangBuiltin { 4687 let Spellings = ["get_kernel_max_sub_group_size_for_ndrange"]; 4688 let Attributes = [CustomTypeChecking, NoThrow]; 4689 let Prototype = "unsigned int(...)"; 4690} 4691 4692def GetKernelSubGroupCountForNDRange : OCL_DSELangBuiltin { 4693 let Spellings = ["get_kernel_sub_group_count_for_ndrange"]; 4694 let Attributes = [CustomTypeChecking, NoThrow]; 4695 let Prototype = "unsigned int(...)"; 4696} 4697 4698// OpenCL v2.0 s6.13.9 - Address space qualifier functions. 4699// FIXME: Pointer parameters of OpenCL builtins should have their address space 4700// requirement defined. 4701def ToGlobal : OCL_GASLangBuiltin { 4702 let Spellings = ["to_global"]; 4703 let Attributes = [CustomTypeChecking, NoThrow]; 4704 let Prototype = "void*(void*)"; 4705} 4706 4707def ToLocal : OCL_GASLangBuiltin { 4708 let Spellings = ["to_local"]; 4709 let Attributes = [CustomTypeChecking, NoThrow]; 4710 let Prototype = "void*(void*)"; 4711} 4712 4713def ToPrivate : OCL_GASLangBuiltin { 4714 let Spellings = ["to_private"]; 4715 let Attributes = [CustomTypeChecking, NoThrow]; 4716 let Prototype = "void*(void*)"; 4717} 4718 4719// OpenCL half load/store builtin. 4720def StoreHalf : OCLLangBuiltin, FloatDoubleTemplate { 4721 let Spellings = ["__builtin_store_half"]; 4722 let Attributes = [NoThrow]; 4723 let Prototype = "void(T, __fp16*)"; 4724} 4725 4726def LoadHalf : OCLLangBuiltin, FloatDoubleTemplate { 4727 let Spellings = ["__builtin_load_half"]; 4728 // FIXME: Is this actually Const? This looks like it shoud be Pure. 4729 let Attributes = [NoThrow, Const]; 4730 let Prototype = "T(__fp16 const*)"; 4731} 4732 4733// Builtins for os_log/os_trace. 4734def OSLogFormatBufferSize : Builtin { 4735 let Spellings = ["__builtin_os_log_format_buffer_size"]; 4736 let Attributes = [PrintfFormat<0>, NoThrow, UnevaluatedArguments, 4737 CustomTypeChecking, Constexpr]; 4738 let Prototype = "size_t(char const*, ...)"; 4739} 4740 4741def OSLogFormat : Builtin { 4742 let Spellings = ["__builtin_os_log_format"]; 4743 // FIXME: The printf attribute looks suspiciously like it should be argument #1. 4744 let Attributes = [PrintfFormat<0>, NoThrow, CustomTypeChecking]; 4745 let Prototype = "void*(void*, char const*, ...)"; 4746} 4747 4748// CUDA/HIP 4749def GetDeviceSideMangledName : LangBuiltin<"CUDA_LANG"> { 4750 let Spellings = ["__builtin_get_device_side_mangled_name"]; 4751 let Attributes = [NoThrow, Const, IgnoreSignature]; 4752 let Prototype = "char const*(...)"; 4753} 4754 4755// HLSL 4756def HLSLResourceGetPointer : LangBuiltin<"HLSL_LANG"> { 4757 let Spellings = ["__builtin_hlsl_resource_getpointer"]; 4758 let Attributes = [NoThrow]; 4759 let Prototype = "void(...)"; 4760} 4761 4762def HLSLAll : LangBuiltin<"HLSL_LANG"> { 4763 let Spellings = ["__builtin_hlsl_all"]; 4764 let Attributes = [NoThrow, Const]; 4765 let Prototype = "bool(...)"; 4766} 4767 4768def HLSLAny : LangBuiltin<"HLSL_LANG"> { 4769 let Spellings = ["__builtin_hlsl_any"]; 4770 let Attributes = [NoThrow, Const]; 4771 let Prototype = "bool(...)"; 4772} 4773 4774def HLSLAsDouble : LangBuiltin<"HLSL_LANG"> { 4775 let Spellings = ["__builtin_hlsl_asdouble"]; 4776 let Attributes = [NoThrow, Const]; 4777 let Prototype = "void(...)"; 4778} 4779 4780def HLSLWaveActiveAllTrue : LangBuiltin<"HLSL_LANG"> { 4781 let Spellings = ["__builtin_hlsl_wave_active_all_true"]; 4782 let Attributes = [NoThrow, Const]; 4783 let Prototype = "bool(bool)"; 4784} 4785 4786def HLSLWaveActiveAnyTrue : LangBuiltin<"HLSL_LANG"> { 4787 let Spellings = ["__builtin_hlsl_wave_active_any_true"]; 4788 let Attributes = [NoThrow, Const]; 4789 let Prototype = "bool(bool)"; 4790} 4791 4792def HLSLWaveActiveCountBits : LangBuiltin<"HLSL_LANG"> { 4793 let Spellings = ["__builtin_hlsl_wave_active_count_bits"]; 4794 let Attributes = [NoThrow, Const]; 4795 let Prototype = "unsigned int(bool)"; 4796} 4797 4798def HLSLWaveActiveMax : LangBuiltin<"HLSL_LANG"> { 4799 let Spellings = ["__builtin_hlsl_wave_active_max"]; 4800 let Attributes = [NoThrow, Const]; 4801 let Prototype = "void (...)"; 4802} 4803 4804def HLSLWaveActiveSum : LangBuiltin<"HLSL_LANG"> { 4805 let Spellings = ["__builtin_hlsl_wave_active_sum"]; 4806 let Attributes = [NoThrow, Const]; 4807 let Prototype = "void (...)"; 4808} 4809 4810def HLSLWaveGetLaneIndex : LangBuiltin<"HLSL_LANG"> { 4811 let Spellings = ["__builtin_hlsl_wave_get_lane_index"]; 4812 let Attributes = [NoThrow, Const]; 4813 let Prototype = "unsigned int()"; 4814} 4815 4816def HLSLWaveIsFirstLane : LangBuiltin<"HLSL_LANG"> { 4817 let Spellings = ["__builtin_hlsl_wave_is_first_lane"]; 4818 let Attributes = [NoThrow, Const]; 4819 let Prototype = "bool()"; 4820} 4821 4822def HLSLWaveReadLaneAt : LangBuiltin<"HLSL_LANG"> { 4823 let Spellings = ["__builtin_hlsl_wave_read_lane_at"]; 4824 let Attributes = [NoThrow, Const]; 4825 let Prototype = "void(...)"; 4826} 4827 4828def HLSLClamp : LangBuiltin<"HLSL_LANG"> { 4829 let Spellings = ["__builtin_hlsl_elementwise_clamp"]; 4830 let Attributes = [NoThrow, Const]; 4831 let Prototype = "void(...)"; 4832} 4833 4834def HLSLCross: LangBuiltin<"HLSL_LANG"> { 4835 let Spellings = ["__builtin_hlsl_cross"]; 4836 let Attributes = [NoThrow, Const]; 4837 let Prototype = "void(...)"; 4838} 4839 4840def HLSLDegrees : LangBuiltin<"HLSL_LANG"> { 4841 let Spellings = ["__builtin_hlsl_elementwise_degrees"]; 4842 let Attributes = [NoThrow, Const]; 4843 let Prototype = "void(...)"; 4844} 4845 4846def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> { 4847 let Spellings = ["__builtin_hlsl_dot"]; 4848 let Attributes = [NoThrow, Const]; 4849 let Prototype = "void(...)"; 4850} 4851 4852def HLSLDot4AddI8Packed : LangBuiltin<"HLSL_LANG"> { 4853 let Spellings = ["__builtin_hlsl_dot4add_i8packed"]; 4854 let Attributes = [NoThrow, Const]; 4855 let Prototype = "int(unsigned int, unsigned int, int)"; 4856} 4857 4858def HLSLDot4AddU8Packed : LangBuiltin<"HLSL_LANG"> { 4859 let Spellings = ["__builtin_hlsl_dot4add_u8packed"]; 4860 let Attributes = [NoThrow, Const]; 4861 let Prototype = "unsigned int(unsigned int, unsigned int, unsigned int)"; 4862} 4863 4864def HLSLFirstBitHigh : LangBuiltin<"HLSL_LANG"> { 4865 let Spellings = ["__builtin_hlsl_elementwise_firstbithigh"]; 4866 let Attributes = [NoThrow, Const]; 4867 let Prototype = "void(...)"; 4868} 4869 4870def HLSLFirstBitLow : LangBuiltin<"HLSL_LANG"> { 4871 let Spellings = ["__builtin_hlsl_elementwise_firstbitlow"]; 4872 let Attributes = [NoThrow, Const]; 4873 let Prototype = "void(...)"; 4874} 4875 4876def HLSLFrac : LangBuiltin<"HLSL_LANG"> { 4877 let Spellings = ["__builtin_hlsl_elementwise_frac"]; 4878 let Attributes = [NoThrow, Const]; 4879 let Prototype = "void(...)"; 4880} 4881 4882def HLSLIsinf : LangBuiltin<"HLSL_LANG"> { 4883 let Spellings = ["__builtin_hlsl_elementwise_isinf"]; 4884 let Attributes = [NoThrow, Const]; 4885 let Prototype = "void(...)"; 4886} 4887 4888def HLSLLerp : LangBuiltin<"HLSL_LANG"> { 4889 let Spellings = ["__builtin_hlsl_lerp"]; 4890 let Attributes = [NoThrow, Const]; 4891 let Prototype = "void(...)"; 4892} 4893 4894def HLSLMad : LangBuiltin<"HLSL_LANG"> { 4895 let Spellings = ["__builtin_hlsl_mad"]; 4896 let Attributes = [NoThrow, Const]; 4897 let Prototype = "void(...)"; 4898} 4899 4900def HLSLNormalize : LangBuiltin<"HLSL_LANG"> { 4901 let Spellings = ["__builtin_hlsl_normalize"]; 4902 let Attributes = [NoThrow, Const]; 4903 let Prototype = "void(...)"; 4904} 4905 4906def HLSLRcp : LangBuiltin<"HLSL_LANG"> { 4907 let Spellings = ["__builtin_hlsl_elementwise_rcp"]; 4908 let Attributes = [NoThrow, Const]; 4909 let Prototype = "void(...)"; 4910} 4911 4912def HLSLRSqrt : LangBuiltin<"HLSL_LANG"> { 4913 let Spellings = ["__builtin_hlsl_elementwise_rsqrt"]; 4914 let Attributes = [NoThrow, Const]; 4915 let Prototype = "void(...)"; 4916} 4917 4918def HLSLSaturate : LangBuiltin<"HLSL_LANG"> { 4919 let Spellings = ["__builtin_hlsl_elementwise_saturate"]; 4920 let Attributes = [NoThrow, Const]; 4921 let Prototype = "void(...)"; 4922} 4923 4924def HLSLSelect : LangBuiltin<"HLSL_LANG"> { 4925 let Spellings = ["__builtin_hlsl_select"]; 4926 let Attributes = [NoThrow, Const]; 4927 let Prototype = "void(...)"; 4928} 4929 4930def HLSLSign : LangBuiltin<"HLSL_LANG"> { 4931 let Spellings = ["__builtin_hlsl_elementwise_sign"]; 4932 let Attributes = [NoThrow, Const]; 4933 let Prototype = "void(...)"; 4934} 4935 4936def HLSLStep: LangBuiltin<"HLSL_LANG"> { 4937 let Spellings = ["__builtin_hlsl_step"]; 4938 let Attributes = [NoThrow, Const]; 4939 let Prototype = "void(...)"; 4940} 4941 4942def HLSLRadians : LangBuiltin<"HLSL_LANG"> { 4943 let Spellings = ["__builtin_hlsl_elementwise_radians"]; 4944 let Attributes = [NoThrow, Const]; 4945 let Prototype = "void(...)"; 4946} 4947 4948def HLSLBufferUpdateCounter : LangBuiltin<"HLSL_LANG"> { 4949 let Spellings = ["__builtin_hlsl_buffer_update_counter"]; 4950 let Attributes = [NoThrow]; 4951 let Prototype = "uint32_t(...)"; 4952} 4953 4954def HLSLSplitDouble: LangBuiltin<"HLSL_LANG"> { 4955 let Spellings = ["__builtin_hlsl_elementwise_splitdouble"]; 4956 let Attributes = [NoThrow, Const]; 4957 let Prototype = "void(...)"; 4958} 4959 4960def HLSLClip: LangBuiltin<"HLSL_LANG"> { 4961 let Spellings = ["__builtin_hlsl_elementwise_clip"]; 4962 let Attributes = [NoThrow, Const]; 4963 let Prototype = "void(...)"; 4964} 4965 4966def HLSLGroupMemoryBarrierWithGroupSync: LangBuiltin<"HLSL_LANG"> { 4967 let Spellings = ["__builtin_hlsl_group_memory_barrier_with_group_sync"]; 4968 let Attributes = [NoThrow, Const]; 4969 let Prototype = "void()"; 4970} 4971 4972// Builtins for XRay. 4973def XRayCustomEvent : Builtin { 4974 let Spellings = ["__xray_customevent"]; 4975 let Prototype = "void(char const*, size_t)"; 4976} 4977 4978def XRayTypedEvent : Builtin { 4979 let Spellings = ["__xray_typedevent"]; 4980 let Prototype = "void(size_t, char const*, size_t)"; 4981} 4982 4983// Win64-compatible va_list functions. 4984def MSVaStart : Builtin { 4985 let Spellings = ["__builtin_ms_va_start"]; 4986 let Attributes = [NoThrow, CustomTypeChecking]; 4987 let Prototype = "void(char*&, ...)"; 4988} 4989 4990def MSVaEnd : Builtin { 4991 let Spellings = ["__builtin_ms_va_end"]; 4992 let Attributes = [NoThrow]; 4993 let Prototype = "void(char*&)"; 4994} 4995 4996def MSVaCopy : Builtin { 4997 let Spellings = ["__builtin_ms_va_copy"]; 4998 let Attributes = [NoThrow]; 4999 let Prototype = "void(char*&, char*&)"; 5000} 5001 5002// Arithmetic Fence: to prevent FP reordering and reassociation optimizations 5003// FIXME: Should this just be a Builtin? 5004def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> { 5005 let Spellings = ["__arithmetic_fence"]; 5006 let Attributes = [CustomTypeChecking, Constexpr]; 5007 let Prototype = "void(...)"; 5008} 5009 5010def CountedByRef : Builtin { 5011 let Spellings = ["__builtin_counted_by_ref"]; 5012 let Attributes = [NoThrow, CustomTypeChecking]; 5013 let Prototype = "int(...)"; 5014} 5015