index.html: Correct link to libg++ information.
[official-gcc.git] / gcc / builtins.def
blob60a962a9abd6c9e73facdbc850c0acbaae3f3e29
1 /* This file contains the definitions and documentation for the
2 builtins used in the GNU compiler.
3 Copyright (C) 2000, 2001 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_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
491 "__builtin_sqrtf",
492 BT_FN_FLOAT_FLOAT,
493 flag_errno_math ? ATTR_NOTHROW_LIST
494 : (flag_unsafe_math_optimizations
495 ? ATTR_CONST_NOTHROW_LIST
496 : ATTR_PURE_NOTHROW_LIST))
497 DEF_C99_C90RES_BUILTIN(BUILT_IN_SINF,
498 "__builtin_sinf",
499 BT_FN_FLOAT_FLOAT,
500 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
501 : ATTR_PURE_NOTHROW_LIST)
502 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSF,
503 "__builtin_cosf",
504 BT_FN_FLOAT_FLOAT,
505 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
506 : ATTR_PURE_NOTHROW_LIST)
507 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPF,
508 "__builtin_expf",
509 BT_FN_FLOAT_FLOAT,
510 flag_errno_math ? ATTR_NOTHROW_LIST
511 : (flag_unsafe_math_optimizations
512 ? ATTR_CONST_NOTHROW_LIST
513 : ATTR_PURE_NOTHROW_LIST))
514 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF,
515 "__builtin_logf",
516 BT_FN_FLOAT_FLOAT,
517 flag_errno_math ? ATTR_NOTHROW_LIST
518 : (flag_unsafe_math_optimizations
519 ? ATTR_CONST_NOTHROW_LIST
520 : ATTR_PURE_NOTHROW_LIST))
521 DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
522 "__builtin_sqrtl",
523 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
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_SINL,
529 "__builtin_sinl",
530 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
531 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
532 : ATTR_PURE_NOTHROW_LIST)
533 DEF_C99_C90RES_BUILTIN(BUILT_IN_COSL,
534 "__builtin_cosl",
535 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
536 flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
537 : ATTR_PURE_NOTHROW_LIST)
538 DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPL,
539 "__builtin_expl",
540 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
541 flag_errno_math ? ATTR_NOTHROW_LIST
542 : (flag_unsafe_math_optimizations
543 ? ATTR_CONST_NOTHROW_LIST
544 : ATTR_PURE_NOTHROW_LIST))
545 DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL,
546 "__builtin_logl",
547 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
548 flag_errno_math ? ATTR_NOTHROW_LIST
549 : (flag_unsafe_math_optimizations
550 ? ATTR_CONST_NOTHROW_LIST
551 : ATTR_PURE_NOTHROW_LIST))
553 DEF_GCC_BUILTIN(BUILT_IN_INF,
554 "__builtin_inf",
555 BT_FN_DOUBLE,
556 ATTR_CONST_NOTHROW_LIST)
557 DEF_GCC_BUILTIN(BUILT_IN_INFF,
558 "__builtin_inff",
559 BT_FN_FLOAT,
560 ATTR_CONST_NOTHROW_LIST)
561 DEF_GCC_BUILTIN(BUILT_IN_INFL,
562 "__builtin_infl",
563 BT_FN_LONG_DOUBLE,
564 ATTR_CONST_NOTHROW_LIST)
566 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VAL,
567 "__builtin_huge_val",
568 BT_FN_DOUBLE,
569 ATTR_CONST_NOTHROW_LIST)
570 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALF,
571 "__builtin_huge_valf",
572 BT_FN_FLOAT,
573 ATTR_CONST_NOTHROW_LIST)
574 DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALL,
575 "__builtin_huge_vall",
576 BT_FN_LONG_DOUBLE,
577 ATTR_CONST_NOTHROW_LIST)
579 DEF_LIB_BUILTIN(BUILT_IN_NAN,
580 "__builtin_nan",
581 BT_FN_DOUBLE_CONST_STRING,
582 ATTR_CONST_NOTHROW_LIST)
583 DEF_LIB_BUILTIN(BUILT_IN_NANF,
584 "__builtin_nanf",
585 BT_FN_FLOAT_CONST_STRING,
586 ATTR_CONST_NOTHROW_LIST)
587 DEF_LIB_BUILTIN(BUILT_IN_NANL,
588 "__builtin_nanl",
589 BT_FN_LONG_DOUBLE_CONST_STRING,
590 ATTR_CONST_NOTHROW_LIST)
592 DEF_LIB_BUILTIN(BUILT_IN_NANS,
593 "__builtin_nans",
594 BT_FN_DOUBLE_CONST_STRING,
595 ATTR_CONST_NOTHROW_LIST)
596 DEF_LIB_BUILTIN(BUILT_IN_NANSF,
597 "__builtin_nansf",
598 BT_FN_FLOAT_CONST_STRING,
599 ATTR_CONST_NOTHROW_LIST)
600 DEF_LIB_BUILTIN(BUILT_IN_NANSL,
601 "__builtin_nansl",
602 BT_FN_LONG_DOUBLE_CONST_STRING,
603 ATTR_CONST_NOTHROW_LIST)
605 DEF_GCC_BUILTIN(BUILT_IN_SAVEREGS,
606 "__builtin_saveregs",
607 BT_FN_PTR_VAR,
608 ATTR_NULL)
609 DEF_GCC_BUILTIN(BUILT_IN_CLASSIFY_TYPE,
610 "__builtin_classify_type",
611 BT_FN_INT_VAR,
612 ATTR_NULL)
613 DEF_GCC_BUILTIN(BUILT_IN_NEXT_ARG,
614 "__builtin_next_arg",
615 BT_FN_PTR_VAR,
616 ATTR_NULL)
617 DEF_GCC_BUILTIN(BUILT_IN_ARGS_INFO,
618 "__builtin_args_info",
619 BT_FN_INT_INT,
620 ATTR_NULL)
621 DEF_GCC_BUILTIN(BUILT_IN_CONSTANT_P,
622 "__builtin_constant_p",
623 BT_FN_INT_VAR,
624 ATTR_NULL)
625 DEF_GCC_BUILTIN(BUILT_IN_FRAME_ADDRESS,
626 "__builtin_frame_address",
627 BT_FN_PTR_UNSIGNED,
628 ATTR_NULL)
629 DEF_GCC_BUILTIN(BUILT_IN_RETURN_ADDRESS,
630 "__builtin_return_address",
631 BT_FN_PTR_UNSIGNED,
632 ATTR_NULL)
633 DEF_GCC_BUILTIN(BUILT_IN_AGGREGATE_INCOMING_ADDRESS,
634 "__builtin_aggregate_incoming_address",
635 BT_FN_PTR_VAR,
636 ATTR_NULL)
637 DEF_GCC_BUILTIN(BUILT_IN_APPLY_ARGS,
638 "__builtin_apply_args",
639 BT_FN_PTR_VAR,
640 ATTR_NULL)
641 DEF_GCC_BUILTIN(BUILT_IN_APPLY,
642 "__builtin_apply",
643 BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
644 ATTR_NULL)
645 DEF_GCC_BUILTIN(BUILT_IN_RETURN,
646 "__builtin_return",
647 BT_FN_VOID_PTR,
648 ATTR_NORETURN_NOTHROW_LIST)
649 DEF_GCC_BUILTIN(BUILT_IN_SETJMP,
650 "__builtin_setjmp",
651 BT_FN_INT_PTR,
652 ATTR_NULL)
653 DEF_GCC_BUILTIN(BUILT_IN_LONGJMP,
654 "__builtin_longjmp",
655 BT_FN_VOID_PTR_INT,
656 ATTR_NORETURN_NOTHROW_LIST)
657 DEF_GCC_BUILTIN(BUILT_IN_TRAP,
658 "__builtin_trap",
659 BT_FN_VOID,
660 ATTR_NORETURN_NOTHROW_LIST)
661 DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
662 "__builtin_prefetch",
663 BT_FN_VOID_CONST_PTR_VAR,
664 ATTR_NULL)
666 /* Stdio builtins. */
667 DEF_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR,
668 "__builtin_putchar",
669 BT_FN_INT_INT,
670 ATTR_NOTHROW_LIST)
671 DEF_FALLBACK_BUILTIN(BUILT_IN_PUTS,
672 "__builtin_puts",
673 BT_FN_INT_CONST_STRING,
674 ATTR_NOTHROW_LIST)
675 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF,
676 "__builtin_printf",
677 BT_FN_INT_CONST_STRING_VAR,
678 ATTR_FORMAT_PRINTF_1_2)
679 DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
680 "__builtin_fputc",
681 BT_FN_INT_INT_PTR,
682 ATTR_NOTHROW_LIST)
683 /* Declare the __builtin_ style with arguments and the regular style
684 without them. We rely on stdio.h to supply the arguments for the
685 regular style declaration since we had to use void* instead of
686 FILE* in the __builtin_ prototype supplied here. */
687 DEF_BUILTIN (BUILT_IN_FPUTS,
688 "__builtin_fputs",
689 BUILT_IN_NORMAL,
690 BT_FN_INT_CONST_STRING_PTR,
691 BT_FN_INT_VAR,
692 true, true, false, ATTR_NOTHROW_LIST, true)
693 DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
694 "__builtin_fwrite",
695 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
696 ATTR_NOTHROW_LIST)
697 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
698 "__builtin_fprintf",
699 BT_FN_INT_PTR_CONST_STRING_VAR,
700 ATTR_FORMAT_PRINTF_2_3)
702 /* Stdio unlocked builtins. */
704 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
705 "__builtin_putchar_unlocked",
706 BT_FN_INT_INT)
707 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
708 "__builtin_puts_unlocked",
709 BT_FN_INT_CONST_STRING)
710 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
711 "__builtin_printf_unlocked",
712 BT_FN_INT_CONST_STRING_VAR,
713 ATTR_FORMAT_PRINTF_1_2)
714 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
715 "__builtin_fputc_unlocked",
716 BT_FN_INT_INT_PTR)
717 /* Declare the __builtin_ style with arguments and the regular style
718 without them. We rely on stdio.h to supply the arguments for the
719 regular style declaration since we had to use void* instead of
720 FILE* in the __builtin_ prototype supplied here. */
721 DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
722 "__builtin_fputs_unlocked",
723 BUILT_IN_NORMAL,
724 BT_FN_INT_CONST_STRING_PTR,
725 BT_FN_INT_VAR,
726 true, true, true, ATTR_NOTHROW_LIST, true)
727 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
728 "__builtin_fwrite_unlocked",
729 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
730 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
731 "__builtin_fprintf_unlocked",
732 BT_FN_INT_PTR_CONST_STRING_VAR,
733 ATTR_FORMAT_PRINTF_2_3)
735 /* ISO C99 floating point unordered comparisons. */
736 DEF_GCC_BUILTIN(BUILT_IN_ISGREATER,
737 "__builtin_isgreater",
738 BT_FN_INT_VAR,
739 ATTR_CONST_NOTHROW_LIST)
740 DEF_GCC_BUILTIN(BUILT_IN_ISGREATEREQUAL,
741 "__builtin_isgreaterequal",
742 BT_FN_INT_VAR,
743 ATTR_CONST_NOTHROW_LIST)
744 DEF_GCC_BUILTIN(BUILT_IN_ISLESS,
745 "__builtin_isless",
746 BT_FN_INT_VAR,
747 ATTR_CONST_NOTHROW_LIST)
748 DEF_GCC_BUILTIN(BUILT_IN_ISLESSEQUAL,
749 "__builtin_islessequal",
750 BT_FN_INT_VAR,
751 ATTR_CONST_NOTHROW_LIST)
752 DEF_GCC_BUILTIN(BUILT_IN_ISLESSGREATER,
753 "__builtin_islessgreater",
754 BT_FN_INT_VAR,
755 ATTR_CONST_NOTHROW_LIST)
756 DEF_GCC_BUILTIN(BUILT_IN_ISUNORDERED,
757 "__builtin_isunordered",
758 BT_FN_INT_VAR,
759 ATTR_CONST_NOTHROW_LIST)
761 /* Various hooks for the DWARF 2 __throw routine. */
762 DEF_GCC_BUILTIN(BUILT_IN_UNWIND_INIT,
763 "__builtin_unwind_init",
764 BT_FN_VOID,
765 ATTR_NULL)
766 DEF_GCC_BUILTIN(BUILT_IN_DWARF_CFA,
767 "__builtin_dwarf_cfa",
768 BT_FN_PTR,
769 ATTR_NULL)
770 DEF_GCC_BUILTIN(BUILT_IN_DWARF_FP_REGNUM,
771 "__builtin_dwarf_fp_regnum",
772 BT_FN_UNSIGNED,
773 ATTR_NULL)
774 DEF_GCC_BUILTIN(BUILT_IN_INIT_DWARF_REG_SIZES,
775 "__builtin_init_dwarf_reg_size_table",
776 BT_FN_VOID_PTR,
777 ATTR_NULL)
778 DEF_GCC_BUILTIN(BUILT_IN_FROB_RETURN_ADDR,
779 "__builtin_frob_return_addr",
780 BT_FN_PTR_PTR,
781 ATTR_NULL)
782 DEF_GCC_BUILTIN(BUILT_IN_EXTRACT_RETURN_ADDR,
783 "__builtin_extract_return_addr",
784 BT_FN_PTR_PTR,
785 ATTR_NULL)
786 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN,
787 "__builtin_eh_return",
788 BT_FN_VOID_PTRMODE_PTR,
789 ATTR_NORETURN_NOTHROW_LIST)
790 DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN_DATA_REGNO,
791 "__builtin_eh_return_data_regno",
792 BT_FN_INT_INT,
793 ATTR_NULL)
795 /* Variable argument list (stdarg.h) support */
796 DEF_GCC_BUILTIN(BUILT_IN_VA_START,
797 "__builtin_va_start",
798 BT_FN_VOID_VALIST_REF_VAR,
799 ATTR_NULL)
800 DEF_GCC_BUILTIN(BUILT_IN_STDARG_START, /* backward compat */
801 "__builtin_stdarg_start",
802 BT_FN_VOID_VALIST_REF_VAR,
803 ATTR_NULL)
804 DEF_GCC_BUILTIN(BUILT_IN_VA_END,
805 "__builtin_va_end",
806 BT_FN_VOID_VALIST_REF,
807 ATTR_NULL)
808 DEF_GCC_BUILTIN(BUILT_IN_VA_COPY,
809 "__builtin_va_copy",
810 BT_FN_VOID_VALIST_REF_VALIST_ARG,
811 ATTR_NULL)
813 DEF_GCC_BUILTIN(BUILT_IN_EXPECT,
814 "__builtin_expect",
815 BT_FN_LONG_LONG_LONG,
816 ATTR_NULL)
818 /* C++ extensions */
819 DEF_UNUSED_BUILTIN(BUILT_IN_NEW)
820 DEF_UNUSED_BUILTIN(BUILT_IN_VEC_NEW)
821 DEF_UNUSED_BUILTIN(BUILT_IN_DELETE)
822 DEF_UNUSED_BUILTIN(BUILT_IN_VEC_DELETE)
824 /* Declare abort, exit, _exit and _Exit */
825 DEF_BUILTIN (BUILT_IN_ABORT,
826 "__builtin_abort",
827 NOT_BUILT_IN,
828 BT_FN_VOID,
829 BT_FN_VOID,
830 1, 0, 0,
831 ATTR_NORETURN_NOTHROW_LIST, true)
833 DEF_BUILTIN (BUILT_IN_EXIT,
834 "__builtin_exit",
835 NOT_BUILT_IN,
836 BT_FN_VOID_INT,
837 BT_FN_VOID_INT,
838 1, 0, 0,
839 ATTR_NORETURN_NOTHROW_LIST, true)
841 DEF_BUILTIN (BUILT_IN__EXIT,
842 "__builtin__exit",
843 NOT_BUILT_IN,
844 BT_FN_VOID_INT,
845 BT_FN_VOID_INT,
846 1, 0, 1,
847 ATTR_NORETURN_NOTHROW_LIST, false)
849 DEF_BUILTIN (BUILT_IN__EXIT2,
850 "__builtin__Exit",
851 NOT_BUILT_IN,
852 BT_FN_VOID_INT,
853 BT_FN_VOID_INT,
854 1, 0, !flag_isoc99,
855 ATTR_NORETURN_NOTHROW_LIST, false)