Commit b052d8ee by Roger Sayle Committed by Roger Sayle

builtins.def (DEF_LIB_ALWAYS_BUILTIN, [...]): Delete.


	* builtins.def (DEF_LIB_ALWAYS_BUILTIN, DEF_UNUSED_BUILTIN): Delete.
	(abs, labs, fabs, fabsf, fabsl, abort, exit, _exit, _Exit):  Use
	the appropriate macro to define built-in function.
	(fmod,fmodf,fmodl): New built-in functions.

	* java/decl.c (java_init_decl_processing): Get soft_fmod_node from
	built_in_decls[BUILT_IN_FMOD] rather than define it ourselves.

	* doc/extend.texi (fmod,fmodf,fmodl): Document new built-ins.

From-SVN: r63445
parent 8d454008
2003-02-25 Roger Sayle <roger@eyesopen.com>
* builtins.def (DEF_LIB_ALWAYS_BUILTIN, DEF_UNUSED_BUILTIN): Delete.
(abs, labs, fabs, fabsf, fabsl, abort, exit, _exit, _Exit): Use
the appropriate macro to define built-in function.
(fmod,fmodf,fmodl): New built-in functions.
* doc/extend.texi (fmod,fmodf,fmodl): Document new built-ins.
2003-02-25 Richard Henderson <rth@redhat.com> 2003-02-25 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (function_arg): Pass variable sized * config/i386/i386.c (function_arg): Pass variable sized
......
...@@ -99,13 +99,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -99,13 +99,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, false, ATTRS, true) true, true, false, ATTRS, true)
/* Like DEF_LIB_BUILTIN, except that a call to the builtin should
never fall back to the library version. */
#undef DEF_LIB_ALWAYS_BUILTIN
#define DEF_LIB_ALWAYS_BUILTIN(ENUM, NAME, TYPE) \
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, false, true, ATTR_CONST_NOTHROW_LIST, true)
/* Like DEF_LIB_BUILTIN, except that the function is not one that is /* Like DEF_LIB_BUILTIN, except that the function is not one that is
specified by ANSI/ISO C. So, when we're being fully conformant we specified by ANSI/ISO C. So, when we're being fully conformant we
ignore the version of these builtins that does not begin with ignore the version of these builtins that does not begin with
...@@ -146,12 +139,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -146,12 +139,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \ DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
true, true, true, ATTRS, true) true, true, true, ATTRS, true)
/* A built-in that is not currently used. */
#undef DEF_UNUSED_BUILTIN
#define DEF_UNUSED_BUILTIN(X) \
DEF_BUILTIN (X, (const char *) NULL, NOT_BUILT_IN, BT_LAST, \
BT_LAST, false, false, false, ATTR_NOTHROW_LIST, false)
/* If SMALL_STACK is defined, then `alloca' is only defined in its /* If SMALL_STACK is defined, then `alloca' is only defined in its
`__builtin' form. */ `__builtin' form. */
#if SMALL_STACK #if SMALL_STACK
...@@ -166,22 +153,27 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_ALLOCA, ...@@ -166,22 +153,27 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_ALLOCA,
ATTR_MALLOC_NOTHROW_LIST) ATTR_MALLOC_NOTHROW_LIST)
#endif #endif
DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_ABS, DEF_LIB_BUILTIN(BUILT_IN_ABS,
"__builtin_abs", "__builtin_abs",
BT_FN_INT_INT) BT_FN_INT_INT,
DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_LABS, ATTR_CONST_NOTHROW_LIST)
"__builtin_labs", DEF_LIB_BUILTIN(BUILT_IN_LABS,
BT_FN_LONG_LONG) "__builtin_labs",
BT_FN_LONG_LONG,
DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABS, ATTR_CONST_NOTHROW_LIST)
"__builtin_fabs",
BT_FN_DOUBLE_DOUBLE) DEF_LIB_BUILTIN(BUILT_IN_FABS,
DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABSF, "__builtin_fabs",
BT_FN_DOUBLE_DOUBLE,
ATTR_CONST_NOTHROW_LIST)
DEF_C99_C90RES_BUILTIN(BUILT_IN_FABSF,
"__builtin_fabsf", "__builtin_fabsf",
BT_FN_FLOAT_FLOAT) BT_FN_FLOAT_FLOAT,
DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABSL, ATTR_CONST_NOTHROW_LIST)
DEF_C99_C90RES_BUILTIN(BUILT_IN_FABSL,
"__builtin_fabsl", "__builtin_fabsl",
BT_FN_LONG_DOUBLE_LONG_DOUBLE) BT_FN_LONG_DOUBLE_LONG_DOUBLE,
ATTR_CONST_NOTHROW_LIST)
DEF_LIB_BUILTIN(BUILT_IN_FLOOR, DEF_LIB_BUILTIN(BUILT_IN_FLOOR,
"__builtin_floor", "__builtin_floor",
...@@ -293,13 +285,6 @@ DEF_C99_BUILTIN(BUILT_IN_CIMAGL, ...@@ -293,13 +285,6 @@ DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE, BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
ATTR_CONST_NOTHROW_LIST) ATTR_CONST_NOTHROW_LIST)
DEF_UNUSED_BUILTIN(BUILT_IN_DIV)
DEF_UNUSED_BUILTIN(BUILT_IN_LDIV)
DEF_UNUSED_BUILTIN(BUILT_IN_FFLOOR)
DEF_UNUSED_BUILTIN(BUILT_IN_FCEIL)
DEF_UNUSED_BUILTIN(BUILT_IN_FMOD)
DEF_UNUSED_BUILTIN(BUILT_IN_FREM)
/* The system prototypes for `bzero' and `bcmp' functions have many /* The system prototypes for `bzero' and `bcmp' functions have many
variations, so don't specify parameters to avoid conflicts. The variations, so don't specify parameters to avoid conflicts. The
expand_* functions check the argument types anyway. */ expand_* functions check the argument types anyway. */
...@@ -501,6 +486,13 @@ DEF_LIB_BUILTIN(BUILT_IN_ATAN2, ...@@ -501,6 +486,13 @@ DEF_LIB_BUILTIN(BUILT_IN_ATAN2,
: (flag_unsafe_math_optimizations : (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)) : ATTR_PURE_NOTHROW_LIST))
DEF_LIB_BUILTIN(BUILT_IN_FMOD,
"__builtin_fmod",
BT_FN_DOUBLE_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF, DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
"__builtin_sqrtf", "__builtin_sqrtf",
BT_FN_FLOAT_FLOAT, BT_FN_FLOAT_FLOAT,
...@@ -546,6 +538,13 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2F, ...@@ -546,6 +538,13 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2F,
: (flag_unsafe_math_optimizations : (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)) : ATTR_PURE_NOTHROW_LIST))
DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODF,
"__builtin_fmodf",
BT_FN_FLOAT_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL, DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
"__builtin_sqrtl", "__builtin_sqrtl",
BT_FN_LONG_DOUBLE_LONG_DOUBLE, BT_FN_LONG_DOUBLE_LONG_DOUBLE,
...@@ -591,6 +590,13 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2L, ...@@ -591,6 +590,13 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2L,
: (flag_unsafe_math_optimizations : (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)) : ATTR_PURE_NOTHROW_LIST))
DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODL,
"__builtin_fmodl",
BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
DEF_GCC_BUILTIN(BUILT_IN_INF, DEF_GCC_BUILTIN(BUILT_IN_INF,
"__builtin_inf", "__builtin_inf",
...@@ -857,42 +863,21 @@ DEF_GCC_BUILTIN(BUILT_IN_EXPECT, ...@@ -857,42 +863,21 @@ DEF_GCC_BUILTIN(BUILT_IN_EXPECT,
BT_FN_LONG_LONG_LONG, BT_FN_LONG_LONG_LONG,
ATTR_NULL) ATTR_NULL)
/* C++ extensions */
DEF_UNUSED_BUILTIN(BUILT_IN_NEW)
DEF_UNUSED_BUILTIN(BUILT_IN_VEC_NEW)
DEF_UNUSED_BUILTIN(BUILT_IN_DELETE)
DEF_UNUSED_BUILTIN(BUILT_IN_VEC_DELETE)
/* Declare abort, exit, _exit and _Exit */ /* Declare abort, exit, _exit and _Exit */
DEF_BUILTIN (BUILT_IN_ABORT, DEF_LIB_BUILTIN(BUILT_IN_ABORT,
"__builtin_abort", "__builtin_abort",
NOT_BUILT_IN, BT_FN_VOID,
BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST)
BT_FN_VOID, DEF_LIB_BUILTIN(BUILT_IN_EXIT,
1, 0, 0, "__builtin_exit",
ATTR_NORETURN_NOTHROW_LIST, true) BT_FN_VOID_INT,
ATTR_NORETURN_NOTHROW_LIST)
DEF_BUILTIN (BUILT_IN_EXIT, DEF_EXT_LIB_BUILTIN(BUILT_IN__EXIT,
"__builtin_exit", "__builtin__exit",
NOT_BUILT_IN, BT_FN_VOID_INT,
BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST)
BT_FN_VOID_INT, DEF_C99_BUILTIN(BUILT_IN__EXIT2,
1, 0, 0, "__builtin__Exit",
ATTR_NORETURN_NOTHROW_LIST, true) BT_FN_VOID_INT,
ATTR_NORETURN_NOTHROW_LIST)
DEF_BUILTIN (BUILT_IN__EXIT,
"__builtin__exit",
NOT_BUILT_IN,
BT_FN_VOID_INT,
BT_FN_VOID_INT,
1, 0, 1,
ATTR_NORETURN_NOTHROW_LIST, false)
DEF_BUILTIN (BUILT_IN__EXIT2,
"__builtin__Exit",
NOT_BUILT_IN,
BT_FN_VOID_INT,
BT_FN_VOID_INT,
1, 0, !flag_isoc99,
ATTR_NORETURN_NOTHROW_LIST, false)
@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. @c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002,
@c 2003 Free Software Foundation, Inc.
@c This is part of the GCC manual. @c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi. @c For copying conditions, see the file gcc.texi.
...@@ -4537,6 +4538,9 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -4537,6 +4538,9 @@ v4si f (v4si a, v4si b, v4si c)
@findex atan2l @findex atan2l
@findex bcmp @findex bcmp
@findex bzero @findex bzero
@findex ceil
@findex ceilf
@findex ceill
@findex cimag @findex cimag
@findex cimagf @findex cimagf
@findex cimagl @findex cimagl
...@@ -4559,6 +4563,12 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -4559,6 +4563,12 @@ v4si f (v4si a, v4si b, v4si c)
@findex fabsf @findex fabsf
@findex fabsl @findex fabsl
@findex ffs @findex ffs
@findex floor
@findex floorf
@findex floorl
@findex fmod
@findex fmodf
@findex fmodl
@findex fprintf @findex fprintf
@findex fprintf_unlocked @findex fprintf_unlocked
@findex fputs @findex fputs
...@@ -4573,12 +4583,18 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -4573,12 +4583,18 @@ v4si f (v4si a, v4si b, v4si c)
@findex memcmp @findex memcmp
@findex memcpy @findex memcpy
@findex memset @findex memset
@findex nearbyint
@findex nearbyintf
@findex nearbyintl
@findex pow @findex pow
@findex powf @findex powf
@findex powl @findex powl
@findex printf @findex printf
@findex printf_unlocked @findex printf_unlocked
@findex rindex @findex rindex
@findex round
@findex roundf
@findex roundl
@findex sin @findex sin
@findex sinf @findex sinf
@findex sinl @findex sinl
...@@ -4598,21 +4614,9 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -4598,21 +4614,9 @@ v4si f (v4si a, v4si b, v4si c)
@findex strrchr @findex strrchr
@findex strspn @findex strspn
@findex strstr @findex strstr
@findex floor
@findex floorf
@findex floorl
@findex ceil
@findex ceilf
@findex ceill
@findex round
@findex roundf
@findex roundl
@findex trunc @findex trunc
@findex truncf @findex truncf
@findex truncl @findex truncl
@findex nearbyint
@findex nearbyintf
@findex nearbyintl
GCC provides a large number of built-in functions other than the ones GCC provides a large number of built-in functions other than the ones
mentioned above. Some of these are for internal use in the processing mentioned above. Some of these are for internal use in the processing
...@@ -4633,39 +4637,36 @@ be emitted. ...@@ -4633,39 +4637,36 @@ be emitted.
@opindex ansi @opindex ansi
@opindex std @opindex std
The functions @code{abort}, @code{exit}, @code{_Exit} and @code{_exit} Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or
are recognized and presumed not to return, but otherwise are not built @option{-std=c99}), the functions @code{alloca}, @code{bcmp},
in. @code{_exit} is not recognized in strict ISO C mode (@option{-ansi}, @code{bzero}, @code{_exit}, @code{ffs}, @code{fprintf_unlocked},
@option{-std=c89} or @option{-std=c99}). @code{_Exit} is not recognized in @code{fputs_unlocked}, @code{index}, @code{printf_unlocked},
strict C89 mode (@option{-ansi} or @option{-std=c89}). All these functions and @code{rindex} may be handled as built-in functions.
have corresponding versions prefixed with @code{__builtin_}, which may be All these functions have corresponding versions
used even in strict C89 mode.
Outside strict ISO C mode, the functions @code{alloca}, @code{bcmp},
@code{bzero}, @code{index}, @code{rindex}, @code{ffs}, @code{fputs_unlocked},
@code{printf_unlocked} and @code{fprintf_unlocked} may be handled as
built-in functions. All these functions have corresponding versions
prefixed with @code{__builtin_}, which may be used even in strict C89 prefixed with @code{__builtin_}, which may be used even in strict C89
mode. mode.
The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl}, @code{creal}, The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl}, @code{creal},
@code{crealf}, @code{creall}, @code{cimag}, @code{cimagf}, @code{cimagl}, @code{crealf}, @code{creall}, @code{cimag}, @code{cimagf}, @code{cimagl},
@code{_Exit},
@code{llabs}, @code{imaxabs}, @code{round}, @code{roundf}, @code{roundl}, @code{llabs}, @code{imaxabs}, @code{round}, @code{roundf}, @code{roundl},
@code{trunc}, @code{truncf}, @code{truncl}, @code{nearbyint}, @code{trunc}, @code{truncf}, @code{truncl}, @code{nearbyint},
@code{nearbyintf} and @code{nearbyintl} are handled as built-in functions @code{nearbyintf} and @code{nearbyintl} are handled as built-in functions
except in strict ISO C90 mode. except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
There are also built-in versions of the ISO C99 functions @code{atan2f}, There are also built-in versions of the ISO C99 functions @code{atan2f},
@code{atan2l}, @code{ceilf}, @code{ceill}, @code{cosf}, @code{cosl}, @code{atan2l}, @code{ceilf}, @code{ceill}, @code{cosf}, @code{cosl},
@code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf},
@code{floorl}, @code{logf}, @code{logl}, @code{powf}, @code{powl}, @code{floorl}, @code{fmodf}, @code{fmodl},
@code{logf}, @code{logl}, @code{powf}, @code{powl},
@code{sinf}, @code{sinl}, @code{sqrtf} and @code{sqrtl} @code{sinf}, @code{sinl}, @code{sqrtf} and @code{sqrtl}
that are recognized in any mode since ISO C90 reserves these names for that are recognized in any mode since ISO C90 reserves these names for
the purpose to which ISO C99 puts them. All these functions have the purpose to which ISO C99 puts them. All these functions have
corresponding versions prefixed with @code{__builtin_}. corresponding versions prefixed with @code{__builtin_}.
The ISO C90 functions @code{abs}, @code{atan2}, @code{ceil}, @code{cos}, The ISO C90 functions @code{abort}, @code{abs}, @code{atan2}, @code{ceil},
@code{exp}, @code{fabs}, @code{floor}, @code{cos}, @code{exit},
@code{exp}, @code{fabs}, @code{floor}, @code{fmod},
@code{fprintf}, @code{fputs}, @code{labs}, @code{log}, @code{fprintf}, @code{fputs}, @code{labs}, @code{log},
@code{memcmp}, @code{memcpy}, @code{memset}, @code{pow}, @code{printf}, @code{memcmp}, @code{memcpy}, @code{memset}, @code{pow}, @code{printf},
@code{sin}, @code{sqrt}, @code{strcat}, @code{strchr}, @code{strcmp}, @code{sin}, @code{sqrt}, @code{strcat}, @code{strchr}, @code{strcmp},
......
2003-02-25 Roger Sayle <roger@eyesopen.com>
* java/decl.c (java_init_decl_processing): Get soft_fmod_node from
built_in_decls[BUILT_IN_FMOD] rather than define it ourselves.
2003-02-23 Tom Tromey <tromey@redhat.com> 2003-02-23 Tom Tromey <tromey@redhat.com>
* lang-options.h: Added -Wdeprecated. * lang-options.h: Added -Wdeprecated.
......
...@@ -885,22 +885,6 @@ java_init_decl_processing (void) ...@@ -885,22 +885,6 @@ java_init_decl_processing (void)
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
0, NOT_BUILT_IN, NULL, NULL_TREE); 0, NOT_BUILT_IN, NULL, NULL_TREE);
t = tree_cons (NULL_TREE, double_type_node,
tree_cons (NULL_TREE, double_type_node, endlink));
soft_fmod_node
= builtin_function ("__builtin_fmod",
build_function_type (double_type_node, t),
BUILT_IN_FMOD, BUILT_IN_NORMAL, "fmod", NULL_TREE);
#if 0
t = tree_cons (NULL_TREE, float_type_node,
tree_cons (NULL_TREE, float_type_node, endlink));
soft_fmodf_node
= builtin_function ("__builtin_fmodf",
build_function_type (float_type_node, t),
BUILT_IN_FMOD, BUILT_IN_NORMAL, "fmodf", NULL_TREE);
#endif
soft_idiv_node soft_idiv_node
= builtin_function ("_Jv_divI", = builtin_function ("_Jv_divI",
build_function_type (int_type_node, t), build_function_type (int_type_node, t),
...@@ -928,8 +912,13 @@ java_init_decl_processing (void) ...@@ -928,8 +912,13 @@ java_init_decl_processing (void)
lang_eh_runtime_type = prepare_eh_table_type; lang_eh_runtime_type = prepare_eh_table_type;
init_jcf_parse (); init_jcf_parse ();
initialize_builtins (); initialize_builtins ();
soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
#if 0
soft_fmodf_node = built_in_decls[BUILT_IN_FMODF];
#endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment