1//===--- Builtins.def - Builtin 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 9// This is only documentation for the database layout. This will be removed once 10// all builtin databases are converted to tablegen files 11 12// The second value provided to the macro specifies the type of the function 13// (result value, then each argument) as follows: 14// v -> void 15// b -> boolean 16// c -> char 17// s -> short 18// i -> int 19// h -> half (__fp16, OpenCL) 20// x -> half (_Float16) 21// y -> half (__bf16) 22// f -> float 23// d -> double 24// z -> size_t 25// w -> wchar_t 26// F -> constant CFString 27// G -> id 28// H -> SEL 29// M -> struct objc_super 30// a -> __builtin_va_list 31// A -> "reference" to __builtin_va_list 32// V -> Vector, followed by the number of elements and the base type. 33// q -> Scalable vector, followed by the number of elements and the base type. 34// Q -> target builtin type, followed by a character to distinguish the builtin type 35// Qa -> AArch64 svcount_t builtin type. 36// Qb -> AMDGPU __amdgpu_buffer_rsrc_t builtin type. 37// E -> ext_vector, followed by the number of elements and the base type. 38// X -> _Complex, followed by the base type. 39// Y -> ptrdiff_t 40// P -> FILE 41// J -> jmp_buf 42// SJ -> sigjmp_buf 43// K -> ucontext_t 44// p -> pid_t 45// . -> "...". This may only occur at the end of the function list. 46// 47// Types may be prefixed with the following modifiers: 48// L -> long (e.g. Li for 'long int', Ld for 'long double') 49// LL -> long long (e.g. LLi for 'long long int', LLd for __float128) 50// LLL -> __int128_t (e.g. LLLi) 51// Z -> int32_t (require a native 32-bit integer type on the target) 52// W -> int64_t (require a native 64-bit integer type on the target) 53// N -> 'int' size if target is LP64, 'L' otherwise. 54// O -> long for OpenCL targets, long long otherwise. 55// S -> signed 56// U -> unsigned 57// I -> Required to constant fold to an integer constant expression. 58// 59// Types may be postfixed with the following modifiers: 60// * -> pointer (optionally followed by an address space number, if no address 61// space is specified than any address space will be accepted) 62// & -> reference (optionally followed by an address space number) 63// C -> const 64// D -> volatile 65// R -> restrict 66 67// The third value provided to the macro specifies information about attributes 68// of the function. These must be kept in sync with the predicates in the 69// Builtin::Context class. Currently we have: 70// n -> nothrow 71// r -> noreturn 72// U -> pure 73// c -> const 74// t -> signature is meaningless, use custom typechecking 75// T -> type is not important to semantic analysis and codegen; recognize as 76// builtin even if type doesn't match signature, and don't warn if we 77// can't be sure the type is right 78// F -> this is a libc/libm function with a '__builtin_' prefix added. 79// f -> this is a libc/libm function without a '__builtin_' prefix, or with 80// 'z', a C++ standard library function in namespace std::. This builtin 81// is disableable by '-fno-builtin-foo' / '-fno-builtin-std-foo'. 82// h -> this function requires a specific header or an explicit declaration. 83// i -> this is a runtime library implemented function without the 84// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc. 85// p:N: -> this is a printf-like function whose Nth argument is the format 86// string. 87// P:N: -> similar to the p:N: attribute, but the function is like vprintf 88// in that it accepts its arguments as a va_list rather than 89// through an ellipsis 90// s:N: -> this is a scanf-like function whose Nth argument is the format 91// string. 92// S:N: -> similar to the s:N: attribute, but the function is like vscanf 93// in that it accepts its arguments as a va_list rather than 94// through an ellipsis 95// e -> const, but only when -fno-math-errno and FP exceptions are ignored 96// g -> const when FP exceptions are ignored 97// j -> returns_twice (like setjmp) 98// u -> arguments are not evaluated for their side-effects 99// V:N: -> requires vectors of at least N bits to be legal 100// C<N,M_0,...,M_k> -> callback behavior: argument N is called with argument 101// M_0, ..., M_k as payload 102// z -> this is a function in (possibly-versioned) namespace std 103// E -> this function can be constant evaluated by Clang frontend 104// G -> this is a C++20 consteval function 105