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