1 /* This file contains the definitions and documentation for the
2 builtins used in the GNU compiler.
3 Copyright (C
) 2000, 2001, 2002, 2003 Free Software Foundation
, Inc.
5 This file is part of GCC.
7 GCC is free software
; you can redistribute it and
/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation
; either version
2, or (at your option
) any later
12 GCC is distributed in the hope that it will be useful
, but WITHOUT ANY
13 WARRANTY
; without even the implied warranty of MERCHANTABILITY or
14 FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC
; see the file COPYING. If not
, write to the Free
19 Software Foundation
, 59 Temple Place
- Suite
330, Boston
, MA
22 /* Before including this file
, you should define a macro
:
24 DEF_BUILTIN (ENUM
, NAME
, CLASS
, TYPE, LIBTYPE
, BOTH_P
,
25 FALLBACK_P
, NONANSI_P
, ATTRS
, IMPLICIT
)
27 This macro will be called once for each builtin function. The
28 ENUM will be of type `enum built_in_function
', and will indicate
29 which builtin function is being processed. The NAME of the builtin
30 function (which will always start with `__builtin_') is a string
31 literal. The CLASS is of type `enum built_in_class
' and indicates
32 what kind of builtin is being processed.
34 Some builtins are actually two separate functions. For example,
35 for `strcmp' there are two builtin functions
; `__builtin_strcmp
'
36 and `strcmp' itself. Both behave identically. Other builtins
37 define only the `__builtin
' variant. If BOTH_P is TRUE, then this
38 builtin has both variants; otherwise, it is has only the first
41 TYPE indicates the type of the function. The symbols correspond to
42 enumerals from builtin-types.def. If BOTH_P is true, then LIBTYPE
43 is the type of the non-`__builtin_' variant. Otherwise
, LIBTYPE
46 If FALLBACK_P is true then
, if for some reason
, the compiler cannot
47 expand the builtin function directly
, it will call the
48 corresponding library
function (which does not have the
51 If NONANSI_P is true, then the non-`__builtin_' variant is not an
52 ANSI
/ISO library function
, and so we should pretend it does not
53 exist when compiling in ANSI conformant mode.
55 ATTRs is an attribute list as defined in builtin
-attrs.def that
56 describes the attributes of this builtin function.
58 IMPLICIT specifies condition when the builtin can be produced by
59 compiler. For instance C90 reserves floorf function
, but does not
60 define it
's meaning. When user uses floorf we may assume that the
61 floorf has the meaning we expect, but we can't produce floorf by
62 simplifying
floor((double
)float
) since the runtime need not implement
65 /* A GCC
builtin (like __builtin_saveregs
) is provided by the
66 compiler
, but does not correspond to a function in the standard
68 #undef DEF_GCC_BUILTIN
69 #define
DEF_GCC_BUILTIN(ENUM
, NAME
, TYPE, ATTRS
) \
70 DEF_BUILTIN (ENUM
, NAME
, BUILT_IN_NORMAL
, TYPE, BT_LAST
, \
71 false
, false
, false
, ATTRS
, true
)
74 /* A fallback builtin is a
builtin (like __builtin_puts
) that falls
75 back to the corresopnding library function if necessary
-- but
76 for which we should not introduce the non
-`__builtin
' variant of
78 #undef DEF_FALLBACK_BUILTIN
79 #define DEF_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
80 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
81 false, true, false, ATTRS, true)
83 /* Like DEF_FALLBACK_BUILTIN, except that the function is not one that
84 is specified by ANSI/ISO C. So, when we're being fully conformant
85 we ignore the version of these builtins that does not begin with
87 #undef DEF_EXT_FALLBACK_BUILTIN
88 #define
DEF_EXT_FALLBACK_BUILTIN(ENUM
, NAME
, TYPE, ATTRS
) \
89 DEF_BUILTIN (ENUM
, NAME
, BUILT_IN_NORMAL
, TYPE, TYPE, \
90 false
, true
, true
, ATTRS
, true
)
92 /* A library
builtin (like __builtin_strchr
) is a builtin equivalent
93 of an ANSI
/ISO standard library function. In addition to the
94 `__builtin
' version, we will create an ordinary version (e.g,
95 `strchr') as well. If we cannot compute the answer using the
96 builtin function
, we will fall back to the standard library
98 #undef DEF_LIB_BUILTIN
99 #define
DEF_LIB_BUILTIN(ENUM
, NAME
, TYPE, ATTRS
) \
100 DEF_BUILTIN (ENUM
, NAME
, BUILT_IN_NORMAL
, TYPE, TYPE, \
101 true
, true
, false
, ATTRS
, true
)
103 /* Like DEF_LIB_BUILTIN
, except that the function is not one that is
104 specified by ANSI
/ISO C. So
, when we
're being fully conformant we
105 ignore the version of these builtins that does not begin with
107 #undef DEF_EXT_LIB_BUILTIN
108 #define DEF_EXT_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
109 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
110 true, true, true, ATTRS, false)
112 /* Like DEF_LIB_BUILTIN, except that the function is only a part of
113 the standard in C99 or above. */
114 #undef DEF_C99_BUILTIN
115 #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
116 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
117 true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
119 /* Builtin that is specified by C99 and C90 reserve the name for future use.
120 We can still recognize the builtin in C90 mode but we can't produce it
122 #undef DEF_C99_C90RES_BUILTIN
123 #define
DEF_C99_C90RES_BUILTIN(ENUM
, NAME
, TYPE, ATTRS
) \
124 DEF_BUILTIN (ENUM
, NAME
, BUILT_IN_NORMAL
, TYPE, TYPE, \
125 true
, true
, !flag_isoc99
, ATTRS
, TARGET_C99_FUNCTIONS
)
127 /* Like DEF_LIB_BUILTIN
, except that the function is expanded in the
129 #undef DEF_FRONT_END_LIB_BUILTIN
130 #define
DEF_FRONT_END_LIB_BUILTIN(ENUM
, NAME
, TYPE, ATTRS
) \
131 DEF_BUILTIN (ENUM
, NAME
, BUILT_IN_FRONTEND
, TYPE, TYPE, \
132 true
, true
, false
, ATTRS
, true
)
134 /* Like DEF_FRONT_END_LIB_BUILTIN
, except that the function is not one
135 that is specified by ANSI
/ISO C. So
, when we
're being fully
136 conformant we ignore the version of these builtins that does not
137 begin with __builtin. */
138 #undef DEF_EXT_FRONT_END_LIB_BUILTIN
139 #define DEF_EXT_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
140 DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
141 true, true, true, ATTRS, true)
143 /* If SMALL_STACK is defined, then `alloca' is only defined in its
146 DEF_FALLBACK_BUILTIN(BUILT_IN_ALLOCA,
149 ATTR_MALLOC_NOTHROW_LIST)
151 DEF_EXT_LIB_BUILTIN(BUILT_IN_ALLOCA,
154 ATTR_MALLOC_NOTHROW_LIST)
157 DEF_LIB_BUILTIN(BUILT_IN_ABS,
160 ATTR_CONST_NOTHROW_LIST)
161 DEF_LIB_BUILTIN(BUILT_IN_LABS,
164 ATTR_CONST_NOTHROW_LIST)
166 DEF_LIB_BUILTIN(BUILT_IN_FABS,
169 ATTR_CONST_NOTHROW_LIST)
170 DEF_C99_C90RES_BUILTIN(BUILT_IN_FABSF,
173 ATTR_CONST_NOTHROW_LIST)
174 DEF_C99_C90RES_BUILTIN(BUILT_IN_FABSL,
176 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
177 ATTR_CONST_NOTHROW_LIST)
179 DEF_LIB_BUILTIN(BUILT_IN_FLOOR,
182 ATTR_CONST_NOTHROW_LIST)
183 DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORF,
186 ATTR_CONST_NOTHROW_LIST)
187 DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORL,
189 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
190 ATTR_CONST_NOTHROW_LIST)
192 DEF_LIB_BUILTIN(BUILT_IN_CEIL,
195 ATTR_CONST_NOTHROW_LIST)
196 DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILF,
199 ATTR_CONST_NOTHROW_LIST)
200 DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILL,
202 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
203 ATTR_CONST_NOTHROW_LIST)
205 DEF_C99_BUILTIN(BUILT_IN_ROUND,
208 ATTR_CONST_NOTHROW_LIST)
209 DEF_C99_BUILTIN(BUILT_IN_ROUNDF,
212 ATTR_CONST_NOTHROW_LIST)
213 DEF_C99_BUILTIN(BUILT_IN_ROUNDL,
215 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
216 ATTR_CONST_NOTHROW_LIST)
218 DEF_C99_BUILTIN(BUILT_IN_TRUNC,
221 ATTR_CONST_NOTHROW_LIST)
222 DEF_C99_BUILTIN(BUILT_IN_TRUNCF,
225 ATTR_CONST_NOTHROW_LIST)
226 DEF_C99_BUILTIN(BUILT_IN_TRUNCL,
228 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
229 ATTR_CONST_NOTHROW_LIST)
231 DEF_C99_BUILTIN(BUILT_IN_NEARBYINT,
232 "__builtin_nearbyint",
234 ATTR_CONST_NOTHROW_LIST)
235 DEF_C99_BUILTIN(BUILT_IN_NEARBYINTF,
236 "__builtin_nearbyintf",
238 ATTR_CONST_NOTHROW_LIST)
239 DEF_C99_BUILTIN(BUILT_IN_NEARBYINTL,
240 "__builtin_nearbyintl",
241 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
242 ATTR_CONST_NOTHROW_LIST)
244 DEF_C99_BUILTIN(BUILT_IN_LLABS,
246 BT_FN_LONGLONG_LONGLONG,
247 ATTR_CONST_NOTHROW_LIST)
248 DEF_C99_BUILTIN(BUILT_IN_IMAXABS,
251 ATTR_CONST_NOTHROW_LIST)
252 DEF_C99_BUILTIN(BUILT_IN_CONJ,
254 BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
255 ATTR_CONST_NOTHROW_LIST)
256 DEF_C99_BUILTIN(BUILT_IN_CONJF,
258 BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT,
259 ATTR_CONST_NOTHROW_LIST)
260 DEF_C99_BUILTIN(BUILT_IN_CONJL,
262 BT_FN_COMPLEX_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
263 ATTR_CONST_NOTHROW_LIST)
264 DEF_C99_BUILTIN(BUILT_IN_CREAL,
266 BT_FN_DOUBLE_COMPLEX_DOUBLE,
267 ATTR_CONST_NOTHROW_LIST)
268 DEF_C99_BUILTIN(BUILT_IN_CREALF,
270 BT_FN_FLOAT_COMPLEX_FLOAT,
271 ATTR_CONST_NOTHROW_LIST)
272 DEF_C99_BUILTIN(BUILT_IN_CREALL,
274 BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
275 ATTR_CONST_NOTHROW_LIST)
276 DEF_C99_BUILTIN(BUILT_IN_CIMAG,
278 BT_FN_DOUBLE_COMPLEX_DOUBLE,
279 ATTR_CONST_NOTHROW_LIST)
280 DEF_C99_BUILTIN(BUILT_IN_CIMAGF,
282 BT_FN_FLOAT_COMPLEX_FLOAT,
283 ATTR_CONST_NOTHROW_LIST)
284 DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
286 BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
287 ATTR_CONST_NOTHROW_LIST)
289 /* The system prototypes for `bzero', 'bcopy' and `bcmp
' functions
290 have many variations, so don't specify parameters to avoid
291 conflicts. The expand_
* functions check the argument types anyway.
292 In addition
, these functions have traditionally accepted NULL
293 pointers when the length parameter is zero
, so don
't apply
294 attribute "nonnull". */
295 DEF_BUILTIN (BUILT_IN_BZERO,
301 ATTR_NOTHROW_LIST, false)
302 DEF_BUILTIN (BUILT_IN_BCOPY,
305 BT_FN_VOID_CONST_PTR_PTR_SIZE,
308 ATTR_NOTHROW_LIST, false)
309 DEF_BUILTIN (BUILT_IN_BCMP,
312 BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
315 ATTR_PURE_NOTHROW_LIST, false)
317 DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
320 ATTR_CONST_NOTHROW_LIST)
321 DEF_GCC_BUILTIN(BUILT_IN_CLZ,
324 ATTR_CONST_NOTHROW_LIST)
325 DEF_GCC_BUILTIN(BUILT_IN_CTZ,
328 ATTR_CONST_NOTHROW_LIST)
329 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNT,
330 "__builtin_popcount",
332 ATTR_CONST_NOTHROW_LIST)
333 DEF_GCC_BUILTIN(BUILT_IN_PARITY,
336 ATTR_CONST_NOTHROW_LIST)
338 DEF_GCC_BUILTIN(BUILT_IN_FFSL,
341 ATTR_CONST_NOTHROW_LIST)
342 DEF_GCC_BUILTIN(BUILT_IN_CLZL,
345 ATTR_CONST_NOTHROW_LIST)
346 DEF_GCC_BUILTIN(BUILT_IN_CTZL,
349 ATTR_CONST_NOTHROW_LIST)
350 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNTL,
351 "__builtin_popcountl",
353 ATTR_CONST_NOTHROW_LIST)
354 DEF_GCC_BUILTIN(BUILT_IN_PARITYL,
357 ATTR_CONST_NOTHROW_LIST)
359 DEF_EXT_LIB_BUILTIN(BUILT_IN_FFSLL,
362 ATTR_CONST_NOTHROW_LIST)
363 DEF_GCC_BUILTIN(BUILT_IN_CLZLL,
366 ATTR_CONST_NOTHROW_LIST)
367 DEF_GCC_BUILTIN(BUILT_IN_CTZLL,
370 ATTR_CONST_NOTHROW_LIST)
371 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNTLL,
372 "__builtin_popcountll",
374 ATTR_CONST_NOTHROW_LIST)
375 DEF_GCC_BUILTIN(BUILT_IN_PARITYLL,
376 "__builtin_parityll",
378 ATTR_CONST_NOTHROW_LIST)
380 DEF_EXT_LIB_BUILTIN(BUILT_IN_INDEX,
382 BT_FN_STRING_CONST_STRING_INT,
383 ATTR_PURE_NOTHROW_NONNULL_1)
384 DEF_EXT_LIB_BUILTIN(BUILT_IN_RINDEX,
386 BT_FN_STRING_CONST_STRING_INT,
387 ATTR_PURE_NOTHROW_NONNULL_1)
389 DEF_LIB_BUILTIN(BUILT_IN_MEMCPY,
391 BT_FN_PTR_PTR_CONST_PTR_SIZE,
392 ATTR_NOTHROW_NONNULL_1_2)
393 DEF_LIB_BUILTIN(BUILT_IN_MEMMOVE,
395 BT_FN_PTR_PTR_CONST_PTR_SIZE,
396 ATTR_NOTHROW_NONNULL_1_2)
397 DEF_LIB_BUILTIN(BUILT_IN_MEMCMP,
399 BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
400 ATTR_PURE_NOTHROW_NONNULL_1_2)
401 DEF_LIB_BUILTIN(BUILT_IN_MEMSET,
403 BT_FN_PTR_PTR_INT_SIZE,
404 ATTR_NOTHROW_NONNULL_1)
405 DEF_EXT_LIB_BUILTIN(BUILT_IN_MEMPCPY,
407 BT_FN_PTR_PTR_CONST_PTR_SIZE,
408 ATTR_NOTHROW_NONNULL_1_2)
410 DEF_LIB_BUILTIN(BUILT_IN_STRCAT,
412 BT_FN_STRING_STRING_CONST_STRING,
413 ATTR_NOTHROW_NONNULL_1_2)
414 DEF_LIB_BUILTIN(BUILT_IN_STRNCAT,
416 BT_FN_STRING_STRING_CONST_STRING_SIZE,
417 ATTR_NOTHROW_NONNULL_1_2)
418 DEF_EXT_LIB_BUILTIN(BUILT_IN_STPCPY,
420 BT_FN_STRING_STRING_CONST_STRING,
421 ATTR_NOTHROW_NONNULL_1_2)
422 DEF_LIB_BUILTIN(BUILT_IN_STRCPY,
424 BT_FN_STRING_STRING_CONST_STRING,
425 ATTR_NOTHROW_NONNULL_1_2)
426 DEF_LIB_BUILTIN(BUILT_IN_STRNCPY,
428 BT_FN_STRING_STRING_CONST_STRING_SIZE,
429 ATTR_NOTHROW_NONNULL_1_2)
430 DEF_LIB_BUILTIN(BUILT_IN_STRCMP,
432 BT_FN_INT_CONST_STRING_CONST_STRING,
433 ATTR_PURE_NOTHROW_NONNULL_1_2)
434 DEF_LIB_BUILTIN(BUILT_IN_STRNCMP,
436 BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
437 ATTR_PURE_NOTHROW_NONNULL_1_2)
438 DEF_LIB_BUILTIN(BUILT_IN_STRLEN,
440 BT_FN_SIZE_CONST_STRING,
441 ATTR_PURE_NOTHROW_NONNULL_1)
442 DEF_LIB_BUILTIN(BUILT_IN_STRSTR,
444 BT_FN_STRING_CONST_STRING_CONST_STRING,
445 ATTR_PURE_NOTHROW_NONNULL_1_2)
446 DEF_LIB_BUILTIN(BUILT_IN_STRPBRK,
448 BT_FN_STRING_CONST_STRING_CONST_STRING,
449 ATTR_PURE_NOTHROW_NONNULL_1_2)
450 DEF_LIB_BUILTIN(BUILT_IN_STRSPN,
452 BT_FN_SIZE_CONST_STRING_CONST_STRING,
453 ATTR_PURE_NOTHROW_NONNULL_1_2)
454 DEF_LIB_BUILTIN(BUILT_IN_STRCSPN,
456 BT_FN_SIZE_CONST_STRING_CONST_STRING,
457 ATTR_PURE_NOTHROW_NONNULL_1_2)
458 DEF_LIB_BUILTIN(BUILT_IN_STRCHR,
460 BT_FN_STRING_CONST_STRING_INT,
461 ATTR_PURE_NOTHROW_NONNULL_1)
462 DEF_LIB_BUILTIN(BUILT_IN_STRRCHR,
464 BT_FN_STRING_CONST_STRING_INT,
465 ATTR_PURE_NOTHROW_NONNULL_1)
467 DEF_LIB_BUILTIN(BUILT_IN_SQRT,
470 flag_errno_math ? ATTR_NOTHROW_LIST
471 : (flag_unsafe_math_optimizations
472 ? ATTR_CONST_NOTHROW_LIST
473 : ATTR_PURE_NOTHROW_LIST))
474 DEF_LIB_BUILTIN(BUILT_IN_SIN,
477 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
478 : ATTR_PURE_NOTHROW_LIST)
479 DEF_LIB_BUILTIN(BUILT_IN_COS,
482 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
483 : ATTR_PURE_NOTHROW_LIST)
484 DEF_LIB_BUILTIN(BUILT_IN_EXP,
487 flag_errno_math ? ATTR_NOTHROW_LIST
488 : (flag_unsafe_math_optimizations
489 ? ATTR_CONST_NOTHROW_LIST
490 : ATTR_PURE_NOTHROW_LIST))
491 DEF_LIB_BUILTIN(BUILT_IN_LOG,
494 flag_errno_math ? ATTR_NOTHROW_LIST
495 : (flag_unsafe_math_optimizations
496 ? ATTR_CONST_NOTHROW_LIST
497 : ATTR_PURE_NOTHROW_LIST))
498 DEF_LIB_BUILTIN(BUILT_IN_POW,
500 BT_FN_DOUBLE_DOUBLE_DOUBLE,
501 flag_errno_math ? ATTR_NOTHROW_LIST
502 : (flag_unsafe_math_optimizations
503 ? ATTR_CONST_NOTHROW_LIST
504 : ATTR_PURE_NOTHROW_LIST))
505 DEF_LIB_BUILTIN(BUILT_IN_ATAN2,
507 BT_FN_DOUBLE_DOUBLE_DOUBLE,
508 flag_errno_math ? ATTR_NOTHROW_LIST
509 : (flag_unsafe_math_optimizations
510 ? ATTR_CONST_NOTHROW_LIST
511 : ATTR_PURE_NOTHROW_LIST))
512 DEF_LIB_BUILTIN(BUILT_IN_FMOD,
514 BT_FN_DOUBLE_DOUBLE_DOUBLE,
515 flag_errno_math ? ATTR_NOTHROW_LIST
516 : (flag_unsafe_math_optimizations
517 ? ATTR_CONST_NOTHROW_LIST
518 : ATTR_PURE_NOTHROW_LIST))
519 DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
522 flag_errno_math ? ATTR_NOTHROW_LIST
523 : (flag_unsafe_math_optimizations
524 ? ATTR_CONST_NOTHROW_LIST
525 : ATTR_PURE_NOTHROW_LIST))
526 DEF_C99_C90RES_BUILTIN(BUILT_IN_SINF,
529 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
530 : ATTR_PURE_NOTHROW_LIST)
531 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSF,
534 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
535 : ATTR_PURE_NOTHROW_LIST)
536 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPF,
539 flag_errno_math ? ATTR_NOTHROW_LIST
540 : (flag_unsafe_math_optimizations
541 ? ATTR_CONST_NOTHROW_LIST
542 : ATTR_PURE_NOTHROW_LIST))
543 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF,
546 flag_errno_math ? ATTR_NOTHROW_LIST
547 : (flag_unsafe_math_optimizations
548 ? ATTR_CONST_NOTHROW_LIST
549 : ATTR_PURE_NOTHROW_LIST))
550 DEF_C99_C90RES_BUILTIN(BUILT_IN_POWF,
552 BT_FN_FLOAT_FLOAT_FLOAT,
553 flag_errno_math ? ATTR_NOTHROW_LIST
554 : (flag_unsafe_math_optimizations
555 ? ATTR_CONST_NOTHROW_LIST
556 : ATTR_PURE_NOTHROW_LIST))
557 DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2F,
559 BT_FN_FLOAT_FLOAT_FLOAT,
560 flag_errno_math ? ATTR_NOTHROW_LIST
561 : (flag_unsafe_math_optimizations
562 ? ATTR_CONST_NOTHROW_LIST
563 : ATTR_PURE_NOTHROW_LIST))
564 DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODF,
566 BT_FN_FLOAT_FLOAT_FLOAT,
567 flag_errno_math ? ATTR_NOTHROW_LIST
568 : (flag_unsafe_math_optimizations
569 ? ATTR_CONST_NOTHROW_LIST
570 : ATTR_PURE_NOTHROW_LIST))
571 DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
573 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
574 flag_errno_math ? ATTR_NOTHROW_LIST
575 : (flag_unsafe_math_optimizations
576 ? ATTR_CONST_NOTHROW_LIST
577 : ATTR_PURE_NOTHROW_LIST))
578 DEF_C99_C90RES_BUILTIN(BUILT_IN_SINL,
580 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
581 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
582 : ATTR_PURE_NOTHROW_LIST)
583 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSL,
585 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
586 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
587 : ATTR_PURE_NOTHROW_LIST)
588 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPL,
590 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
591 flag_errno_math ? ATTR_NOTHROW_LIST
592 : (flag_unsafe_math_optimizations
593 ? ATTR_CONST_NOTHROW_LIST
594 : ATTR_PURE_NOTHROW_LIST))
595 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL,
597 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
598 flag_errno_math ? ATTR_NOTHROW_LIST
599 : (flag_unsafe_math_optimizations
600 ? ATTR_CONST_NOTHROW_LIST
601 : ATTR_PURE_NOTHROW_LIST))
602 DEF_C99_C90RES_BUILTIN(BUILT_IN_POWL,
604 BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
605 flag_errno_math ? ATTR_NOTHROW_LIST
606 : (flag_unsafe_math_optimizations
607 ? ATTR_CONST_NOTHROW_LIST
608 : ATTR_PURE_NOTHROW_LIST))
609 DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2L,
611 BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
612 flag_errno_math ? ATTR_NOTHROW_LIST
613 : (flag_unsafe_math_optimizations
614 ? ATTR_CONST_NOTHROW_LIST
615 : ATTR_PURE_NOTHROW_LIST))
616 DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODL,
618 BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
619 flag_errno_math ? ATTR_NOTHROW_LIST
620 : (flag_unsafe_math_optimizations
621 ? ATTR_CONST_NOTHROW_LIST
622 : ATTR_PURE_NOTHROW_LIST))
624 DEF_GCC_BUILTIN(BUILT_IN_INF,
627 ATTR_CONST_NOTHROW_LIST)
628 DEF_GCC_BUILTIN(BUILT_IN_INFF,
631 ATTR_CONST_NOTHROW_LIST)
632 DEF_GCC_BUILTIN(BUILT_IN_INFL,
635 ATTR_CONST_NOTHROW_LIST)
637 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VAL,
638 "__builtin_huge_val",
640 ATTR_CONST_NOTHROW_LIST)
641 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALF,
642 "__builtin_huge_valf",
644 ATTR_CONST_NOTHROW_LIST)
645 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALL,
646 "__builtin_huge_vall",
648 ATTR_CONST_NOTHROW_LIST)
650 DEF_LIB_BUILTIN(BUILT_IN_NAN,
652 BT_FN_DOUBLE_CONST_STRING,
653 ATTR_CONST_NOTHROW_NONNULL_1)
654 DEF_LIB_BUILTIN(BUILT_IN_NANF,
656 BT_FN_FLOAT_CONST_STRING,
657 ATTR_CONST_NOTHROW_NONNULL_1)
658 DEF_LIB_BUILTIN(BUILT_IN_NANL,
660 BT_FN_LONG_DOUBLE_CONST_STRING,
661 ATTR_CONST_NOTHROW_NONNULL_1)
663 DEF_LIB_BUILTIN(BUILT_IN_NANS,
665 BT_FN_DOUBLE_CONST_STRING,
666 ATTR_CONST_NOTHROW_NONNULL_1)
667 DEF_LIB_BUILTIN(BUILT_IN_NANSF,
669 BT_FN_FLOAT_CONST_STRING,
670 ATTR_CONST_NOTHROW_NONNULL_1)
671 DEF_LIB_BUILTIN(BUILT_IN_NANSL,
673 BT_FN_LONG_DOUBLE_CONST_STRING,
674 ATTR_CONST_NOTHROW_NONNULL_1)
676 DEF_GCC_BUILTIN(BUILT_IN_SAVEREGS,
677 "__builtin_saveregs",
680 DEF_GCC_BUILTIN(BUILT_IN_CLASSIFY_TYPE,
681 "__builtin_classify_type",
684 DEF_GCC_BUILTIN(BUILT_IN_NEXT_ARG,
685 "__builtin_next_arg",
688 DEF_GCC_BUILTIN(BUILT_IN_ARGS_INFO,
689 "__builtin_args_info",
692 DEF_GCC_BUILTIN(BUILT_IN_CONSTANT_P,
693 "__builtin_constant_p",
695 ATTR_CONST_NOTHROW_LIST)
696 DEF_GCC_BUILTIN(BUILT_IN_FRAME_ADDRESS,
697 "__builtin_frame_address",
700 DEF_GCC_BUILTIN(BUILT_IN_RETURN_ADDRESS,
701 "__builtin_return_address",
704 DEF_GCC_BUILTIN(BUILT_IN_AGGREGATE_INCOMING_ADDRESS,
705 "__builtin_aggregate_incoming_address",
708 DEF_GCC_BUILTIN(BUILT_IN_APPLY_ARGS,
709 "__builtin_apply_args",
712 DEF_GCC_BUILTIN(BUILT_IN_APPLY,
714 BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
716 DEF_GCC_BUILTIN(BUILT_IN_RETURN,
719 ATTR_NORETURN_NOTHROW_LIST)
720 DEF_GCC_BUILTIN(BUILT_IN_SETJMP,
724 DEF_GCC_BUILTIN(BUILT_IN_LONGJMP,
727 ATTR_NORETURN_NOTHROW_LIST)
728 DEF_GCC_BUILTIN(BUILT_IN_TRAP,
731 ATTR_NORETURN_NOTHROW_LIST)
732 DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
733 "__builtin_prefetch",
734 BT_FN_VOID_CONST_PTR_VAR,
737 /* stdio.h builtins (without FILE *). */
739 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF,
741 BT_FN_INT_CONST_STRING_VAR,
742 ATTR_FORMAT_PRINTF_1_2)
743 DEF_LIB_BUILTIN(BUILT_IN_PUTCHAR,
747 DEF_LIB_BUILTIN(BUILT_IN_PUTS,
749 BT_FN_INT_CONST_STRING,
750 ATTR_NOTHROW_NONNULL_1)
751 DEF_C99_BUILTIN(BUILT_IN_SNPRINTF,
752 "__builtin_snprintf",
753 BT_FN_INT_STRING_SIZE_CONST_STRING_VAR,
754 ATTR_FORMAT_PRINTF_3_4)
755 DEF_LIB_BUILTIN(BUILT_IN_SPRINTF,
757 BT_FN_INT_STRING_CONST_STRING_VAR,
758 ATTR_FORMAT_PRINTF_2_3)
759 DEF_LIB_BUILTIN(BUILT_IN_SCANF,
761 BT_FN_INT_CONST_STRING_VAR,
762 ATTR_FORMAT_SCANF_1_2)
763 DEF_LIB_BUILTIN(BUILT_IN_SSCANF,
765 BT_FN_INT_CONST_STRING_CONST_STRING_VAR,
766 ATTR_FORMAT_SCANF_2_3)
767 DEF_LIB_BUILTIN(BUILT_IN_VPRINTF,
769 BT_FN_INT_CONST_STRING_VALIST_ARG,
770 ATTR_FORMAT_PRINTF_1_0)
771 DEF_C99_BUILTIN(BUILT_IN_VSCANF,
773 BT_FN_INT_CONST_STRING_VALIST_ARG,
774 ATTR_FORMAT_SCANF_1_0)
775 DEF_C99_BUILTIN(BUILT_IN_VSSCANF,
777 BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG,
778 ATTR_FORMAT_SCANF_2_0)
779 DEF_C99_BUILTIN(BUILT_IN_VSNPRINTF,
780 "__builtin_vsnprintf",
781 BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG,
782 ATTR_FORMAT_PRINTF_3_0)
783 DEF_LIB_BUILTIN(BUILT_IN_VSPRINTF,
784 "__builtin_vsprintf",
785 BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
786 ATTR_FORMAT_PRINTF_2_0)
789 /* stdio.h builtins (with FILE *). */
791 /* Declare the __builtin_ style with arguments and the regular style
792 without them. We rely on stdio.h to supply the arguments for the
793 regular style declaration since we had to use void* instead of
794 FILE* in the __builtin_ prototype supplied here. */
796 DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
799 ATTR_NOTHROW_NONNULL_2)
800 DEF_BUILTIN (BUILT_IN_FPUTS,
803 BT_FN_INT_CONST_STRING_PTR,
805 true, true, false, ATTR_NOTHROW_NONNULL_1_2, true)
806 DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
808 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
809 ATTR_NOTHROW_NONNULL_1_4)
810 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
812 BT_FN_INT_PTR_CONST_STRING_VAR,
813 ATTR_FORMAT_PRINTF_2_3)
815 /* stdio unlocked builtins (without FILE *). */
817 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
818 "__builtin_putchar_unlocked",
819 BT_FN_INT_INT, ATTR_NOTHROW_LIST)
820 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
821 "__builtin_puts_unlocked",
822 BT_FN_INT_CONST_STRING, ATTR_NOTHROW_NONNULL_1)
823 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
824 "__builtin_printf_unlocked",
825 BT_FN_INT_CONST_STRING_VAR,
826 ATTR_FORMAT_PRINTF_1_2)
828 /* stdio unlocked builtins (with FILE *). */
830 /* Declare the __builtin_ style with arguments and the regular style
831 without them. We rely on stdio.h to supply the arguments for the
832 regular style declaration since we had to use void* instead of
833 FILE* in the __builtin_ prototype supplied here. */
835 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
836 "__builtin_fputc_unlocked",
837 BT_FN_INT_INT_PTR, ATTR_NOTHROW_NONNULL_2)
838 DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
839 "__builtin_fputs_unlocked",
841 BT_FN_INT_CONST_STRING_PTR,
843 true, true, true, ATTR_NOTHROW_NONNULL_1_2, true)
844 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
845 "__builtin_fwrite_unlocked",
846 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, ATTR_NOTHROW_NONNULL_1_4)
847 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
848 "__builtin_fprintf_unlocked",
849 BT_FN_INT_PTR_CONST_STRING_VAR,
850 ATTR_FORMAT_PRINTF_2_3)
852 /* ISO C99 floating point unordered comparisons. */
853 DEF_GCC_BUILTIN(BUILT_IN_ISGREATER,
854 "__builtin_isgreater",
856 ATTR_CONST_NOTHROW_LIST)
857 DEF_GCC_BUILTIN(BUILT_IN_ISGREATEREQUAL,
858 "__builtin_isgreaterequal",
860 ATTR_CONST_NOTHROW_LIST)
861 DEF_GCC_BUILTIN(BUILT_IN_ISLESS,
864 ATTR_CONST_NOTHROW_LIST)
865 DEF_GCC_BUILTIN(BUILT_IN_ISLESSEQUAL,
866 "__builtin_islessequal",
868 ATTR_CONST_NOTHROW_LIST)
869 DEF_GCC_BUILTIN(BUILT_IN_ISLESSGREATER,
870 "__builtin_islessgreater",
872 ATTR_CONST_NOTHROW_LIST)
873 DEF_GCC_BUILTIN(BUILT_IN_ISUNORDERED,
874 "__builtin_isunordered",
876 ATTR_CONST_NOTHROW_LIST)
878 /* Various hooks for the DWARF 2 __throw routine. */
879 DEF_GCC_BUILTIN(BUILT_IN_UNWIND_INIT,
880 "__builtin_unwind_init",
883 DEF_GCC_BUILTIN(BUILT_IN_DWARF_CFA,
884 "__builtin_dwarf_cfa",
887 DEF_GCC_BUILTIN(BUILT_IN_DWARF_SP_COLUMN,
888 "__builtin_dwarf_sp_column",
891 DEF_GCC_BUILTIN(BUILT_IN_INIT_DWARF_REG_SIZES,
892 "__builtin_init_dwarf_reg_size_table",
895 DEF_GCC_BUILTIN(BUILT_IN_FROB_RETURN_ADDR,
896 "__builtin_frob_return_addr",
899 DEF_GCC_BUILTIN(BUILT_IN_EXTRACT_RETURN_ADDR,
900 "__builtin_extract_return_addr",
903 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN,
904 "__builtin_eh_return",
905 BT_FN_VOID_PTRMODE_PTR,
906 ATTR_NORETURN_NOTHROW_LIST)
907 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN_DATA_REGNO,
908 "__builtin_eh_return_data_regno",
912 /* Variable argument list (stdarg.h) support */
913 DEF_GCC_BUILTIN(BUILT_IN_VA_START,
914 "__builtin_va_start",
915 BT_FN_VOID_VALIST_REF_VAR,
917 DEF_GCC_BUILTIN(BUILT_IN_STDARG_START, /* backward compat */
918 "__builtin_stdarg_start",
919 BT_FN_VOID_VALIST_REF_VAR,
921 DEF_GCC_BUILTIN(BUILT_IN_VA_END,
923 BT_FN_VOID_VALIST_REF,
925 DEF_GCC_BUILTIN(BUILT_IN_VA_COPY,
927 BT_FN_VOID_VALIST_REF_VALIST_ARG,
930 DEF_GCC_BUILTIN(BUILT_IN_EXPECT,
932 BT_FN_LONG_LONG_LONG,
935 /* Declare abort, exit, _exit and _Exit */
936 DEF_LIB_BUILTIN(BUILT_IN_ABORT,
939 ATTR_NORETURN_NOTHROW_LIST)
940 DEF_LIB_BUILTIN(BUILT_IN_EXIT,
943 ATTR_NORETURN_NOTHROW_LIST)
944 DEF_EXT_LIB_BUILTIN(BUILT_IN__EXIT,
947 ATTR_NORETURN_NOTHROW_LIST)
948 DEF_C99_BUILTIN(BUILT_IN__EXIT2,
951 ATTR_NORETURN_NOTHROW_LIST)
953 /* Declare malloc, calloc and strdup. */
954 DEF_LIB_BUILTIN(BUILT_IN_MALLOC,
957 ATTR_MALLOC_NOTHROW_LIST)
959 DEF_LIB_BUILTIN(BUILT_IN_CALLOC,
962 ATTR_MALLOC_NOTHROW_LIST)
964 DEF_EXT_LIB_BUILTIN(BUILT_IN_STRDUP,
966 BT_FN_STRING_CONST_STRING,
967 ATTR_MALLOC_NOTHROW_NONNULL_1)