2007-01-28 16:20:04 +08:00
|
|
|
//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:03:32 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-01-28 16:20:04 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the standard builtin function database. Users of this file
|
|
|
|
// must define the BUILTIN macro to make use of this information.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// FIXME: This should really be a .td file, but that requires modifying tblgen.
|
|
|
|
// Perhaps tblgen should have plugins.
|
|
|
|
|
|
|
|
// The first value provided to the macro specifies the function name of the
|
|
|
|
// builtin, and results in a clang::builtin::BIXX enum value for XX.
|
|
|
|
|
|
|
|
// The second value provided to the macro specifies the type of the function
|
|
|
|
// (result value, then each argument) as follows:
|
|
|
|
// v -> void
|
2008-10-18 10:49:28 +08:00
|
|
|
// b -> boolean
|
2007-01-28 16:20:04 +08:00
|
|
|
// c -> char
|
|
|
|
// s -> short
|
|
|
|
// i -> int
|
2013-08-15 23:16:57 +08:00
|
|
|
// h -> half
|
2007-01-28 16:20:04 +08:00
|
|
|
// f -> float
|
|
|
|
// d -> double
|
2007-10-29 12:18:06 +08:00
|
|
|
// z -> size_t
|
2007-08-17 13:31:46 +08:00
|
|
|
// F -> constant CFString
|
2010-11-10 05:38:20 +08:00
|
|
|
// G -> id
|
|
|
|
// H -> SEL
|
2013-01-05 02:45:40 +08:00
|
|
|
// M -> struct objc_super
|
2007-11-27 15:22:09 +08:00
|
|
|
// a -> __builtin_va_list
|
2009-01-20 15:46:22 +08:00
|
|
|
// A -> "reference" to __builtin_va_list
|
2012-06-08 02:08:25 +08:00
|
|
|
// V -> Vector, followed by the number of elements and the base type.
|
|
|
|
// E -> ext_vector, followed by the number of elements and the base type.
|
2009-09-29 05:45:01 +08:00
|
|
|
// X -> _Complex, followed by the base type.
|
2011-08-24 07:33:09 +08:00
|
|
|
// Y -> ptrdiff_t
|
2009-02-14 09:52:53 +08:00
|
|
|
// P -> FILE
|
2009-07-28 10:25:19 +08:00
|
|
|
// J -> jmp_buf
|
|
|
|
// SJ -> sigjmp_buf
|
2011-11-14 05:51:09 +08:00
|
|
|
// K -> ucontext_t
|
2012-11-27 10:58:24 +08:00
|
|
|
// p -> pid_t
|
2007-01-28 16:20:04 +08:00
|
|
|
// . -> "...". This may only occur at the end of the function list.
|
|
|
|
//
|
2010-10-01 15:13:18 +08:00
|
|
|
// Types may be prefixed with the following modifiers:
|
2009-05-08 14:58:22 +08:00
|
|
|
// L -> long (e.g. Li for 'long int')
|
|
|
|
// LL -> long long
|
|
|
|
// LLL -> __int128_t (e.g. LLLi)
|
2014-02-24 10:45:03 +08:00
|
|
|
// W -> int64_t
|
2009-05-08 14:58:22 +08:00
|
|
|
// S -> signed
|
|
|
|
// U -> unsigned
|
2010-10-01 15:13:18 +08:00
|
|
|
// I -> Required to constant fold to an integer constant expression.
|
2007-08-17 13:31:46 +08:00
|
|
|
//
|
|
|
|
// Types may be postfixed with the following modifiers:
|
2015-04-01 00:39:02 +08:00
|
|
|
// * -> pointer (optionally followed by an address space number, if no address
|
|
|
|
// space is specified than any address space will be accepted)
|
2010-03-12 12:21:28 +08:00
|
|
|
// & -> reference (optionally followed by an address space number)
|
2007-08-17 13:31:46 +08:00
|
|
|
// C -> const
|
2010-01-27 06:48:42 +08:00
|
|
|
// D -> volatile
|
2007-01-28 16:20:04 +08:00
|
|
|
|
|
|
|
// The third value provided to the macro specifies information about attributes
|
2007-08-31 11:44:20 +08:00
|
|
|
// of the function. These must be kept in sync with the predicates in the
|
|
|
|
// Builtin::Context class. Currently we have:
|
2007-01-28 16:20:04 +08:00
|
|
|
// n -> nothrow
|
2009-07-28 03:14:18 +08:00
|
|
|
// r -> noreturn
|
2016-05-05 05:08:13 +08:00
|
|
|
// U -> pure
|
2007-01-28 16:20:04 +08:00
|
|
|
// c -> const
|
2011-02-26 13:39:39 +08:00
|
|
|
// t -> signature is meaningless, use custom typechecking
|
2007-08-31 11:44:20 +08:00
|
|
|
// F -> this is a libc/libm function with a '__builtin_' prefix added.
|
Implicitly declare certain C library functions (malloc, strcpy, memmove,
etc.) when we perform name lookup on them. This ensures that we
produce the correct signature for these functions, which has two
practical impacts:
1) When we're supporting the "implicit function declaration" feature
of C99, these functions will be implicitly declared with the right
signature rather than as a function returning "int" with no
prototype. See PR3541 for the reason why this is important (hint:
GCC always predeclares these functions).
2) If users attempt to redeclare one of these library functions with
an incompatible signature, we produce a hard error.
This patch does a little bit of work to give reasonable error
messages. For example, when we hit case #1 we complain that we're
implicitly declaring this function with a specific signature, and then
we give a note that asks the user to include the appropriate header
(e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
case #2, we show the type of the implicit builtin that was incorrectly
declared, so the user can see the problem. We could do better here:
for example, when displaying this latter error message we say
something like:
'strcpy' was implicitly declared here with type 'char *(char *, char
const *)'
but we should really print out a fake code line showing the
declaration, like this:
'strcpy' was implicitly declared here as:
char *strcpy(char *, char const *)
This would also be good for printing built-in candidates with C++
operator overloading.
The set of C library functions supported by this patch includes all
functions from the C99 specification's <stdlib.h> and <string.h> that
(a) are predefined by GCC and (b) have signatures that could cause
codegen issues if they are treated as functions with no prototype
returning and int. Future work could extend this set of functions to
other C library functions that we know about.
llvm-svn: 64504
2009-02-14 07:20:09 +08:00
|
|
|
// f -> this is a libc/libm function without the '__builtin_' prefix. It can
|
2009-02-14 08:32:47 +08:00
|
|
|
// be followed by ':headername:' to state which header this function
|
|
|
|
// comes from.
|
2016-09-15 05:19:43 +08:00
|
|
|
// h -> this function requires a specific header or an explicit declaration.
|
2013-06-14 02:34:17 +08:00
|
|
|
// i -> this is a runtime library implemented function without the
|
2014-06-04 07:27:44 +08:00
|
|
|
// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
|
2009-09-17 13:45:52 +08:00
|
|
|
// p:N: -> this is a printf-like function whose Nth argument is the format
|
2009-02-14 08:32:47 +08:00
|
|
|
// string.
|
|
|
|
// P:N: -> similar to the p:N: attribute, but the function is like vprintf
|
2009-09-17 13:45:52 +08:00
|
|
|
// in that it accepts its arguments as a va_list rather than
|
2009-02-14 08:32:47 +08:00
|
|
|
// through an ellipsis
|
2010-07-16 10:11:15 +08:00
|
|
|
// s:N: -> this is a scanf-like function whose Nth argument is the format
|
|
|
|
// string.
|
|
|
|
// S:N: -> similar to the s:N: attribute, but the function is like vscanf
|
|
|
|
// in that it accepts its arguments as a va_list rather than
|
|
|
|
// through an ellipsis
|
2009-02-17 06:43:43 +08:00
|
|
|
// e -> const, but only when -fmath-errno=0
|
2011-10-13 03:51:18 +08:00
|
|
|
// j -> returns_twice (like setjmp)
|
2013-01-18 07:46:04 +08:00
|
|
|
// u -> arguments are not evaluated for their side-effects
|
2008-09-13 02:39:42 +08:00
|
|
|
// FIXME: gcc has nonnull
|
2007-01-28 16:20:04 +08:00
|
|
|
|
2009-02-15 04:49:29 +08:00
|
|
|
#if defined(BUILTIN) && !defined(LIBBUILTIN)
|
2010-12-01 01:35:24 +08:00
|
|
|
# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
|
2009-02-15 04:49:29 +08:00
|
|
|
#endif
|
|
|
|
|
2013-11-14 06:47:22 +08:00
|
|
|
#if defined(BUILTIN) && !defined(LANGBUILTIN)
|
|
|
|
# define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
|
|
|
|
#endif
|
|
|
|
|
2007-12-02 09:20:23 +08:00
|
|
|
// Standard libc/libm functions:
|
2009-12-19 13:23:20 +08:00
|
|
|
BUILTIN(__builtin_atan2 , "ddd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_atan2f, "fff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc")
|
2009-09-17 13:45:52 +08:00
|
|
|
BUILTIN(__builtin_abs , "ii" , "ncF")
|
|
|
|
BUILTIN(__builtin_copysign, "ddd", "ncF")
|
|
|
|
BUILTIN(__builtin_copysignf, "fff", "ncF")
|
|
|
|
BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
|
|
|
|
BUILTIN(__builtin_fabs , "dd" , "ncF")
|
|
|
|
BUILTIN(__builtin_fabsf, "ff" , "ncF")
|
|
|
|
BUILTIN(__builtin_fabsl, "LdLd", "ncF")
|
2009-12-19 13:23:20 +08:00
|
|
|
BUILTIN(__builtin_fmod , "ddd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_fmodf, "fff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc")
|
2011-09-09 05:18:03 +08:00
|
|
|
BUILTIN(__builtin_frexp , "ddi*" , "Fn")
|
|
|
|
BUILTIN(__builtin_frexpf, "ffi*" , "Fn")
|
|
|
|
BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
|
2008-10-06 14:51:12 +08:00
|
|
|
BUILTIN(__builtin_huge_val, "d", "nc")
|
|
|
|
BUILTIN(__builtin_huge_valf, "f", "nc")
|
|
|
|
BUILTIN(__builtin_huge_vall, "Ld", "nc")
|
|
|
|
BUILTIN(__builtin_inf , "d" , "nc")
|
|
|
|
BUILTIN(__builtin_inff , "f" , "nc")
|
|
|
|
BUILTIN(__builtin_infl , "Ld" , "nc")
|
2012-01-18 06:11:30 +08:00
|
|
|
BUILTIN(__builtin_labs , "LiLi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_llabs, "LLiLLi", "Fnc")
|
2009-12-19 13:23:20 +08:00
|
|
|
BUILTIN(__builtin_ldexp , "ddi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ldexpf, "ffi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc")
|
2011-09-09 05:18:03 +08:00
|
|
|
BUILTIN(__builtin_modf , "ddd*" , "Fn")
|
|
|
|
BUILTIN(__builtin_modff, "fff*" , "Fn")
|
|
|
|
BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
|
2008-07-01 02:32:54 +08:00
|
|
|
BUILTIN(__builtin_nan, "dcC*" , "ncF")
|
|
|
|
BUILTIN(__builtin_nanf, "fcC*" , "ncF")
|
|
|
|
BUILTIN(__builtin_nanl, "LdcC*", "ncF")
|
2008-07-22 06:59:13 +08:00
|
|
|
BUILTIN(__builtin_nans, "dcC*" , "ncF")
|
|
|
|
BUILTIN(__builtin_nansf, "fcC*" , "ncF")
|
|
|
|
BUILTIN(__builtin_nansl, "LdcC*", "ncF")
|
2009-12-19 13:23:20 +08:00
|
|
|
BUILTIN(__builtin_powi , "ddi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_powif, "ffi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_powil, "LdLdi", "Fnc")
|
|
|
|
BUILTIN(__builtin_pow , "ddd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_powf, "fff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_powl, "LdLdLd", "Fnc")
|
2009-09-17 13:45:52 +08:00
|
|
|
|
|
|
|
// Standard unary libc/libm functions with double/float/long double variants:
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_acos , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_acosf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_acosl, "LdLd", "Fnc")
|
2011-02-06 20:45:51 +08:00
|
|
|
BUILTIN(__builtin_acosh , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_acoshf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_acoshl, "LdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_asin , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_asinf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_asinl, "LdLd", "Fnc")
|
2011-02-06 20:45:51 +08:00
|
|
|
BUILTIN(__builtin_asinh , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_asinhf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_asinhl, "LdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_atan , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_atanf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_atanl, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_atanh , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_atanhf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_atanhl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cbrt , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cbrtf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_ceil , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ceilf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ceill, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cos , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_cosf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_cosh , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_coshf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_coshl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cosl, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_erf , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_erff, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_erfl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_erfc , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_erfcf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_erfcl, "LdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_exp , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_expf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_expl, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_exp2 , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_exp2f, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_exp2l, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_expm1 , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_expm1f, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_expm1l, "LdLd", "Fnc")
|
2010-09-16 13:20:04 +08:00
|
|
|
BUILTIN(__builtin_fdim, "ddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fdimf, "fff", "Fnc")
|
|
|
|
BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_floor , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_floorf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_floorl, "LdLd", "Fnc")
|
2010-09-16 13:20:04 +08:00
|
|
|
BUILTIN(__builtin_fma, "dddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmaf, "ffff", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmax, "ddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmaxf, "fff", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fmin, "ddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_fminf, "fff", "Fnc")
|
|
|
|
BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
|
2009-12-19 13:23:20 +08:00
|
|
|
BUILTIN(__builtin_hypot , "ddd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_hypotf, "fff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_ilogb , "id", "Fnc")
|
|
|
|
BUILTIN(__builtin_ilogbf, "if", "Fnc")
|
|
|
|
BUILTIN(__builtin_ilogbl, "iLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_lgamma , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_lgammaf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_lgammal, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_llrint, "LLid", "Fnc")
|
|
|
|
BUILTIN(__builtin_llrintf, "LLif", "Fnc")
|
|
|
|
BUILTIN(__builtin_llrintl, "LLiLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_llround , "LLid", "Fnc")
|
|
|
|
BUILTIN(__builtin_llroundf, "LLif", "Fnc")
|
|
|
|
BUILTIN(__builtin_llroundl, "LLiLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_log , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log10 , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log10f, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log10l, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_log1p , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log1pf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log1pl, "LdLd", "Fnc")
|
2010-11-25 09:15:00 +08:00
|
|
|
BUILTIN(__builtin_log2, "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log2f, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_log2l, "LdLd" , "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_logb , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_logbf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_logbl, "LdLd", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_logf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_logl, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_lrint , "Lid", "Fnc")
|
|
|
|
BUILTIN(__builtin_lrintf, "Lif", "Fnc")
|
|
|
|
BUILTIN(__builtin_lrintl, "LiLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_lround , "Lid", "Fnc")
|
|
|
|
BUILTIN(__builtin_lroundf, "Lif", "Fnc")
|
|
|
|
BUILTIN(__builtin_lroundl, "LiLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_nearbyint , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_nearbyintf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_nextafter , "ddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_nextafterf, "fff", "Fnc")
|
|
|
|
BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc")
|
2013-09-29 01:41:03 +08:00
|
|
|
BUILTIN(__builtin_nexttoward , "ddLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_nexttowardf, "ffLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_remainder , "ddd", "Fnc")
|
|
|
|
BUILTIN(__builtin_remainderf, "fff", "Fnc")
|
|
|
|
BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc")
|
2011-09-09 05:18:03 +08:00
|
|
|
BUILTIN(__builtin_remquo , "dddi*", "Fn")
|
|
|
|
BUILTIN(__builtin_remquof, "fffi*", "Fn")
|
|
|
|
BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_rint , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_rintf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_rintl, "LdLd", "Fnc")
|
2010-11-25 09:15:00 +08:00
|
|
|
BUILTIN(__builtin_round, "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_roundf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_roundl, "LdLd" , "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_scalbln , "ddLi", "Fnc")
|
|
|
|
BUILTIN(__builtin_scalblnf, "ffLi", "Fnc")
|
|
|
|
BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc")
|
|
|
|
BUILTIN(__builtin_scalbn , "ddi", "Fnc")
|
|
|
|
BUILTIN(__builtin_scalbnf, "ffi", "Fnc")
|
|
|
|
BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc")
|
2009-12-07 10:09:14 +08:00
|
|
|
BUILTIN(__builtin_sin , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sinf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sinh , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sinhf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sinhl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_sinl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_sqrt , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sqrtf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_sqrtl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_tan , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_tanf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_tanh , "dd" , "Fnc")
|
|
|
|
BUILTIN(__builtin_tanhf, "ff" , "Fnc")
|
|
|
|
BUILTIN(__builtin_tanhl, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_tanl, "LdLd", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_tgamma , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_tgammaf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_tgammal, "LdLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_trunc , "dd", "Fnc")
|
|
|
|
BUILTIN(__builtin_truncf, "ff", "Fnc")
|
|
|
|
BUILTIN(__builtin_truncl, "LdLd", "Fnc")
|
2009-09-17 13:45:52 +08:00
|
|
|
|
2009-09-29 05:45:01 +08:00
|
|
|
// C99 complex builtins
|
|
|
|
BUILTIN(__builtin_cabs, "dXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cabsf, "fXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cabsl, "LdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cacos, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cacosf, "XfXf", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_cacosh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cacoshf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cacoshl, "XLdXLd", "Fnc")
|
2009-09-29 05:45:01 +08:00
|
|
|
BUILTIN(__builtin_cacosl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_carg, "dXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cargf, "fXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cargl, "LdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_casin, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_casinf, "XfXf", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_casinh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_casinhf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_casinhl, "XLdXLd", "Fnc")
|
2009-09-29 05:45:01 +08:00
|
|
|
BUILTIN(__builtin_casinl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_catan, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_catanf, "XfXf", "Fnc")
|
2011-02-15 01:02:48 +08:00
|
|
|
BUILTIN(__builtin_catanh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_catanhf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_catanhl, "XLdXLd", "Fnc")
|
2009-09-29 05:45:01 +08:00
|
|
|
BUILTIN(__builtin_catanl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccos, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccosf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccosl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccosh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccoshf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_ccoshl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cexp, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cexpf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cexpl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cimag, "dXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cimagf, "fXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cimagl, "LdXLd", "Fnc")
|
2010-08-16 23:57:05 +08:00
|
|
|
BUILTIN(__builtin_conj, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_conjf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_conjl, "XLdXLd", "Fnc")
|
2009-09-29 05:45:01 +08:00
|
|
|
BUILTIN(__builtin_clog, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_clogf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_clogl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cproj, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cprojf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cpow, "XdXdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_cpowf, "XfXfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_creal, "dXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_crealf, "fXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_creall, "LdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csin, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csinf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_csinl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csinh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csinhf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_csinhl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csqrt, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_csqrtf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_csqrtl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctan, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctanf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctanl, "XLdXLd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctanh, "XdXd", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctanhf, "XfXf", "Fnc")
|
|
|
|
BUILTIN(__builtin_ctanhl, "XLdXLd", "Fnc")
|
2007-12-02 09:20:23 +08:00
|
|
|
|
2007-12-13 15:41:58 +08:00
|
|
|
// FP Comparisons.
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_isgreater , "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isgreaterequal, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isless , "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_islessequal , "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_islessgreater , "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isunordered , "i.", "Fnc")
|
2007-12-13 15:41:58 +08:00
|
|
|
|
2009-09-01 04:06:00 +08:00
|
|
|
// Unary FP classification
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_fpclassify, "iiiii.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isfinite, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isinf, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isinf_sign, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isnan, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_isnormal, "i.", "Fnc")
|
2009-09-01 04:06:00 +08:00
|
|
|
|
2010-03-06 10:17:52 +08:00
|
|
|
// FP signbit builtins
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_signbit, "i.", "Fnc")
|
|
|
|
BUILTIN(__builtin_signbitf, "if", "Fnc")
|
|
|
|
BUILTIN(__builtin_signbitl, "iLd", "Fnc")
|
2010-03-06 10:17:52 +08:00
|
|
|
|
2016-02-27 17:06:18 +08:00
|
|
|
// Special FP builtins.
|
|
|
|
BUILTIN(__builtin_canonicalize, "dd", "nc")
|
|
|
|
BUILTIN(__builtin_canonicalizef, "ff", "nc")
|
|
|
|
BUILTIN(__builtin_canonicalizel, "LdLd", "nc")
|
|
|
|
|
2007-12-02 09:20:23 +08:00
|
|
|
// Builtins for arithmetic.
|
2012-01-29 02:42:57 +08:00
|
|
|
BUILTIN(__builtin_clzs , "iUs" , "nc")
|
2007-12-02 09:20:23 +08:00
|
|
|
BUILTIN(__builtin_clz , "iUi" , "nc")
|
|
|
|
BUILTIN(__builtin_clzl , "iULi" , "nc")
|
|
|
|
BUILTIN(__builtin_clzll, "iULLi", "nc")
|
2007-12-03 07:05:46 +08:00
|
|
|
// TODO: int clzimax(uintmax_t)
|
2012-01-29 02:42:57 +08:00
|
|
|
BUILTIN(__builtin_ctzs , "iUs" , "nc")
|
2007-12-02 09:20:23 +08:00
|
|
|
BUILTIN(__builtin_ctz , "iUi" , "nc")
|
|
|
|
BUILTIN(__builtin_ctzl , "iULi" , "nc")
|
|
|
|
BUILTIN(__builtin_ctzll, "iULLi", "nc")
|
2007-12-03 07:05:46 +08:00
|
|
|
// TODO: int ctzimax(uintmax_t)
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_ffs , "ii" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ffsl , "iLi" , "Fnc")
|
|
|
|
BUILTIN(__builtin_ffsll, "iLLi", "Fnc")
|
2008-07-22 01:19:41 +08:00
|
|
|
BUILTIN(__builtin_parity , "iUi" , "nc")
|
|
|
|
BUILTIN(__builtin_parityl , "iULi" , "nc")
|
|
|
|
BUILTIN(__builtin_parityll, "iULLi", "nc")
|
|
|
|
BUILTIN(__builtin_popcount , "iUi" , "nc")
|
|
|
|
BUILTIN(__builtin_popcountl , "iULi" , "nc")
|
|
|
|
BUILTIN(__builtin_popcountll, "iULLi", "nc")
|
2007-12-02 09:20:23 +08:00
|
|
|
|
2007-12-03 07:05:46 +08:00
|
|
|
// FIXME: These type signatures are not correct for targets with int != 32-bits
|
|
|
|
// or with ULL != 64-bits.
|
2012-10-06 22:42:22 +08:00
|
|
|
BUILTIN(__builtin_bswap16, "UsUs", "nc")
|
2007-12-03 05:58:10 +08:00
|
|
|
BUILTIN(__builtin_bswap32, "UiUi", "nc")
|
|
|
|
BUILTIN(__builtin_bswap64, "ULLiULLi", "nc")
|
2007-12-03 07:05:46 +08:00
|
|
|
|
2016-03-24 06:14:43 +08:00
|
|
|
BUILTIN(__builtin_bitreverse8, "UcUc", "nc")
|
2016-02-04 01:49:38 +08:00
|
|
|
BUILTIN(__builtin_bitreverse16, "UsUs", "nc")
|
|
|
|
BUILTIN(__builtin_bitreverse32, "UiUi", "nc")
|
|
|
|
BUILTIN(__builtin_bitreverse64, "ULLiULLi", "nc")
|
|
|
|
|
2007-12-03 07:05:46 +08:00
|
|
|
// Random GCC builtins
|
2013-01-18 07:46:04 +08:00
|
|
|
BUILTIN(__builtin_constant_p, "i.", "nctu")
|
|
|
|
BUILTIN(__builtin_classify_type, "i.", "nctu")
|
2008-10-06 14:51:12 +08:00
|
|
|
BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")
|
2010-01-23 10:40:42 +08:00
|
|
|
BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc")
|
2011-08-27 09:09:30 +08:00
|
|
|
BUILTIN(__builtin_va_start, "vA.", "nt")
|
2009-01-20 15:46:22 +08:00
|
|
|
BUILTIN(__builtin_va_end, "vA", "n")
|
|
|
|
BUILTIN(__builtin_va_copy, "vAA", "n")
|
|
|
|
BUILTIN(__builtin_stdarg_start, "vA.", "n")
|
2014-09-08 06:58:14 +08:00
|
|
|
BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc")
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_bcmp, "iv*v*z", "Fn")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_bcopy, "vv*v*z", "n")
|
2010-01-24 03:00:10 +08:00
|
|
|
BUILTIN(__builtin_bzero, "vv*z", "nF")
|
2010-08-25 23:47:31 +08:00
|
|
|
BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:")
|
2009-08-28 06:00:18 +08:00
|
|
|
BUILTIN(__builtin_memchr, "v*vC*iz", "nF")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF")
|
|
|
|
BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
|
|
|
|
BUILTIN(__builtin_memmove, "v*v*vC*z", "nF")
|
|
|
|
BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF")
|
|
|
|
BUILTIN(__builtin_memset, "v*v*iz", "nF")
|
2010-08-25 23:47:31 +08:00
|
|
|
BUILTIN(__builtin_printf, "icC*.", "Fp:0:")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF")
|
|
|
|
BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF")
|
|
|
|
BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF")
|
2009-02-20 14:36:40 +08:00
|
|
|
BUILTIN(__builtin_strcat, "c*c*cC*", "nF")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_strchr, "c*cC*i", "nF")
|
|
|
|
BUILTIN(__builtin_strcmp, "icC*cC*", "nF")
|
2009-02-20 14:36:40 +08:00
|
|
|
BUILTIN(__builtin_strcpy, "c*c*cC*", "nF")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_strcspn, "zcC*cC*", "nF")
|
|
|
|
BUILTIN(__builtin_strdup, "c*cC*", "nF")
|
|
|
|
BUILTIN(__builtin_strlen, "zcC*", "nF")
|
|
|
|
BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF")
|
|
|
|
BUILTIN(__builtin_strncat, "c*c*cC*z", "nF")
|
|
|
|
BUILTIN(__builtin_strncmp, "icC*cC*z", "nF")
|
2009-02-20 14:36:40 +08:00
|
|
|
BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_strndup, "c*cC*z", "nF")
|
|
|
|
BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF")
|
2009-02-20 14:36:40 +08:00
|
|
|
BUILTIN(__builtin_strrchr, "c*cC*i", "nF")
|
2009-04-10 00:42:50 +08:00
|
|
|
BUILTIN(__builtin_strspn, "zcC*cC*", "nF")
|
|
|
|
BUILTIN(__builtin_strstr, "c*cC*cC*", "nF")
|
2010-10-02 07:35:58 +08:00
|
|
|
BUILTIN(__builtin_return_address, "v*IUi", "n")
|
2009-05-04 03:23:23 +08:00
|
|
|
BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
|
2010-10-02 07:35:58 +08:00
|
|
|
BUILTIN(__builtin_frame_address, "v*IUi", "n")
|
2014-03-26 23:36:05 +08:00
|
|
|
BUILTIN(__builtin___clear_cache, "vc*c*", "n")
|
2008-12-27 00:43:35 +08:00
|
|
|
BUILTIN(__builtin_flt_rounds, "i", "nc")
|
2015-03-04 22:25:35 +08:00
|
|
|
BUILTIN(__builtin_setjmp, "iv**", "j")
|
|
|
|
BUILTIN(__builtin_longjmp, "vv**i", "r")
|
2009-06-02 17:39:16 +08:00
|
|
|
BUILTIN(__builtin_unwind_init, "v", "")
|
2010-10-02 07:35:58 +08:00
|
|
|
BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc")
|
2010-07-14 06:35:05 +08:00
|
|
|
BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:")
|
2010-04-14 12:25:45 +08:00
|
|
|
BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:")
|
2009-09-29 02:08:57 +08:00
|
|
|
BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:")
|
2016-06-16 21:41:54 +08:00
|
|
|
BUILTIN(__builtin_thread_pointer, "v*", "nc")
|
2008-12-27 00:43:35 +08:00
|
|
|
|
2010-02-12 03:02:42 +08:00
|
|
|
// GCC exception builtins
|
2010-07-27 06:04:15 +08:00
|
|
|
BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t!
|
2010-02-12 03:02:42 +08:00
|
|
|
BUILTIN(__builtin_frob_return_addr, "v*v*", "n")
|
|
|
|
BUILTIN(__builtin_dwarf_cfa, "v*", "n")
|
|
|
|
BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n")
|
|
|
|
BUILTIN(__builtin_dwarf_sp_column, "Ui", "n")
|
2010-03-02 11:50:12 +08:00
|
|
|
BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t
|
2010-02-12 03:02:42 +08:00
|
|
|
|
2008-05-15 06:12:15 +08:00
|
|
|
// GCC Object size checking builtins
|
2013-01-18 07:46:04 +08:00
|
|
|
BUILTIN(__builtin_object_size, "zvC*i", "nu")
|
2008-09-04 04:28:50 +08:00
|
|
|
BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF")
|
2012-12-18 08:34:49 +08:00
|
|
|
BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF")
|
2008-09-04 04:28:50 +08:00
|
|
|
BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF")
|
|
|
|
BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF")
|
2008-09-13 02:39:42 +08:00
|
|
|
BUILTIN(__builtin___memset_chk, "v*v*izz", "nF")
|
|
|
|
BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
|
2008-09-04 04:28:50 +08:00
|
|
|
BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
|
2008-09-13 02:39:42 +08:00
|
|
|
BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
|
2012-12-18 08:37:10 +08:00
|
|
|
BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
|
|
|
|
BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
|
2008-09-13 02:39:42 +08:00
|
|
|
BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
|
|
|
|
BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
|
2010-04-08 07:00:44 +08:00
|
|
|
BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
|
2009-02-14 08:32:47 +08:00
|
|
|
BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:")
|
|
|
|
BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:")
|
|
|
|
BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:")
|
|
|
|
BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:")
|
2009-02-14 09:52:53 +08:00
|
|
|
BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:")
|
|
|
|
BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:")
|
|
|
|
BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:")
|
|
|
|
BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:")
|
2008-09-13 02:39:42 +08:00
|
|
|
|
2015-09-03 04:01:30 +08:00
|
|
|
BUILTIN(__builtin_unpredictable, "LiLi" , "nc")
|
2009-11-01 00:04:14 +08:00
|
|
|
BUILTIN(__builtin_expect, "LiLiLi" , "nc")
|
2010-10-02 03:47:04 +08:00
|
|
|
BUILTIN(__builtin_prefetch, "vvC*.", "nc")
|
2012-08-06 06:03:08 +08:00
|
|
|
BUILTIN(__builtin_readcyclecounter, "ULLi", "n")
|
2009-09-27 05:16:00 +08:00
|
|
|
BUILTIN(__builtin_trap, "v", "nr")
|
2012-10-20 06:21:42 +08:00
|
|
|
BUILTIN(__builtin_debugtrap, "v", "n")
|
2009-09-21 11:09:59 +08:00
|
|
|
BUILTIN(__builtin_unreachable, "v", "nr")
|
2008-05-15 03:38:39 +08:00
|
|
|
BUILTIN(__builtin_shufflevector, "v." , "nc")
|
2013-09-18 11:29:45 +08:00
|
|
|
BUILTIN(__builtin_convertvector, "v." , "nct")
|
2015-07-20 22:36:59 +08:00
|
|
|
BUILTIN(__builtin_alloca, "v*z" , "Fn")
|
2014-12-13 07:41:25 +08:00
|
|
|
BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
|
2007-12-02 13:42:36 +08:00
|
|
|
|
2009-05-08 14:58:22 +08:00
|
|
|
// "Overloaded" Atomic operator builtins. These are overloaded to support data
|
|
|
|
// types of i8, i16, i32, i64, and i128. The front-end sees calls to the
|
|
|
|
// non-suffixed version of these (which has a bogus type) and transforms them to
|
|
|
|
// the right overloaded version in Sema (plus casts).
|
2009-04-07 08:55:51 +08:00
|
|
|
|
2009-05-08 14:58:22 +08:00
|
|
|
// FIXME: These assume that char -> i8, short -> i16, int -> i32,
|
|
|
|
// long long -> i64.
|
2009-05-06 01:48:42 +08:00
|
|
|
|
2011-11-09 03:45:38 +08:00
|
|
|
BUILTIN(__sync_fetch_and_add, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt")
|
|
|
|
|
|
|
|
BUILTIN(__sync_fetch_and_sub, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt")
|
|
|
|
|
|
|
|
BUILTIN(__sync_fetch_and_or, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt")
|
|
|
|
BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt")
|
|
|
|
|
|
|
|
BUILTIN(__sync_fetch_and_and, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_fetch_and_xor, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
2014-10-03 04:53:50 +08:00
|
|
|
BUILTIN(__sync_fetch_and_nand, "v.", "t")
|
|
|
|
BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn")
|
2011-11-09 03:45:38 +08:00
|
|
|
|
|
|
|
BUILTIN(__sync_add_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_sub_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_or_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_and_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_xor_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
2014-10-03 04:53:50 +08:00
|
|
|
BUILTIN(__sync_nand_and_fetch, "v.", "t")
|
|
|
|
BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
2011-11-09 03:45:38 +08:00
|
|
|
BUILTIN(__sync_bool_compare_and_swap, "v.", "t")
|
|
|
|
BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn")
|
|
|
|
BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn")
|
|
|
|
BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn")
|
|
|
|
BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn")
|
|
|
|
BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_val_compare_and_swap, "v.", "t")
|
|
|
|
BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn")
|
|
|
|
BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn")
|
|
|
|
BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn")
|
|
|
|
BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn")
|
|
|
|
BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_lock_test_and_set, "v.", "t")
|
|
|
|
BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_lock_release, "v.", "t")
|
|
|
|
BUILTIN(__sync_lock_release_1, "vcD*.", "tn")
|
|
|
|
BUILTIN(__sync_lock_release_2, "vsD*.", "tn")
|
|
|
|
BUILTIN(__sync_lock_release_4, "viD*.", "tn")
|
|
|
|
BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn")
|
|
|
|
BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn")
|
|
|
|
|
|
|
|
BUILTIN(__sync_swap, "v.", "t")
|
|
|
|
BUILTIN(__sync_swap_1, "ccD*c.", "tn")
|
|
|
|
BUILTIN(__sync_swap_2, "ssD*s.", "tn")
|
|
|
|
BUILTIN(__sync_swap_4, "iiD*i.", "tn")
|
|
|
|
BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn")
|
|
|
|
BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn")
|
2011-04-09 11:57:26 +08:00
|
|
|
|
2012-04-12 13:08:17 +08:00
|
|
|
// Some of our atomics builtins are handled by AtomicExpr rather than
|
|
|
|
// as normal builtin CallExprs. This macro is used for such builtins.
|
|
|
|
#ifndef ATOMIC_BUILTIN
|
|
|
|
#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)
|
|
|
|
#endif
|
|
|
|
|
2012-04-12 01:55:32 +08:00
|
|
|
// C11 _Atomic operations for <stdatomic.h>.
|
2012-04-12 13:08:17 +08:00
|
|
|
ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t")
|
2012-04-12 01:55:32 +08:00
|
|
|
BUILTIN(__c11_atomic_thread_fence, "vi", "n")
|
|
|
|
BUILTIN(__c11_atomic_signal_fence, "vi", "n")
|
|
|
|
BUILTIN(__c11_atomic_is_lock_free, "iz", "n")
|
|
|
|
|
2012-04-12 13:08:17 +08:00
|
|
|
// GNU atomic builtins.
|
|
|
|
ATOMIC_BUILTIN(__atomic_load, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_load_n, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_store, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_store_n, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_exchange, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t")
|
2012-04-13 14:31:38 +08:00
|
|
|
ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t")
|
2012-04-12 13:08:17 +08:00
|
|
|
ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t")
|
|
|
|
ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t")
|
2012-04-13 14:31:38 +08:00
|
|
|
ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t")
|
Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.
Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.
Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.
Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.
With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.
llvm-svn: 154640
2012-04-13 08:45:38 +08:00
|
|
|
BUILTIN(__atomic_test_and_set, "bvD*i", "n")
|
|
|
|
BUILTIN(__atomic_clear, "vvD*i", "n")
|
2011-10-15 04:59:01 +08:00
|
|
|
BUILTIN(__atomic_thread_fence, "vi", "n")
|
|
|
|
BUILTIN(__atomic_signal_fence, "vi", "n")
|
Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.
Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.
Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.
Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.
With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.
llvm-svn: 154640
2012-04-13 08:45:38 +08:00
|
|
|
BUILTIN(__atomic_always_lock_free, "izvCD*", "n")
|
|
|
|
BUILTIN(__atomic_is_lock_free, "izvCD*", "n")
|
2012-04-12 13:08:17 +08:00
|
|
|
|
|
|
|
#undef ATOMIC_BUILTIN
|
2009-05-08 14:58:22 +08:00
|
|
|
|
|
|
|
// Non-overloaded atomic builtins.
|
|
|
|
BUILTIN(__sync_synchronize, "v.", "n")
|
|
|
|
// GCC does not support these, they are a Clang extension.
|
2010-07-29 02:42:27 +08:00
|
|
|
BUILTIN(__sync_fetch_and_min, "iiD*i", "n")
|
|
|
|
BUILTIN(__sync_fetch_and_max, "iiD*i", "n")
|
|
|
|
BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n")
|
|
|
|
BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n")
|
2008-10-18 10:49:28 +08:00
|
|
|
|
2010-04-20 09:31:15 +08:00
|
|
|
// Random libc builtins.
|
|
|
|
BUILTIN(__builtin_abort, "v", "Fnr")
|
|
|
|
BUILTIN(__builtin_index, "c*cC*i", "Fn")
|
|
|
|
BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
|
|
|
|
|
2013-11-14 06:47:22 +08:00
|
|
|
// Microsoft builtins. These are only active with -fms-extensions.
|
Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.
Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
implemented.
- __finally blocks will not run after exceptions. Fixing this requires
work in the LLVM SEH preparation pass.
The IR lowering looks like this:
// C code:
bool safe_div(int n, int d, int *r) {
__try {
*r = normal_div(n, d);
} __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
return false;
}
return true;
}
; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
%ehptrs = bitcast i8* %e to i32**
%ehrec = load i32** %ehptrs
%code = load i32* %ehrec
%matches = icmp eq i32 %code, i32 u0xC0000094
%matches.i32 = zext i1 %matches to i32
ret i32 %matches.i32
}
define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
%rr = invoke i32 @normal_div(i32 %n, i32 %d)
to label %normal unwind to label %lpad
normal:
store i32 %rr, i32* %r
ret i1 1
lpad:
%ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
%ehptr = extractvalue {i8*, i32} %ehvals, i32 0
%sel = extractvalue {i8*, i32} %ehvals, i32 1
%filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
%matches = icmp eq i32 %sel, %filter_sel
br i1 %matches, label %eh.except, label %eh.resume
eh.except:
ret i1 false
eh.resume:
resume
}
Reviewers: rjmccall, rsmith, majnemer
Differential Revision: http://reviews.llvm.org/D5607
llvm-svn: 226760
2015-01-22 09:36:17 +08:00
|
|
|
LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES)
|
2016-09-15 05:19:43 +08:00
|
|
|
LIBBUILTIN(_byteswap_ushort, "UsUs", "fnc", "stdlib.h", ALL_MS_LANGUAGES)
|
|
|
|
LIBBUILTIN(_byteswap_ulong, "ULiULi", "fnc", "stdlib.h", ALL_MS_LANGUAGES)
|
|
|
|
LIBBUILTIN(_byteswap_uint64, "ULLiULLi", "fnc", "stdlib.h", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES)
|
Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.
Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
implemented.
- __finally blocks will not run after exceptions. Fixing this requires
work in the LLVM SEH preparation pass.
The IR lowering looks like this:
// C code:
bool safe_div(int n, int d, int *r) {
__try {
*r = normal_div(n, d);
} __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
return false;
}
return true;
}
; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
%ehptrs = bitcast i8* %e to i32**
%ehrec = load i32** %ehptrs
%code = load i32* %ehrec
%matches = icmp eq i32 %code, i32 u0xC0000094
%matches.i32 = zext i1 %matches to i32
ret i32 %matches.i32
}
define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
%rr = invoke i32 @normal_div(i32 %n, i32 %d)
to label %normal unwind to label %lpad
normal:
store i32 %rr, i32* %r
ret i1 1
lpad:
%ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
%ehptr = extractvalue {i8*, i32} %ehvals, i32 0
%sel = extractvalue {i8*, i32} %ehvals, i32 1
%filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
%matches = icmp eq i32 %sel, %filter_sel
br i1 %matches, label %eh.except, label %eh.resume
eh.except:
ret i1 false
eh.resume:
resume
}
Reviewers: rjmccall, rsmith, majnemer
Differential Revision: http://reviews.llvm.org/D5607
llvm-svn: 226760
2015-01-22 09:36:17 +08:00
|
|
|
LANGBUILTIN(__exception_code, "ULi", "n", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(_exception_code, "ULi", "n", ALL_MS_LANGUAGES)
|
Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.
Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
implemented.
- __finally blocks will not run after exceptions. Fixing this requires
work in the LLVM SEH preparation pass.
The IR lowering looks like this:
// C code:
bool safe_div(int n, int d, int *r) {
__try {
*r = normal_div(n, d);
} __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
return false;
}
return true;
}
; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
%ehptrs = bitcast i8* %e to i32**
%ehrec = load i32** %ehptrs
%code = load i32* %ehrec
%matches = icmp eq i32 %code, i32 u0xC0000094
%matches.i32 = zext i1 %matches to i32
ret i32 %matches.i32
}
define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
%rr = invoke i32 @normal_div(i32 %n, i32 %d)
to label %normal unwind to label %lpad
normal:
store i32 %rr, i32* %r
ret i1 1
lpad:
%ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
%ehptr = extractvalue {i8*, i32} %ehvals, i32 0
%sel = extractvalue {i8*, i32} %ehvals, i32 1
%filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
%matches = icmp eq i32 %sel, %filter_sel
br i1 %matches, label %eh.except, label %eh.resume
eh.except:
ret i1 false
eh.resume:
resume
}
Reviewers: rjmccall, rsmith, majnemer
Differential Revision: http://reviews.llvm.org/D5607
llvm-svn: 226760
2015-01-22 09:36:17 +08:00
|
|
|
LANGBUILTIN(__exception_info, "v*", "n", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(_exception_info, "v*", "n", ALL_MS_LANGUAGES)
|
2015-02-05 06:37:07 +08:00
|
|
|
LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
|
2015-03-14 02:26:17 +08:00
|
|
|
LANGBUILTIN(__GetExceptionInfo, "v*.", "ntu", ALL_MS_LANGUAGES)
|
2016-09-14 03:43:33 +08:00
|
|
|
LANGBUILTIN(_InterlockedAnd8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedAnd16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedAnd, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedCompareExchange8, "ccD*cc", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedCompareExchange16, "ssD*ss", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedCompareExchange, "LiLiD*LiLi", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedCompareExchange64, "LLiLLiD*LLiLLi", "n", ALL_MS_LANGUAGES)
|
2014-06-19 04:51:10 +08:00
|
|
|
LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
|
2016-09-14 03:43:33 +08:00
|
|
|
LANGBUILTIN(_InterlockedDecrement16, "ssD*", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedDecrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchange, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchange8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchange16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeAdd8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeAdd16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeAdd, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeSub8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeSub16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedExchangeSub, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedIncrement16, "ssD*", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedIncrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedOr8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedOr16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedOr, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedXor8, "ccD*c", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedXor16, "ssD*s", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_InterlockedXor, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES)
|
2016-09-15 05:19:43 +08:00
|
|
|
LANGBUILTIN(__popcnt16, "UsUs", "nc", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(__popcnt, "UiUi", "nc", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(__popcnt64, "ULLiULLi", "nc", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(__readfsdword, "ULiULi", "n", ALL_MS_LANGUAGES)
|
2016-09-09 06:32:19 +08:00
|
|
|
LANGBUILTIN(_rotl8, "UcUcUc", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotl16, "UsUsUc", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotl, "UiUii", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_lrotl, "ULiULii", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotl64, "ULLiULLii", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotr8, "UcUcUc", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotr16, "UsUsUc", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotr, "UiUii", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_lrotr, "ULiULii", "n", ALL_MS_LANGUAGES)
|
|
|
|
LANGBUILTIN(_rotr64, "ULLiULLii", "n", ALL_MS_LANGUAGES)
|
2015-01-29 17:29:17 +08:00
|
|
|
LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
|
2010-04-20 09:31:15 +08:00
|
|
|
|
2015-01-29 17:29:21 +08:00
|
|
|
// Microsoft library builtins.
|
|
|
|
LIBBUILTIN(_setjmpex, "iJ", "fj", "setjmpex.h", ALL_MS_LANGUAGES)
|
|
|
|
|
2009-06-05 03:35:30 +08:00
|
|
|
// C99 library functions
|
|
|
|
// C99 stdlib.h
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(abort, "v", "fr", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES)
|
2009-06-05 03:35:30 +08:00
|
|
|
// C99 string.h
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES)
|
2012-01-17 08:37:07 +08:00
|
|
|
LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES)
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES)
|
2012-01-17 08:37:07 +08:00
|
|
|
LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES)
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(memset, "v*v*iz", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strerror, "c*i", "f", "string.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES)
|
2009-06-05 03:35:30 +08:00
|
|
|
// C99 stdio.h
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES)
|
2012-01-21 05:40:12 +08:00
|
|
|
LIBBUILTIN(scanf, "icC*R.", "fs:0:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fscanf, "iP*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
|
2016-05-05 05:08:13 +08:00
|
|
|
// C99 ctype.h
|
|
|
|
LIBBUILTIN(isalnum, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isalpha, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isblank, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(iscntrl, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isgraph, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(islower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isprint, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ispunct, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isspace, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(isxdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
|
|
|
|
|
2009-07-28 10:25:19 +08:00
|
|
|
// C99
|
2014-04-16 04:27:15 +08:00
|
|
|
// In some systems setjmp is a macro that expands to _setjmp. We undefine
|
|
|
|
// it here to avoid having two identical LIBBUILTIN entries.
|
2013-06-01 00:29:28 +08:00
|
|
|
#undef setjmp
|
|
|
|
LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES)
|
2009-02-14 08:32:47 +08:00
|
|
|
|
2013-06-01 00:29:28 +08:00
|
|
|
// Non-C library functions, active in GNU mode only.
|
2014-04-16 16:06:33 +08:00
|
|
|
// Functions with (returns_twice) attribute (marked as "j") are still active in
|
|
|
|
// all languages, because losing this attribute would result in miscompilation
|
|
|
|
// when these functions are used in non-GNU mode. PR16138.
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_GNU_LANGUAGES)
|
2009-06-05 16:20:10 +08:00
|
|
|
// POSIX string.h
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
2009-06-05 03:35:30 +08:00
|
|
|
// POSIX strings.h
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_GNU_LANGUAGES)
|
2012-05-01 16:38:19 +08:00
|
|
|
// In some systems str[n]casejmp is a macro that expands to _str[n]icmp.
|
|
|
|
// We undefine then here to avoid wrong name.
|
|
|
|
#undef strcasecmp
|
|
|
|
#undef strncasecmp
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_GNU_LANGUAGES)
|
2009-07-28 10:25:19 +08:00
|
|
|
// POSIX unistd.h
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_GNU_LANGUAGES)
|
2014-04-16 16:06:33 +08:00
|
|
|
LIBBUILTIN(vfork, "p", "fj", "unistd.h", ALL_LANGUAGES)
|
2009-07-28 10:25:19 +08:00
|
|
|
// POSIX setjmp.h
|
2011-10-13 03:51:18 +08:00
|
|
|
|
2014-04-16 16:06:33 +08:00
|
|
|
LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES)
|
2013-06-01 00:29:28 +08:00
|
|
|
|
|
|
|
LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
|
2011-08-19 04:55:45 +08:00
|
|
|
// non-standard but very common
|
2013-06-01 00:29:28 +08:00
|
|
|
LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
|
|
|
LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
2010-11-10 05:38:20 +08:00
|
|
|
// id objc_msgSend(id, SEL, ...)
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// long double objc_msgSend_fpret(id self, SEL op, ...)
|
|
|
|
LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG)
|
2011-11-01 00:27:11 +08:00
|
|
|
// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...)
|
|
|
|
LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG)
|
2013-01-05 02:45:40 +08:00
|
|
|
// void objc_msgSend_stret (id, SEL, ...)
|
|
|
|
LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
|
2013-01-05 02:45:40 +08:00
|
|
|
LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
|
2013-01-05 02:45:40 +08:00
|
|
|
LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG)
|
2010-12-01 02:25:34 +08:00
|
|
|
// id objc_getClass(const char *name)
|
|
|
|
LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_getMetaClass(const char *name)
|
|
|
|
LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG)
|
|
|
|
// void objc_enumerationMutation(id)
|
|
|
|
LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG)
|
|
|
|
|
|
|
|
// id objc_read_weak(id *location)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_assign_weak(id value, id *location)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_assign_global(id val, id *dest)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// id objc_assign_strongCast(id val, id *dest
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
|
|
|
|
// id objc_exception_extract(void *localExceptionData)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// void objc_exception_try_enter(void *localExceptionData)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// void objc_exception_try_exit(void *localExceptionData)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// int objc_exception_match(Class exceptionClass, id exception)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// void objc_exception_throw(id exception)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
|
|
|
|
// int objc_sync_enter(id obj)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
// int objc_sync_exit(id obj)
|
2012-01-25 06:29:27 +08:00
|
|
|
LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
|
2010-12-10 08:39:16 +08:00
|
|
|
|
2010-06-17 00:22:04 +08:00
|
|
|
BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
|
2009-04-23 15:00:09 +08:00
|
|
|
|
2012-01-25 06:32:46 +08:00
|
|
|
// void NSLog(NSString *fmt, ...)
|
|
|
|
LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
|
|
|
|
// void NSLogv(NSString *fmt, va_list args)
|
|
|
|
LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
|
|
|
|
|
2009-02-17 06:43:43 +08:00
|
|
|
// Builtin math library functions
|
2013-09-07 07:45:10 +08:00
|
|
|
LIBBUILTIN(atan2, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(atan2f, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(atan2l, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(abs, "ii", "fnc", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(labs, "LiLi", "fnc", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(llabs, "LLiLLi", "fnc", "stdlib.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:45:10 +08:00
|
|
|
LIBBUILTIN(copysign, "ddd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(copysignf, "fff", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(copysignl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(fabs, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2016-09-15 01:34:14 +08:00
|
|
|
LIBBUILTIN(finite, "id", "fnc", "math.h", GNU_LANG)
|
|
|
|
LIBBUILTIN(finitef, "if", "fnc", "math.h", GNU_LANG)
|
|
|
|
LIBBUILTIN(finitel, "iLd", "fnc", "math.h", GNU_LANG)
|
|
|
|
// glibc's math.h generates calls to __finite
|
|
|
|
LIBBUILTIN(__finite, "id", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__finitef, "if", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__finitel, "iLd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(frexp, "ddi*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(frexpf, "ffi*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(frexpl, "LdLdi*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ldexp, "ddi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ldexpf, "ffi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ldexpl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(nan, "dcC*", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nanf, "fcC*", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nanl, "LdcC*", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:45:10 +08:00
|
|
|
LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(powl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(acos, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(acosf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(acosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(acosh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(acoshf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(acoshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(asin, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(asinf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(asinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(asinh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(asinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(asinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(atan, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(atanf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(atanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 06:40:01 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(atanh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cbrt, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cbrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cbrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(ceill, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(cos, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cosf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(cosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 05:45:50 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(cosh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(coshf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(coshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(erf, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(erff, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(erfl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(erfc, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(erfcf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(erfcl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(exp, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(expf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(expl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 06:40:01 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(exp2, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:
- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
These are functions that get inlined by LLVM's optimizer, but only when they
have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
Previously these were only const with -fno-math-errno, but they never set
errno per POSIX.
For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.
llvm-svn: 162375
2012-08-23 02:16:02 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(fdim, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fdimf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fdiml, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(floor, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(floorf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(floorl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 05:45:50 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(fmax, "ddd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fmaxf, "fff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(fmaxl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(fmin, "ddd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(fminf, "fff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(fminl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(hypot, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(hypotf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(hypotl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ilogb, "id", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(lgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(llrintl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(llround, "LLid", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(llroundf, "LLif", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(llroundl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(log, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(logf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(logl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 06:40:01 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(log10, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(log10f, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(log10l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(log1p, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(log1pf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(log1pl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(log2, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(log2f, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(log2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:
- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
These are functions that get inlined by LLVM's optimizer, but only when they
have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
Previously these were only const with -fno-math-errno, but they never set
errno per POSIX.
For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.
llvm-svn: 162375
2012-08-23 02:16:02 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(logb, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(logbf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(logbl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(lrint, "Lid", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lrintf, "Lif", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lrintl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(lround, "Lid", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lroundf, "Lif", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(lroundl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
|
2013-08-09 18:12:30 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(nearbyint, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nearbyintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(nearbyintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:
- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
These are functions that get inlined by LLVM's optimizer, but only when they
have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
Previously these were only const with -fno-math-errno, but they never set
errno per POSIX.
For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.
llvm-svn: 162375
2012-08-23 02:16:02 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(nextafter, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nextafterf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nextafterl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-29 01:41:03 +08:00
|
|
|
LIBBUILTIN(nexttoward, "ddLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(nexttowardf, "ffLd", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(nexttowardl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(remainder, "ddd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(remainderf, "fff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(remainderl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(rint, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(rintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(rintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:
- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
These are functions that get inlined by LLVM's optimizer, but only when they
have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
Previously these were only const with -fno-math-errno, but they never set
errno per POSIX.
For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.
llvm-svn: 162375
2012-08-23 02:16:02 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(round, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(roundf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(roundl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(scalbln, "ddLi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(scalblnf, "ffLi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(scalblnl, "LdLdLi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(scalbn, "ddi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(scalbnf, "ffi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(scalbnl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(sin, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sinf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(sinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2009-06-02 15:06:02 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(sinh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(sqrt, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(sqrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(sqrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2011-07-09 05:39:34 +08:00
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(tan, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tanf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(tanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
2012-04-25 07:06:26 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(tanh, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(tgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(tgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:23:32 +08:00
|
|
|
LIBBUILTIN(trunc, "dd", "fnc", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(truncf, "ff", "fnc", "math.h", ALL_LANGUAGES)
|
2013-09-07 07:23:53 +08:00
|
|
|
LIBBUILTIN(truncl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
|
Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:
- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
These are functions that get inlined by LLVM's optimizer, but only when they
have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
Previously these were only const with -fno-math-errno, but they never set
errno per POSIX.
For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.
llvm-svn: 162375
2012-08-23 02:16:02 +08:00
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(cabs, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cabsf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cabsl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cacos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cacosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cacosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cacosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cacoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cacoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(carg, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cargf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cargl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(casin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(casinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(casinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(casinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(casinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(casinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(catan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(catanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(catanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(catanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(catanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(catanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ccos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ccosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ccosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ccosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ccoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ccoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cexp, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cexpf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cexpl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:45:10 +08:00
|
|
|
LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(conj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(conjf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(conjl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(clog, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(clogf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(clogl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cproj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cprojf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cprojl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(cpow, "XdXdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cpowf, "XfXfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(cpowl, "XLdXLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-07 07:45:10 +08:00
|
|
|
LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
2013-09-18 14:19:40 +08:00
|
|
|
LIBBUILTIN(csin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(csinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(csqrt, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csqrtf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(csqrtl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ctan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ctanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ctanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(ctanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ctanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(ctanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
|
|
|
|
|
2014-01-15 03:26:03 +08:00
|
|
|
// __sinpi and friends are OS X specific library functions, but otherwise much
|
|
|
|
// like the standard (non-complex) sin (etc).
|
|
|
|
LIBBUILTIN(__sinpi, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__sinpif, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(__cospi, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__cospif, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
|
|
|
// Similarly, __exp10 is OS X only
|
|
|
|
LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES)
|
|
|
|
|
2010-07-16 08:00:19 +08:00
|
|
|
// Blocks runtime Builtin math library functions
|
2010-12-01 01:35:24 +08:00
|
|
|
LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
|
|
|
|
LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
|
2010-07-16 08:00:19 +08:00
|
|
|
// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
|
|
|
|
|
2011-09-10 06:41:49 +08:00
|
|
|
// Annotation function
|
2012-04-29 01:39:16 +08:00
|
|
|
BUILTIN(__builtin_annotation, "v.", "tn")
|
2011-09-10 06:41:49 +08:00
|
|
|
|
2014-09-08 06:58:14 +08:00
|
|
|
// Invariants
|
|
|
|
BUILTIN(__builtin_assume, "vb", "n")
|
|
|
|
|
2013-01-13 10:22:39 +08:00
|
|
|
// Multiprecision Arithmetic Builtins.
|
2013-06-19 04:40:40 +08:00
|
|
|
BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n")
|
2013-01-13 10:22:39 +08:00
|
|
|
BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n")
|
|
|
|
BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n")
|
|
|
|
BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n")
|
|
|
|
BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n")
|
2013-06-19 04:40:40 +08:00
|
|
|
BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n")
|
2013-01-15 05:44:30 +08:00
|
|
|
BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n")
|
|
|
|
BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n")
|
|
|
|
BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n")
|
|
|
|
BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n")
|
2013-01-13 10:22:39 +08:00
|
|
|
|
2013-06-21 07:28:10 +08:00
|
|
|
// Checked Arithmetic Builtins for Security.
|
2015-10-30 04:48:01 +08:00
|
|
|
BUILTIN(__builtin_add_overflow, "v.", "nt")
|
|
|
|
BUILTIN(__builtin_sub_overflow, "v.", "nt")
|
|
|
|
BUILTIN(__builtin_mul_overflow, "v.", "nt")
|
2013-06-21 07:28:10 +08:00
|
|
|
BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "n")
|
|
|
|
BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "n")
|
|
|
|
BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "n")
|
|
|
|
BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "n")
|
|
|
|
BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "n")
|
|
|
|
BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "n")
|
|
|
|
BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "n")
|
|
|
|
BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "n")
|
|
|
|
BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "n")
|
|
|
|
BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "n")
|
|
|
|
BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "n")
|
|
|
|
BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "n")
|
|
|
|
BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "n")
|
|
|
|
BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "n")
|
|
|
|
BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "n")
|
|
|
|
BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "n")
|
|
|
|
BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "n")
|
|
|
|
BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "n")
|
|
|
|
|
2013-07-11 10:27:57 +08:00
|
|
|
// Clang builtins (not available in GCC).
|
|
|
|
BUILTIN(__builtin_addressof, "v*v&", "nct")
|
2014-06-04 07:27:44 +08:00
|
|
|
BUILTIN(__builtin_operator_new, "v*z", "c")
|
|
|
|
BUILTIN(__builtin_operator_delete, "vv*", "n")
|
2013-07-11 10:27:57 +08:00
|
|
|
|
2015-06-16 05:08:13 +08:00
|
|
|
// Safestack builtins
|
|
|
|
BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
|
|
|
|
BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn")
|
|
|
|
|
2015-09-09 07:52:33 +08:00
|
|
|
// Nontemporal loads/stores builtins
|
|
|
|
BUILTIN(__builtin_nontemporal_store, "v.", "t")
|
|
|
|
BUILTIN(__builtin_nontemporal_load, "v.", "t")
|
|
|
|
|
2016-01-26 12:03:48 +08:00
|
|
|
// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
|
|
|
|
// We need the generic prototype, since the packet type could be anything.
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
|
2016-01-26 12:03:48 +08:00
|
|
|
|
2016-07-05 19:31:24 +08:00
|
|
|
// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
|
|
|
|
// Custom builtin check allows to perform special check of passed block arguments.
|
|
|
|
LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(get_kernel_work_group_size, "i.", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "i.", "tn", OCLC20_LANG)
|
|
|
|
|
2016-05-21 03:54:38 +08:00
|
|
|
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
|
2016-07-05 00:07:18 +08:00
|
|
|
LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
|
|
|
|
LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
|
2016-05-21 03:54:38 +08:00
|
|
|
|
2007-01-28 16:20:04 +08:00
|
|
|
#undef BUILTIN
|
2009-02-15 04:49:29 +08:00
|
|
|
#undef LIBBUILTIN
|
2013-11-14 06:47:22 +08:00
|
|
|
#undef LANGBUILTIN
|