tree.c (build_tree_list): Fix parameter names in comment.
[official-gcc.git] / gcc / builtins.def
blob268696edb8f8c7fb9da5e776028eaa4d5f1b05ff
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
10 version.
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
15 for more details.
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
20 02111-1307, USA. */
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
39 variant.
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
44 should be ignored.
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
49 `__builtin_' prefix.
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 simplifing floor((double)float) since runtime don't need to implement it. */
64 /* A GCC builtin (like __builtin_saveregs) is provided by the
65 compiler, but does not correspond to a function in the standard
66 library. */
67 #undef DEF_GCC_BUILTIN
68 #define DEF_GCC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
69 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, BT_LAST, \
70 false, false, false, ATTRS, true)
73 /* A fallback builtin is a builtin (like __builtin_puts) that falls
74 back to the corresopnding library function if necessary -- but
75 for which we should not introduce the non-`__builtin' variant of
76 the name. */
77 #undef DEF_FALLBACK_BUILTIN
78 #define DEF_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
79 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
80 false, true, false, ATTRS, true)
82 /* Like DEF_FALLBACK_BUILTIN, except that the function is not one that
83 is specified by ANSI/ISO C. So, when we're being fully conformant
84 we ignore the version of these builtins that does not begin with
85 __builtin. */
86 #undef DEF_EXT_FALLBACK_BUILTIN
87 #define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE) \
88 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
89 false, true, true, ATTR_NOTHROW_LIST, true)
91 /* A library builtin (like __builtin_strchr) is a builtin equivalent
92 of an ANSI/ISO standard library function. In addition to the
93 `__builtin' version, we will create an ordinary version (e.g,
94 `strchr') as well. If we cannot compute the answer using the
95 builtin function, we will fall back to the standard library
96 version. */
97 #undef DEF_LIB_BUILTIN
98 #define DEF_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
99 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
100 true, true, false, ATTRS, true)
102 /* Like DEF_LIB_BUILTIN, except that a call to the builtin should
103 never fall back to the library version. */
104 #undef DEF_LIB_ALWAYS_BUILTIN
105 #define DEF_LIB_ALWAYS_BUILTIN(ENUM, NAME, TYPE) \
106 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
107 true, false, true, ATTR_CONST_NOTHROW_LIST, true)
109 /* Like DEF_LIB_BUILTIN, except that the function is not one that is
110 specified by ANSI/ISO C. So, when we're being fully conformant we
111 ignore the version of these builtins that does not begin with
112 __builtin. */
113 #undef DEF_EXT_LIB_BUILTIN
114 #define DEF_EXT_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
115 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
116 true, true, true, ATTRS, false)
118 /* Like DEF_LIB_BUILTIN, except that the function is only a part of
119 the standard in C99 or above. */
120 #undef DEF_C99_BUILTIN
121 #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
122 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
123 true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
125 /* Builtin that is specified by C99 and C90 reserve the name for future use.
126 We can still recognize the builtin in C90 mode but we can't produce it
127 implicitly. */
128 #undef DEF_C99_C90RES_BUILTIN
129 #define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
130 DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
131 true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
133 /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
134 front-end. */
135 #undef DEF_FRONT_END_LIB_BUILTIN
136 #define DEF_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
137 DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
138 true, true, false, ATTRS, true)
140 /* Like DEF_FRONT_END_LIB_BUILTIN, except that the function is not one
141 that is specified by ANSI/ISO C. So, when we're being fully
142 conformant we ignore the version of these builtins that does not
143 begin with __builtin. */
144 #undef DEF_EXT_FRONT_END_LIB_BUILTIN
145 #define DEF_EXT_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
146 DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
147 true, true, true, ATTRS, true)
149 /* A built-in that is not currently used. */
150 #undef DEF_UNUSED_BUILTIN
151 #define DEF_UNUSED_BUILTIN(X) \
152 DEF_BUILTIN (X, (const char *) NULL, NOT_BUILT_IN, BT_LAST, \
153 BT_LAST, false, false, false, ATTR_NOTHROW_LIST, false)
155 /* If SMALL_STACK is defined, then `alloca' is only defined in its
156 `__builtin' form. */
157 #if SMALL_STACK
158 DEF_FALLBACK_BUILTIN(BUILT_IN_ALLOCA,
159 "__builtin_alloca",
160 BT_FN_PTR_SIZE,
161 ATTR_MALLOC_NOTHROW_LIST)
162 #else
163 DEF_EXT_LIB_BUILTIN(BUILT_IN_ALLOCA,
164 "__builtin_alloca",
165 BT_FN_PTR_SIZE,
166 ATTR_MALLOC_NOTHROW_LIST)
167 #endif
169 DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_ABS,
170 "__builtin_abs",
171 BT_FN_INT_INT)
172 DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_LABS,
173 "__builtin_labs",
174 BT_FN_LONG_LONG)
176 DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABS,
177 "__builtin_fabs",
178 BT_FN_DOUBLE_DOUBLE)
179 DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABSF,
180 "__builtin_fabsf",
181 BT_FN_FLOAT_FLOAT)
182 DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABSL,
183 "__builtin_fabsl",
184 BT_FN_LONG_DOUBLE_LONG_DOUBLE)
186 DEF_LIB_BUILTIN(BUILT_IN_FLOOR,
187 "__builtin_floor",
188 BT_FN_DOUBLE_DOUBLE,
189 ATTR_CONST_NOTHROW_LIST)
190 DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORF,
191 "__builtin_floorf",
192 BT_FN_FLOAT_FLOAT,
193 ATTR_CONST_NOTHROW_LIST)
194 DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORL,
195 "__builtin_floorl",
196 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
197 ATTR_CONST_NOTHROW_LIST)
199 DEF_LIB_BUILTIN(BUILT_IN_CEIL,
200 "__builtin_ceil",
201 BT_FN_DOUBLE_DOUBLE,
202 ATTR_CONST_NOTHROW_LIST)
203 DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILF,
204 "__builtin_ceilf",
205 BT_FN_FLOAT_FLOAT,
206 ATTR_CONST_NOTHROW_LIST)
207 DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILL,
208 "__builtin_ceill",
209 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
210 ATTR_CONST_NOTHROW_LIST)
212 DEF_C99_BUILTIN(BUILT_IN_ROUND,
213 "__builtin_round",
214 BT_FN_DOUBLE_DOUBLE,
215 ATTR_CONST_NOTHROW_LIST)
216 DEF_C99_BUILTIN(BUILT_IN_ROUNDF,
217 "__builtin_roundf",
218 BT_FN_FLOAT_FLOAT,
219 ATTR_CONST_NOTHROW_LIST)
220 DEF_C99_BUILTIN(BUILT_IN_ROUNDL,
221 "__builtin_roundl",
222 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
223 ATTR_CONST_NOTHROW_LIST)
225 DEF_C99_BUILTIN(BUILT_IN_TRUNC,
226 "__builtin_trunc",
227 BT_FN_DOUBLE_DOUBLE,
228 ATTR_CONST_NOTHROW_LIST)
229 DEF_C99_BUILTIN(BUILT_IN_TRUNCF,
230 "__builtin_truncf",
231 BT_FN_FLOAT_FLOAT,
232 ATTR_CONST_NOTHROW_LIST)
233 DEF_C99_BUILTIN(BUILT_IN_TRUNCL,
234 "__builtin_truncl",
235 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
236 ATTR_CONST_NOTHROW_LIST)
238 DEF_C99_BUILTIN(BUILT_IN_NEARBYINT,
239 "__builtin_nearbyint",
240 BT_FN_DOUBLE_DOUBLE,
241 ATTR_CONST_NOTHROW_LIST)
242 DEF_C99_BUILTIN(BUILT_IN_NEARBYINTF,
243 "__builtin_nearbyintf",
244 BT_FN_FLOAT_FLOAT,
245 ATTR_CONST_NOTHROW_LIST)
246 DEF_C99_BUILTIN(BUILT_IN_NEARBYINTL,
247 "__builtin_nearbyintl",
248 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
249 ATTR_CONST_NOTHROW_LIST)
251 DEF_C99_BUILTIN(BUILT_IN_LLABS,
252 "__builtin_llabs",
253 BT_FN_LONGLONG_LONGLONG,
254 ATTR_CONST_NOTHROW_LIST)
255 DEF_C99_BUILTIN(BUILT_IN_IMAXABS,
256 "__builtin_imaxabs",
257 BT_FN_INTMAX_INTMAX,
258 ATTR_CONST_NOTHROW_LIST)
259 DEF_C99_BUILTIN(BUILT_IN_CONJ,
260 "__builtin_conj",
261 BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
262 ATTR_CONST_NOTHROW_LIST)
263 DEF_C99_BUILTIN(BUILT_IN_CONJF,
264 "__builtin_conjf",
265 BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT,
266 ATTR_CONST_NOTHROW_LIST)
267 DEF_C99_BUILTIN(BUILT_IN_CONJL,
268 "__builtin_conjl",
269 BT_FN_COMPLEX_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
270 ATTR_CONST_NOTHROW_LIST)
271 DEF_C99_BUILTIN(BUILT_IN_CREAL,
272 "__builtin_creal",
273 BT_FN_DOUBLE_COMPLEX_DOUBLE,
274 ATTR_CONST_NOTHROW_LIST)
275 DEF_C99_BUILTIN(BUILT_IN_CREALF,
276 "__builtin_crealf",
277 BT_FN_FLOAT_COMPLEX_FLOAT,
278 ATTR_CONST_NOTHROW_LIST)
279 DEF_C99_BUILTIN(BUILT_IN_CREALL,
280 "__builtin_creall",
281 BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
282 ATTR_CONST_NOTHROW_LIST)
283 DEF_C99_BUILTIN(BUILT_IN_CIMAG,
284 "__builtin_cimag",
285 BT_FN_DOUBLE_COMPLEX_DOUBLE,
286 ATTR_CONST_NOTHROW_LIST)
287 DEF_C99_BUILTIN(BUILT_IN_CIMAGF,
288 "__builtin_cimagf",
289 BT_FN_FLOAT_COMPLEX_FLOAT,
290 ATTR_CONST_NOTHROW_LIST)
291 DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
292 "__builtin_cimagl",
293 BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
294 ATTR_CONST_NOTHROW_LIST)
296 DEF_UNUSED_BUILTIN(BUILT_IN_DIV)
297 DEF_UNUSED_BUILTIN(BUILT_IN_LDIV)
298 DEF_UNUSED_BUILTIN(BUILT_IN_FFLOOR)
299 DEF_UNUSED_BUILTIN(BUILT_IN_FCEIL)
300 DEF_UNUSED_BUILTIN(BUILT_IN_FMOD)
301 DEF_UNUSED_BUILTIN(BUILT_IN_FREM)
303 /* The system prototypes for `bzero' and `bcmp' functions have many
304 variations, so don't specify parameters to avoid conflicts. The
305 expand_* functions check the argument types anyway. */
306 DEF_BUILTIN (BUILT_IN_BZERO,
307 "__builtin_bzero",
308 BUILT_IN_NORMAL,
309 BT_FN_VOID_PTR_SIZE,
310 BT_FN_VOID_VAR,
311 true, true, true,
312 ATTR_NOTHROW_LIST, false)
313 DEF_BUILTIN (BUILT_IN_BCMP,
314 "__builtin_bcmp",
315 BUILT_IN_NORMAL,
316 BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
317 BT_FN_INT_VAR,
318 true, true, true,
319 ATTR_PURE_NOTHROW_LIST, false)
321 DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
322 "__builtin_ffs",
323 BT_FN_INT_INT,
324 ATTR_CONST_NOTHROW_LIST)
325 DEF_GCC_BUILTIN(BUILT_IN_CLZ,
326 "__builtin_clz",
327 BT_FN_INT_INT,
328 ATTR_CONST_NOTHROW_LIST)
329 DEF_GCC_BUILTIN(BUILT_IN_CTZ,
330 "__builtin_ctz",
331 BT_FN_INT_INT,
332 ATTR_CONST_NOTHROW_LIST)
333 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNT,
334 "__builtin_popcount",
335 BT_FN_INT_INT,
336 ATTR_CONST_NOTHROW_LIST)
337 DEF_GCC_BUILTIN(BUILT_IN_PARITY,
338 "__builtin_parity",
339 BT_FN_INT_INT,
340 ATTR_CONST_NOTHROW_LIST)
342 DEF_GCC_BUILTIN(BUILT_IN_FFSL,
343 "__builtin_ffsl",
344 BT_FN_INT_LONG,
345 ATTR_CONST_NOTHROW_LIST)
346 DEF_GCC_BUILTIN(BUILT_IN_CLZL,
347 "__builtin_clzl",
348 BT_FN_INT_LONG,
349 ATTR_CONST_NOTHROW_LIST)
350 DEF_GCC_BUILTIN(BUILT_IN_CTZL,
351 "__builtin_ctzl",
352 BT_FN_INT_LONG,
353 ATTR_CONST_NOTHROW_LIST)
354 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNTL,
355 "__builtin_popcountl",
356 BT_FN_INT_LONG,
357 ATTR_CONST_NOTHROW_LIST)
358 DEF_GCC_BUILTIN(BUILT_IN_PARITYL,
359 "__builtin_parityl",
360 BT_FN_INT_LONG,
361 ATTR_CONST_NOTHROW_LIST)
363 DEF_EXT_LIB_BUILTIN(BUILT_IN_FFSLL,
364 "__builtin_ffsll",
365 BT_FN_INT_LONGLONG,
366 ATTR_CONST_NOTHROW_LIST)
367 DEF_GCC_BUILTIN(BUILT_IN_CLZLL,
368 "__builtin_clzll",
369 BT_FN_INT_LONGLONG,
370 ATTR_CONST_NOTHROW_LIST)
371 DEF_GCC_BUILTIN(BUILT_IN_CTZLL,
372 "__builtin_ctzll",
373 BT_FN_INT_LONGLONG,
374 ATTR_CONST_NOTHROW_LIST)
375 DEF_GCC_BUILTIN(BUILT_IN_POPCOUNTLL,
376 "__builtin_popcountll",
377 BT_FN_INT_LONGLONG,
378 ATTR_CONST_NOTHROW_LIST)
379 DEF_GCC_BUILTIN(BUILT_IN_PARITYLL,
380 "__builtin_parityll",
381 BT_FN_INT_LONGLONG,
382 ATTR_CONST_NOTHROW_LIST)
384 DEF_EXT_LIB_BUILTIN(BUILT_IN_INDEX,
385 "__builtin_index",
386 BT_FN_STRING_CONST_STRING_INT,
387 ATTR_PURE_NOTHROW_LIST)
388 DEF_EXT_LIB_BUILTIN(BUILT_IN_RINDEX,
389 "__builtin_rindex",
390 BT_FN_STRING_CONST_STRING_INT,
391 ATTR_PURE_NOTHROW_LIST)
393 DEF_LIB_BUILTIN(BUILT_IN_MEMCPY,
394 "__builtin_memcpy",
395 BT_FN_PTR_PTR_CONST_PTR_SIZE,
396 ATTR_NOTHROW_LIST)
397 DEF_LIB_BUILTIN(BUILT_IN_MEMCMP,
398 "__builtin_memcmp",
399 BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
400 ATTR_PURE_NOTHROW_LIST)
401 DEF_LIB_BUILTIN(BUILT_IN_MEMSET,
402 "__builtin_memset",
403 BT_FN_PTR_PTR_INT_SIZE,
404 ATTR_NOTHROW_LIST)
406 DEF_LIB_BUILTIN(BUILT_IN_STRCAT,
407 "__builtin_strcat",
408 BT_FN_STRING_STRING_CONST_STRING,
409 ATTR_NOTHROW_LIST)
410 DEF_LIB_BUILTIN(BUILT_IN_STRNCAT,
411 "__builtin_strncat",
412 BT_FN_STRING_STRING_CONST_STRING_SIZE,
413 ATTR_NOTHROW_LIST)
414 DEF_LIB_BUILTIN(BUILT_IN_STRCPY,
415 "__builtin_strcpy",
416 BT_FN_STRING_STRING_CONST_STRING,
417 ATTR_NOTHROW_LIST)
418 DEF_LIB_BUILTIN(BUILT_IN_STRNCPY,
419 "__builtin_strncpy",
420 BT_FN_STRING_STRING_CONST_STRING_SIZE,
421 ATTR_NOTHROW_LIST)
422 DEF_LIB_BUILTIN(BUILT_IN_STRCMP,
423 "__builtin_strcmp",
424 BT_FN_INT_CONST_STRING_CONST_STRING,
425 ATTR_PURE_NOTHROW_LIST)
426 DEF_LIB_BUILTIN(BUILT_IN_STRNCMP,
427 "__builtin_strncmp",
428 BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
429 ATTR_PURE_NOTHROW_LIST)
430 DEF_LIB_BUILTIN(BUILT_IN_STRLEN,
431 "__builtin_strlen",
432 BT_FN_SIZE_CONST_STRING,
433 ATTR_PURE_NOTHROW_LIST)
434 DEF_LIB_BUILTIN(BUILT_IN_STRSTR,
435 "__builtin_strstr",
436 BT_FN_STRING_CONST_STRING_CONST_STRING,
437 ATTR_PURE_NOTHROW_LIST)
438 DEF_LIB_BUILTIN(BUILT_IN_STRPBRK,
439 "__builtin_strpbrk",
440 BT_FN_STRING_CONST_STRING_CONST_STRING,
441 ATTR_PURE_NOTHROW_LIST)
442 DEF_LIB_BUILTIN(BUILT_IN_STRSPN,
443 "__builtin_strspn",
444 BT_FN_SIZE_CONST_STRING_CONST_STRING,
445 ATTR_PURE_NOTHROW_LIST)
446 DEF_LIB_BUILTIN(BUILT_IN_STRCSPN,
447 "__builtin_strcspn",
448 BT_FN_SIZE_CONST_STRING_CONST_STRING,
449 ATTR_PURE_NOTHROW_LIST)
450 DEF_LIB_BUILTIN(BUILT_IN_STRCHR,
451 "__builtin_strchr",
452 BT_FN_STRING_CONST_STRING_INT,
453 ATTR_PURE_NOTHROW_LIST)
454 DEF_LIB_BUILTIN(BUILT_IN_STRRCHR,
455 "__builtin_strrchr",
456 BT_FN_STRING_CONST_STRING_INT,
457 ATTR_PURE_NOTHROW_LIST)
459 DEF_LIB_BUILTIN(BUILT_IN_SQRT,
460 "__builtin_sqrt",
461 BT_FN_DOUBLE_DOUBLE,
462 flag_errno_math ? ATTR_NOTHROW_LIST
463 : (flag_unsafe_math_optimizations
464 ? ATTR_CONST_NOTHROW_LIST
465 : ATTR_PURE_NOTHROW_LIST))
466 DEF_LIB_BUILTIN(BUILT_IN_SIN,
467 "__builtin_sin",
468 BT_FN_DOUBLE_DOUBLE,
469 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
470 : ATTR_PURE_NOTHROW_LIST)
471 DEF_LIB_BUILTIN(BUILT_IN_COS,
472 "__builtin_cos",
473 BT_FN_DOUBLE_DOUBLE,
474 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
475 : ATTR_PURE_NOTHROW_LIST)
476 DEF_LIB_BUILTIN(BUILT_IN_EXP,
477 "__builtin_exp",
478 BT_FN_DOUBLE_DOUBLE,
479 flag_errno_math ? ATTR_NOTHROW_LIST
480 : (flag_unsafe_math_optimizations
481 ? ATTR_CONST_NOTHROW_LIST
482 : ATTR_PURE_NOTHROW_LIST))
483 DEF_LIB_BUILTIN(BUILT_IN_LOG,
484 "__builtin_log",
485 BT_FN_DOUBLE_DOUBLE,
486 flag_errno_math ? ATTR_NOTHROW_LIST
487 : (flag_unsafe_math_optimizations
488 ? ATTR_CONST_NOTHROW_LIST
489 : ATTR_PURE_NOTHROW_LIST))
490 DEF_LIB_BUILTIN(BUILT_IN_POW,
491 "__builtin_pow",
492 BT_FN_DOUBLE_DOUBLE_DOUBLE,
493 flag_errno_math ? ATTR_NOTHROW_LIST
494 : (flag_unsafe_math_optimizations
495 ? ATTR_CONST_NOTHROW_LIST
496 : ATTR_PURE_NOTHROW_LIST))
497 DEF_LIB_BUILTIN(BUILT_IN_ATAN2,
498 "__builtin_atan2",
499 BT_FN_DOUBLE_DOUBLE_DOUBLE,
500 flag_errno_math ? ATTR_NOTHROW_LIST
501 : (flag_unsafe_math_optimizations
502 ? ATTR_CONST_NOTHROW_LIST
503 : ATTR_PURE_NOTHROW_LIST))
504 DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
505 "__builtin_sqrtf",
506 BT_FN_FLOAT_FLOAT,
507 flag_errno_math ? ATTR_NOTHROW_LIST
508 : (flag_unsafe_math_optimizations
509 ? ATTR_CONST_NOTHROW_LIST
510 : ATTR_PURE_NOTHROW_LIST))
511 DEF_C99_C90RES_BUILTIN(BUILT_IN_SINF,
512 "__builtin_sinf",
513 BT_FN_FLOAT_FLOAT,
514 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
515 : ATTR_PURE_NOTHROW_LIST)
516 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSF,
517 "__builtin_cosf",
518 BT_FN_FLOAT_FLOAT,
519 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
520 : ATTR_PURE_NOTHROW_LIST)
521 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPF,
522 "__builtin_expf",
523 BT_FN_FLOAT_FLOAT,
524 flag_errno_math ? ATTR_NOTHROW_LIST
525 : (flag_unsafe_math_optimizations
526 ? ATTR_CONST_NOTHROW_LIST
527 : ATTR_PURE_NOTHROW_LIST))
528 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF,
529 "__builtin_logf",
530 BT_FN_FLOAT_FLOAT,
531 flag_errno_math ? ATTR_NOTHROW_LIST
532 : (flag_unsafe_math_optimizations
533 ? ATTR_CONST_NOTHROW_LIST
534 : ATTR_PURE_NOTHROW_LIST))
535 DEF_C99_C90RES_BUILTIN(BUILT_IN_POWF,
536 "__builtin_powf",
537 BT_FN_FLOAT_FLOAT_FLOAT,
538 flag_errno_math ? ATTR_NOTHROW_LIST
539 : (flag_unsafe_math_optimizations
540 ? ATTR_CONST_NOTHROW_LIST
541 : ATTR_PURE_NOTHROW_LIST))
542 DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2F,
543 "__builtin_atan2f",
544 BT_FN_FLOAT_FLOAT_FLOAT,
545 flag_errno_math ? ATTR_NOTHROW_LIST
546 : (flag_unsafe_math_optimizations
547 ? ATTR_CONST_NOTHROW_LIST
548 : ATTR_PURE_NOTHROW_LIST))
549 DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
550 "__builtin_sqrtl",
551 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
552 flag_errno_math ? ATTR_NOTHROW_LIST
553 : (flag_unsafe_math_optimizations
554 ? ATTR_CONST_NOTHROW_LIST
555 : ATTR_PURE_NOTHROW_LIST))
556 DEF_C99_C90RES_BUILTIN(BUILT_IN_SINL,
557 "__builtin_sinl",
558 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
559 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
560 : ATTR_PURE_NOTHROW_LIST)
561 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSL,
562 "__builtin_cosl",
563 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
564 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
565 : ATTR_PURE_NOTHROW_LIST)
566 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPL,
567 "__builtin_expl",
568 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
569 flag_errno_math ? ATTR_NOTHROW_LIST
570 : (flag_unsafe_math_optimizations
571 ? ATTR_CONST_NOTHROW_LIST
572 : ATTR_PURE_NOTHROW_LIST))
573 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL,
574 "__builtin_logl",
575 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
576 flag_errno_math ? ATTR_NOTHROW_LIST
577 : (flag_unsafe_math_optimizations
578 ? ATTR_CONST_NOTHROW_LIST
579 : ATTR_PURE_NOTHROW_LIST))
580 DEF_C99_C90RES_BUILTIN(BUILT_IN_POWL,
581 "__builtin_powl",
582 BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
583 flag_errno_math ? ATTR_NOTHROW_LIST
584 : (flag_unsafe_math_optimizations
585 ? ATTR_CONST_NOTHROW_LIST
586 : ATTR_PURE_NOTHROW_LIST))
587 DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2L,
588 "__builtin_atan2l",
589 BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
590 flag_errno_math ? ATTR_NOTHROW_LIST
591 : (flag_unsafe_math_optimizations
592 ? ATTR_CONST_NOTHROW_LIST
593 : ATTR_PURE_NOTHROW_LIST))
595 DEF_GCC_BUILTIN(BUILT_IN_INF,
596 "__builtin_inf",
597 BT_FN_DOUBLE,
598 ATTR_CONST_NOTHROW_LIST)
599 DEF_GCC_BUILTIN(BUILT_IN_INFF,
600 "__builtin_inff",
601 BT_FN_FLOAT,
602 ATTR_CONST_NOTHROW_LIST)
603 DEF_GCC_BUILTIN(BUILT_IN_INFL,
604 "__builtin_infl",
605 BT_FN_LONG_DOUBLE,
606 ATTR_CONST_NOTHROW_LIST)
608 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VAL,
609 "__builtin_huge_val",
610 BT_FN_DOUBLE,
611 ATTR_CONST_NOTHROW_LIST)
612 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALF,
613 "__builtin_huge_valf",
614 BT_FN_FLOAT,
615 ATTR_CONST_NOTHROW_LIST)
616 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALL,
617 "__builtin_huge_vall",
618 BT_FN_LONG_DOUBLE,
619 ATTR_CONST_NOTHROW_LIST)
621 DEF_LIB_BUILTIN(BUILT_IN_NAN,
622 "__builtin_nan",
623 BT_FN_DOUBLE_CONST_STRING,
624 ATTR_CONST_NOTHROW_LIST)
625 DEF_LIB_BUILTIN(BUILT_IN_NANF,
626 "__builtin_nanf",
627 BT_FN_FLOAT_CONST_STRING,
628 ATTR_CONST_NOTHROW_LIST)
629 DEF_LIB_BUILTIN(BUILT_IN_NANL,
630 "__builtin_nanl",
631 BT_FN_LONG_DOUBLE_CONST_STRING,
632 ATTR_CONST_NOTHROW_LIST)
634 DEF_LIB_BUILTIN(BUILT_IN_NANS,
635 "__builtin_nans",
636 BT_FN_DOUBLE_CONST_STRING,
637 ATTR_CONST_NOTHROW_LIST)
638 DEF_LIB_BUILTIN(BUILT_IN_NANSF,
639 "__builtin_nansf",
640 BT_FN_FLOAT_CONST_STRING,
641 ATTR_CONST_NOTHROW_LIST)
642 DEF_LIB_BUILTIN(BUILT_IN_NANSL,
643 "__builtin_nansl",
644 BT_FN_LONG_DOUBLE_CONST_STRING,
645 ATTR_CONST_NOTHROW_LIST)
647 DEF_GCC_BUILTIN(BUILT_IN_SAVEREGS,
648 "__builtin_saveregs",
649 BT_FN_PTR_VAR,
650 ATTR_NULL)
651 DEF_GCC_BUILTIN(BUILT_IN_CLASSIFY_TYPE,
652 "__builtin_classify_type",
653 BT_FN_INT_VAR,
654 ATTR_NULL)
655 DEF_GCC_BUILTIN(BUILT_IN_NEXT_ARG,
656 "__builtin_next_arg",
657 BT_FN_PTR_VAR,
658 ATTR_NULL)
659 DEF_GCC_BUILTIN(BUILT_IN_ARGS_INFO,
660 "__builtin_args_info",
661 BT_FN_INT_INT,
662 ATTR_NULL)
663 DEF_GCC_BUILTIN(BUILT_IN_CONSTANT_P,
664 "__builtin_constant_p",
665 BT_FN_INT_VAR,
666 ATTR_NULL)
667 DEF_GCC_BUILTIN(BUILT_IN_FRAME_ADDRESS,
668 "__builtin_frame_address",
669 BT_FN_PTR_UNSIGNED,
670 ATTR_NULL)
671 DEF_GCC_BUILTIN(BUILT_IN_RETURN_ADDRESS,
672 "__builtin_return_address",
673 BT_FN_PTR_UNSIGNED,
674 ATTR_NULL)
675 DEF_GCC_BUILTIN(BUILT_IN_AGGREGATE_INCOMING_ADDRESS,
676 "__builtin_aggregate_incoming_address",
677 BT_FN_PTR_VAR,
678 ATTR_NULL)
679 DEF_GCC_BUILTIN(BUILT_IN_APPLY_ARGS,
680 "__builtin_apply_args",
681 BT_FN_PTR_VAR,
682 ATTR_NULL)
683 DEF_GCC_BUILTIN(BUILT_IN_APPLY,
684 "__builtin_apply",
685 BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
686 ATTR_NULL)
687 DEF_GCC_BUILTIN(BUILT_IN_RETURN,
688 "__builtin_return",
689 BT_FN_VOID_PTR,
690 ATTR_NORETURN_NOTHROW_LIST)
691 DEF_GCC_BUILTIN(BUILT_IN_SETJMP,
692 "__builtin_setjmp",
693 BT_FN_INT_PTR,
694 ATTR_NULL)
695 DEF_GCC_BUILTIN(BUILT_IN_LONGJMP,
696 "__builtin_longjmp",
697 BT_FN_VOID_PTR_INT,
698 ATTR_NORETURN_NOTHROW_LIST)
699 DEF_GCC_BUILTIN(BUILT_IN_TRAP,
700 "__builtin_trap",
701 BT_FN_VOID,
702 ATTR_NORETURN_NOTHROW_LIST)
703 DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
704 "__builtin_prefetch",
705 BT_FN_VOID_CONST_PTR_VAR,
706 ATTR_NULL)
708 /* Stdio builtins. */
709 DEF_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR,
710 "__builtin_putchar",
711 BT_FN_INT_INT,
712 ATTR_NOTHROW_LIST)
713 DEF_FALLBACK_BUILTIN(BUILT_IN_PUTS,
714 "__builtin_puts",
715 BT_FN_INT_CONST_STRING,
716 ATTR_NOTHROW_LIST)
717 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF,
718 "__builtin_printf",
719 BT_FN_INT_CONST_STRING_VAR,
720 ATTR_FORMAT_PRINTF_1_2)
721 DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
722 "__builtin_fputc",
723 BT_FN_INT_INT_PTR,
724 ATTR_NOTHROW_LIST)
725 /* Declare the __builtin_ style with arguments and the regular style
726 without them. We rely on stdio.h to supply the arguments for the
727 regular style declaration since we had to use void* instead of
728 FILE* in the __builtin_ prototype supplied here. */
729 DEF_BUILTIN (BUILT_IN_FPUTS,
730 "__builtin_fputs",
731 BUILT_IN_NORMAL,
732 BT_FN_INT_CONST_STRING_PTR,
733 BT_FN_INT_VAR,
734 true, true, false, ATTR_NOTHROW_LIST, true)
735 DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
736 "__builtin_fwrite",
737 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
738 ATTR_NOTHROW_LIST)
739 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
740 "__builtin_fprintf",
741 BT_FN_INT_PTR_CONST_STRING_VAR,
742 ATTR_FORMAT_PRINTF_2_3)
744 /* Stdio unlocked builtins. */
746 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
747 "__builtin_putchar_unlocked",
748 BT_FN_INT_INT)
749 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
750 "__builtin_puts_unlocked",
751 BT_FN_INT_CONST_STRING)
752 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
753 "__builtin_printf_unlocked",
754 BT_FN_INT_CONST_STRING_VAR,
755 ATTR_FORMAT_PRINTF_1_2)
756 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
757 "__builtin_fputc_unlocked",
758 BT_FN_INT_INT_PTR)
759 /* Declare the __builtin_ style with arguments and the regular style
760 without them. We rely on stdio.h to supply the arguments for the
761 regular style declaration since we had to use void* instead of
762 FILE* in the __builtin_ prototype supplied here. */
763 DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
764 "__builtin_fputs_unlocked",
765 BUILT_IN_NORMAL,
766 BT_FN_INT_CONST_STRING_PTR,
767 BT_FN_INT_VAR,
768 true, true, true, ATTR_NOTHROW_LIST, true)
769 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
770 "__builtin_fwrite_unlocked",
771 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
772 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
773 "__builtin_fprintf_unlocked",
774 BT_FN_INT_PTR_CONST_STRING_VAR,
775 ATTR_FORMAT_PRINTF_2_3)
777 /* ISO C99 floating point unordered comparisons. */
778 DEF_GCC_BUILTIN(BUILT_IN_ISGREATER,
779 "__builtin_isgreater",
780 BT_FN_INT_VAR,
781 ATTR_CONST_NOTHROW_LIST)
782 DEF_GCC_BUILTIN(BUILT_IN_ISGREATEREQUAL,
783 "__builtin_isgreaterequal",
784 BT_FN_INT_VAR,
785 ATTR_CONST_NOTHROW_LIST)
786 DEF_GCC_BUILTIN(BUILT_IN_ISLESS,
787 "__builtin_isless",
788 BT_FN_INT_VAR,
789 ATTR_CONST_NOTHROW_LIST)
790 DEF_GCC_BUILTIN(BUILT_IN_ISLESSEQUAL,
791 "__builtin_islessequal",
792 BT_FN_INT_VAR,
793 ATTR_CONST_NOTHROW_LIST)
794 DEF_GCC_BUILTIN(BUILT_IN_ISLESSGREATER,
795 "__builtin_islessgreater",
796 BT_FN_INT_VAR,
797 ATTR_CONST_NOTHROW_LIST)
798 DEF_GCC_BUILTIN(BUILT_IN_ISUNORDERED,
799 "__builtin_isunordered",
800 BT_FN_INT_VAR,
801 ATTR_CONST_NOTHROW_LIST)
803 /* Various hooks for the DWARF 2 __throw routine. */
804 DEF_GCC_BUILTIN(BUILT_IN_UNWIND_INIT,
805 "__builtin_unwind_init",
806 BT_FN_VOID,
807 ATTR_NULL)
808 DEF_GCC_BUILTIN(BUILT_IN_DWARF_CFA,
809 "__builtin_dwarf_cfa",
810 BT_FN_PTR,
811 ATTR_NULL)
812 DEF_GCC_BUILTIN(BUILT_IN_DWARF_FP_REGNUM,
813 "__builtin_dwarf_fp_regnum",
814 BT_FN_UNSIGNED,
815 ATTR_NULL)
816 DEF_GCC_BUILTIN(BUILT_IN_INIT_DWARF_REG_SIZES,
817 "__builtin_init_dwarf_reg_size_table",
818 BT_FN_VOID_PTR,
819 ATTR_NULL)
820 DEF_GCC_BUILTIN(BUILT_IN_FROB_RETURN_ADDR,
821 "__builtin_frob_return_addr",
822 BT_FN_PTR_PTR,
823 ATTR_NULL)
824 DEF_GCC_BUILTIN(BUILT_IN_EXTRACT_RETURN_ADDR,
825 "__builtin_extract_return_addr",
826 BT_FN_PTR_PTR,
827 ATTR_NULL)
828 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN,
829 "__builtin_eh_return",
830 BT_FN_VOID_PTRMODE_PTR,
831 ATTR_NORETURN_NOTHROW_LIST)
832 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN_DATA_REGNO,
833 "__builtin_eh_return_data_regno",
834 BT_FN_INT_INT,
835 ATTR_NULL)
837 /* Variable argument list (stdarg.h) support */
838 DEF_GCC_BUILTIN(BUILT_IN_VA_START,
839 "__builtin_va_start",
840 BT_FN_VOID_VALIST_REF_VAR,
841 ATTR_NULL)
842 DEF_GCC_BUILTIN(BUILT_IN_STDARG_START, /* backward compat */
843 "__builtin_stdarg_start",
844 BT_FN_VOID_VALIST_REF_VAR,
845 ATTR_NULL)
846 DEF_GCC_BUILTIN(BUILT_IN_VA_END,
847 "__builtin_va_end",
848 BT_FN_VOID_VALIST_REF,
849 ATTR_NULL)
850 DEF_GCC_BUILTIN(BUILT_IN_VA_COPY,
851 "__builtin_va_copy",
852 BT_FN_VOID_VALIST_REF_VALIST_ARG,
853 ATTR_NULL)
855 DEF_GCC_BUILTIN(BUILT_IN_EXPECT,
856 "__builtin_expect",
857 BT_FN_LONG_LONG_LONG,
858 ATTR_NULL)
860 /* C++ extensions */
861 DEF_UNUSED_BUILTIN(BUILT_IN_NEW)
862 DEF_UNUSED_BUILTIN(BUILT_IN_VEC_NEW)
863 DEF_UNUSED_BUILTIN(BUILT_IN_DELETE)
864 DEF_UNUSED_BUILTIN(BUILT_IN_VEC_DELETE)
866 /* Declare abort, exit, _exit and _Exit */
867 DEF_BUILTIN (BUILT_IN_ABORT,
868 "__builtin_abort",
869 NOT_BUILT_IN,
870 BT_FN_VOID,
871 BT_FN_VOID,
872 1, 0, 0,
873 ATTR_NORETURN_NOTHROW_LIST, true)
875 DEF_BUILTIN (BUILT_IN_EXIT,
876 "__builtin_exit",
877 NOT_BUILT_IN,
878 BT_FN_VOID_INT,
879 BT_FN_VOID_INT,
880 1, 0, 0,
881 ATTR_NORETURN_NOTHROW_LIST, true)
883 DEF_BUILTIN (BUILT_IN__EXIT,
884 "__builtin__exit",
885 NOT_BUILT_IN,
886 BT_FN_VOID_INT,
887 BT_FN_VOID_INT,
888 1, 0, 1,
889 ATTR_NORETURN_NOTHROW_LIST, false)
891 DEF_BUILTIN (BUILT_IN__EXIT2,
892 "__builtin__Exit",
893 NOT_BUILT_IN,
894 BT_FN_VOID_INT,
895 BT_FN_VOID_INT,
896 1, 0, !flag_isoc99,
897 ATTR_NORETURN_NOTHROW_LIST, false)