target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.

* target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.
	* builtins.c (default_libc_has_function): New.
	(gnu_libc_has_function): Ditto.
	(no_c99_libc_has_function): Ditto.
	(expand_builtin_cexpi): Using new target hook TARGET_LIBC_HAS_FUNCTION
	instead of TARGET_HAS_SINCOS and TARGET_C99_FUNCTIONS.
	(fold_builtin_sincos): Likewise.
	(fold_builtin_cexp): Likewise.
	* builtins.def (DEF_C94_BUILTIN): Likewise.
	(DEF_C99_BUILTIN): Likewise.
	(DEF_C99_C90RES_BUILTIN): Likewise.
	(DEF_C99_COMPL_BUILTIN): New define. Change all complex c99 builtin
	definitions to using this define.
	* config/darwin-protos.h (darwin_libc_has_function): New.
	* config/darwin.c: (darwin_libc_has_function: Ditto.
	* config/alpha/linux.h: Remove TARGET_C99_FUNCTIONS and
	TARGET_HAS_SINCOS. Redefine TARGET_LIBC_HAS_FUNCTION.
	* config/darwin.h: Ditto.
	* config/elfos.h: Ditto.
	* config/freebsd.h: Ditto.
	* config/i386/cygming.h: Ditto.
	* config/i386/djgpp.h: Ditto.
	* config/i386/i386-interix.h: Ditto.
	* config/microblaze/microblaze.h: Ditto.
	* config/mmix/mmix.h: Ditto.
	* config/gnu-user.h: Ditto.
	* config/ia64/hpux.h: Ditto.
	* config/pa/pa-hpux.h: Ditto.
	* config/pdp11/pdp11.h: Ditto.
	* config/picochip/picochip.h: Ditto.
	* config/linux.h: Ditto.
	* config/netbsd.h: Ditto.
	* config/openbsd.h: Ditto.
	* config/rs6000/aix43.h: Ditto.
	* config/rs6000/aix51.h: Ditto.
	* config/rs6000/aix52.h: Ditto.
	* config/rs6000/aix53.h: Ditto.
	* config/rs6000/aix61.h: Ditto.
	* config/rs6000/darwin.h: Ditto.
	* config/rs6000/linux.h: Ditto.
	* config/rs6000/linux64.h: Ditto.
	* config/s390/tpf.h: Ditto.
	* config/sol2-10.h: Ditto.
	* config/sol2.h: Ditto.
	* config/vms/vms.h: Ditto.
	* config/vxworks.h: Ditto.
	* config/linux-android.c (linux_android_libc_has_function):
	New linux-specific implementation of TARGET_LIBC_HAS_FUNCTION.
	* config/linux-protos.h (linux_android_libc_has_function):
	New declaration.
	* config/i386/i386.c (ix86_libc_has_function): New.
	* config/i386/i386-protos.h
	(ix86_libc_has_function): New declaration.
	* config/i386/i386.md
	("isinfxf2"): Change condition for TARGET_LIBC_HAS_FUNCTION.
	("isinf<mode>2): Likewise.
	* convert.c (convert_to_integer): Using new target hook
	TARGET_LIBC_HAS_FUNCTION istead of TARGET_HAS_SINCOS and
	TARGET_C99_FUNCTIONS.
	* fortran/f95-lang.c (gfc_init_builtin_functions): Ditto.
	* tree-ssa-math-opts.c (execute_cse_sincos): Ditto.
	* coretypes.h (function_class): New enum for different
	classes of functions.
	* defaults.h: Remove TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS.
	* doc/tm.texi.in (TARGET_C99_FUNCTIONS): Remove documentation.
	(TARGET_HAS_SINCOS): Likewise.
	(TARGET_LIBC_HAS_FUNCTION): New.
	* doc/tm.texi: Regenerated.
	* targhooks.h (default_libc_has_function): New declaration.
	(no_c99_libc_has_function): Ditto.
	(gnu_libc_has_function): Ditto.
	* system.h: Add the poisoning of TARGET_C99_FUNCTIONS
	and TARGET_HAS_SINCOS.

From-SVN: r201838
This commit is contained in:
Alexander Ivchenko 2013-08-19 12:21:26 +00:00 committed by Kirill Yukhin
parent 89138a6e3e
commit d33d9e47d4
50 changed files with 356 additions and 207 deletions

View File

@ -1,3 +1,79 @@
2013-08-19 Alexander Ivchenko <alexander.ivchenko@intel.com>
* target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.
* builtins.c (default_libc_has_function): New.
(gnu_libc_has_function): Ditto.
(no_c99_libc_has_function): Ditto.
(expand_builtin_cexpi): Using new target hook TARGET_LIBC_HAS_FUNCTION
instead of TARGET_HAS_SINCOS and TARGET_C99_FUNCTIONS.
(fold_builtin_sincos): Likewise.
(fold_builtin_cexp): Likewise.
* builtins.def (DEF_C94_BUILTIN): Likewise.
(DEF_C99_BUILTIN): Likewise.
(DEF_C99_C90RES_BUILTIN): Likewise.
(DEF_C99_COMPL_BUILTIN): New define. Change all complex c99 builtin
definitions to using this define.
* config/darwin-protos.h (darwin_libc_has_function): New.
* config/darwin.c: (darwin_libc_has_function: Ditto.
* config/alpha/linux.h: Remove TARGET_C99_FUNCTIONS and
TARGET_HAS_SINCOS. Redefine TARGET_LIBC_HAS_FUNCTION.
* config/darwin.h: Ditto.
* config/elfos.h: Ditto.
* config/freebsd.h: Ditto.
* config/i386/cygming.h: Ditto.
* config/i386/djgpp.h: Ditto.
* config/i386/i386-interix.h: Ditto.
* config/microblaze/microblaze.h: Ditto.
* config/mmix/mmix.h: Ditto.
* config/gnu-user.h: Ditto.
* config/ia64/hpux.h: Ditto.
* config/pa/pa-hpux.h: Ditto.
* config/pdp11/pdp11.h: Ditto.
* config/picochip/picochip.h: Ditto.
* config/linux.h: Ditto.
* config/netbsd.h: Ditto.
* config/openbsd.h: Ditto.
* config/rs6000/aix43.h: Ditto.
* config/rs6000/aix51.h: Ditto.
* config/rs6000/aix52.h: Ditto.
* config/rs6000/aix53.h: Ditto.
* config/rs6000/aix61.h: Ditto.
* config/rs6000/darwin.h: Ditto.
* config/rs6000/linux.h: Ditto.
* config/rs6000/linux64.h: Ditto.
* config/s390/tpf.h: Ditto.
* config/sol2-10.h: Ditto.
* config/sol2.h: Ditto.
* config/vms/vms.h: Ditto.
* config/vxworks.h: Ditto.
* config/linux-android.c (linux_android_libc_has_function):
New linux-specific implementation of TARGET_LIBC_HAS_FUNCTION.
* config/linux-protos.h (linux_android_libc_has_function):
New declaration.
* config/i386/i386.c (ix86_libc_has_function): New.
* config/i386/i386-protos.h
(ix86_libc_has_function): New declaration.
* config/i386/i386.md
("isinfxf2"): Change condition for TARGET_LIBC_HAS_FUNCTION.
("isinf<mode>2): Likewise.
* convert.c (convert_to_integer): Using new target hook
TARGET_LIBC_HAS_FUNCTION istead of TARGET_HAS_SINCOS and
TARGET_C99_FUNCTIONS.
* fortran/f95-lang.c (gfc_init_builtin_functions): Ditto.
* tree-ssa-math-opts.c (execute_cse_sincos): Ditto.
* coretypes.h (function_class): New enum for different
classes of functions.
* defaults.h: Remove TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS.
* doc/tm.texi.in (TARGET_C99_FUNCTIONS): Remove documentation.
(TARGET_HAS_SINCOS): Likewise.
(TARGET_LIBC_HAS_FUNCTION): New.
* doc/tm.texi: Regenerated.
* targhooks.h (default_libc_has_function): New declaration.
(no_c99_libc_has_function): Ditto.
(gnu_libc_has_function): Ditto.
* system.h: Add the poisoning of TARGET_C99_FUNCTIONS
and TARGET_HAS_SINCOS.
2013-08-18 Jan Hubicka <jh@suse.cz>
* Makeifle-in (ipa-devirt.o): New.
@ -12761,21 +12837,21 @@
2013-03-27 Alexander Ivchenko <alexander.ivchenko@intel.com>
* target.def (TARGET_HAS_IFUNC_P): New target hook.
* doc/tm.texi.in (TARGET_HAS_IFUNC_P): New.
* doc/tm.texi: Regenerate.
* targhooks.h (default_has_ifunc_p): New.
* targhooks.c (default_has_ifunc_p): Ditto.
* config/linux-protos.h: New file.
* config/linux-android.h (TARGET_HAS_IFUNC_P): Using version of
* gcc/target.def (TARGET_HAS_IFUNC_P): New target hook.
* gcc/doc/tm.texi.in (TARGET_HAS_IFUNC_P): New.
* gcc/doc/tm.texi: Regenerate.
* gcc/targhooks.h (default_has_ifunc_p): New.
* gcc/targhooks.c (default_has_ifunc_p): Ditto.
* gcc/config/linux-protos.h: New file.
* gcc/config/linux-android.h (TARGET_HAS_IFUNC_P): Using version of
this hook for linux which disables support of indirect functions in
android.
* config/linux-android.c: New file.
* config/t-linux-android.c: Ditto.
* config.gcc: Added new object file linux-android.o.
* config/i386/i386.c (ix86_get_function_versions_dispatcher):
* gcc/config/linux-android.c: New file.
* gcc/config/t-linux-android.c: Ditto.
* gcc/config.gcc: Added new object file linux-android.o.
* gcc/config/i386/i386.c (ix86_get_function_versions_dispatcher):
Using TARGET_HAS_IFUNC hook instead of HAVE_GNU_INDIRECT_FUNCTION.
* varasm.c (do_assemble_alias): Likewise.
* gcc/varasm.c (do_assemble_alias): Likewise.
* configure.ac: Define HAVE_GNU_INDIRECT_FUNCTION as zero if the target
doesn't support indirect functions.
* configure: Regenerate.

View File

@ -249,6 +249,30 @@ is_builtin_fn (tree decl)
return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl);
}
/* By default we assume that c99 functions are present at the runtime,
but sincos is not. */
bool
default_libc_has_function (enum function_class fn_class)
{
if (fn_class == function_c94
|| fn_class == function_c99_misc
|| fn_class == function_c99_math_complex)
return true;
return false;
}
bool
gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
{
return true;
}
bool
no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
{
return false;
}
/* Return true if NODE should be considered for inline expansion regardless
of the optimization level. This means whenever a function is invoked with
@ -2548,7 +2572,7 @@ expand_builtin_cexpi (tree exp, rtx target)
/* Compute into op1 and op2. */
expand_twoval_unop (sincos_optab, op0, op2, op1, 0);
}
else if (TARGET_HAS_SINCOS)
else if (targetm.libc_has_function (function_sincos))
{
tree call, fn = NULL_TREE;
tree top1, top2;
@ -7810,7 +7834,7 @@ fold_builtin_sincos (location_t loc,
return res;
/* Canonicalize sincos to cexpi. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_math_complex))
return NULL_TREE;
fn = mathfn_built_in (type, BUILT_IN_CEXPI);
if (!fn)
@ -7850,7 +7874,7 @@ fold_builtin_cexp (location_t loc, tree arg0, tree type)
/* In case we can figure out the real part of arg0 and it is constant zero
fold to cexpi. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_math_complex))
return NULL_TREE;
ifn = mathfn_built_in (rtype, BUILT_IN_CEXPI);
if (!ifn)

View File

@ -102,14 +102,20 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C94_BUILTIN
#define DEF_C94_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, !flag_isoc94, ATTRS, TARGET_C99_FUNCTIONS, true)
true, true, !flag_isoc94, ATTRS, targetm.libc_has_function (function_c94), true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C99 or above. */
#undef DEF_C99_BUILTIN
#define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
/* Like DEF_C99_BUILTIN, but for complex math functions. */
#undef DEF_C99_COMPL_BUILTIN
#define DEF_C99_COMPL_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_math_complex), true)
/* Builtin that is specified by C99 and C90 reserve the name for future use.
We can still recognize the builtin in C90 mode but we can't produce it
@ -117,7 +123,7 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C99_C90RES_BUILTIN
#define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
/* Builtin that C99 reserve the name for future use. We can still recognize
the builtin in C99 mode but we can't produce it implicitly. */
@ -463,78 +469,78 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_YNF, "ynf", BT_FN_FLOAT_INT_FLOAT, ATTR_MATHFN_
DEF_EXT_LIB_BUILTIN (BUILT_IN_YNL, "ynl", BT_FN_LONGDOUBLE_INT_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
/* Category: _Complex math builtins. */
DEF_C99_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPI, "cexpi", BT_FN_COMPLEX_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIF, "cexpif", BT_FN_COMPLEX_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIL, "cexpil", BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CIMAG, "cimag", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CIMAGF, "cimagf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CIMAGL, "cimagl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAG, "cimag", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAGF, "cimagf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAGL, "cimagl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10, "clog10", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10F, "clog10f", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10L, "clog10l", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CONJ, "conj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CONJF, "conjf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CONJL, "conjl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_CSIN, "csin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSINF, "csinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJ, "conj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJF, "conjf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJL, "conjl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSIN, "csin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINF, "csinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
/* Category: string/memory builtins. */
/* bcmp, bcopy and bzero have traditionally accepted NULL pointers

View File

@ -63,12 +63,10 @@ along with GCC; see the file COPYING3. If not see
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
/* Determine whether the entire c99 runtime is present in the
runtime library. */
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
/* Whether we have sincos that follows the GNU extension. */
#define TARGET_HAS_SINCOS (OPTION_GLIBC)
/* Determine what functions are present at the runtime;
this includes full c99 runtime and sincos. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#define TARGET_POSIX_IO

View File

@ -123,3 +123,4 @@ extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
extern void darwin_patch_builtins (void);
extern void darwin_rename_builtins (void);
extern bool darwin_libc_has_function (enum function_class fn_class);

View File

@ -3357,6 +3357,19 @@ darwin_rename_builtins (void)
}
}
bool
darwin_libc_has_function (enum function_class fn_class)
{
if (fn_class == function_sincos)
return false;
if (fn_class == function_c99_math_complex
|| fn_class == function_c99_misc)
return (TARGET_64BIT
|| strverscmp (darwin_macosx_version_min, "10.3") >= 0);
return true;
}
static hashval_t
cfstring_hash (const void *ptr)
{

View File

@ -874,10 +874,6 @@ void add_framework_path (char *);
#define TARGET_POSIX_IO
/* All new versions of Darwin have C99 functions. */
#define TARGET_C99_FUNCTIONS 1
#define WINT_TYPE "int"
/* Every program on darwin links against libSystem which contains the pthread

View File

@ -433,3 +433,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
default_elf_asm_output_external (FILE, DECL, NAME)
#endif
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -52,6 +52,9 @@ along with GCC; see the file COPYING3. If not see
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
#endif
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* Use --as-needed -lgcc_s for eh support. */
#ifdef HAVE_LD_AS_NEEDED
#define USE_LD_AS_NEEDED 1

View File

@ -104,8 +104,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_POSIX_IO
#define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_SINCOS 1
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
/* Link -lasan early on the command line. For -static-libasan, don't link
it for -shared link, the executable should be compiled with -static-libasan

View File

@ -171,6 +171,9 @@ along with GCC; see the file COPYING3. If not see
#undef MATH_LIBRARY
#define MATH_LIBRARY ""
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")

View File

@ -127,6 +127,9 @@ along with GCC; see the file COPYING3. If not see
in libgcc, nor call one in main(). */
#define HAS_INIT_SECTION
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* Definitions for types and sizes. Wide characters are 16-bits long so
Win32 compiler add-ons will be wide character compatible. */
#undef WCHAR_TYPE_SIZE

View File

@ -143,6 +143,9 @@ do { \
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* The following are needed for us to be able to use winnt.c, but are not
otherwise meaningful to Interix. (The functions that use these are
never called because we don't do DLLs.) */

View File

@ -173,6 +173,8 @@ extern int ix86_mode_after (int, int, rtx);
extern int ix86_mode_entry (int);
extern int ix86_mode_exit (int);
extern bool ix86_libc_has_function (enum function_class fn_class);
#ifdef HARD_CONST
extern void ix86_emit_mode_set (int, int, HARD_REG_SET);
#endif

View File

@ -5729,6 +5729,14 @@ ix86_function_type_abi (const_tree fntype)
return ix86_abi;
}
/* We add this as a workaround in order to use libc_has_function
hook in i386.md. */
bool
ix86_libc_has_function (enum function_class fn_class)
{
return targetm.libc_has_function (fn_class);
}
static bool
ix86_function_ms_hook_prologue (const_tree fn)
{

View File

@ -14909,7 +14909,7 @@
[(use (match_operand:SI 0 "register_operand"))
(use (match_operand:XF 1 "register_operand"))]
"TARGET_USE_FANCY_MATH_387
&& TARGET_C99_FUNCTIONS"
&& ix86_libc_has_function (function_c99_misc)"
{
rtx mask = GEN_INT (0x45);
rtx val = GEN_INT (0x05);
@ -14935,7 +14935,7 @@
[(use (match_operand:SI 0 "register_operand"))
(use (match_operand:MODEF 1 "nonimmediate_operand"))]
"TARGET_USE_FANCY_MATH_387
&& TARGET_C99_FUNCTIONS
&& ix86_libc_has_function (function_c99_misc)
&& !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
{
rtx mask = GEN_INT (0x45);

View File

@ -179,9 +179,10 @@ do { \
#undef TARGET_ASM_RELOC_RW_MASK
#define TARGET_ASM_RELOC_RW_MASK ia64_hpux_reloc_rw_mask
/* ia64 HPUX has the float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
/* ia64 HPUX has the float and long double forms of math functions.
We redefine this hook so the version from elfos.h header won't be used. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION default_c99_libc_has_function
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS ia64_hpux_init_libfuncs

View File

@ -31,3 +31,17 @@ linux_android_has_ifunc_p (void)
{
return TARGET_ANDROID ? false : HAVE_GNU_INDIRECT_FUNCTION;
}
bool
linux_android_libc_has_function (enum function_class fn_class)
{
if (OPTION_GLIBC)
return true;
if (OPTION_BIONIC)
if (fn_class == function_c94
|| fn_class == function_c99_misc
|| fn_class == function_sincos)
return true;
return false;
}

View File

@ -19,3 +19,5 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
extern bool linux_android_has_ifunc_p (void);
extern bool linux_android_libc_has_function (enum function_class fn_class);

View File

@ -95,15 +95,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
BIONIC_DYNAMIC_LINKERX32)
/* Determine whether the entire c99 runtime
is present in the runtime library. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
/* Whether we have sincos that follows the GNU extension. */
#undef TARGET_HAS_SINCOS
#define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
/* Whether we have Bionic libc runtime */
#undef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC (OPTION_BIONIC)
/* Determine what functions are present at the runtime;
this includes full c99 runtime and sincos. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function

View File

@ -892,6 +892,10 @@ do { \
%{pg:-start-group -lxilprofile -lgloss -lxil -lc -lm -end-group } \
%{!pg:-start-group -lgloss -lxil -lc -lm -end-group }} "
/* microblaze-unknown-elf target has no support of C99 runtime */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"

View File

@ -813,6 +813,10 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
#define NO_IMPLICIT_EXTERN_C
/* mmix-knuth-mmixware target has no support of C99 runtime */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* These are checked. */
#define DOLLARS_IN_IDENTIFIERS 0
#define NO_DOLLAR_IN_LABEL

View File

@ -139,6 +139,9 @@ along with GCC; see the file COPYING3. If not see
#undef LIBGCC_SPEC
#define LIBGCC_SPEC NETBSD_LIBGCC_SPEC
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* When building shared libraries, the initialization and finalization
functions for the library are .init and .fini respectively. */

View File

@ -145,8 +145,10 @@ while (0)
#define TARGET_POSIX_IO
/* All new versions of OpenBSD have C99 functions. */
#define TARGET_C99_FUNCTIONS 1
/* All new versions of OpenBSD have C99 functions. We redefine this hook
so the version from elfos.h header won't be used. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
/* Runtime target specification. */

View File

@ -114,3 +114,6 @@ along with GCC; see the file COPYING3. If not see
compatibility with the HP-UX unwind library. */
#undef TARGET_HPUX_UNWIND_LIBRARY
#define TARGET_HPUX_UNWIND_LIBRARY 1
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -666,3 +666,7 @@ extern rtx cc0_reg_rtx;
#define COMPARE_FLAG_MODE HImode
#define TARGET_HAVE_NAMED_SECTIONS false
/* pdp11-unknown-aout target has no support of C99 runtime */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -656,4 +656,8 @@ enum picochip_builtins
not detecting this. */
#define HAVE_AS_LEB128 1
/* picochip-unknown-none target has no support of C99 runtime */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* The End */

View File

@ -159,3 +159,6 @@ do { \
#define TARGET_USES_AIX64_OPT 1
#define TARGET_AIX_VERSION 43
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -163,3 +163,6 @@ do { \
#define TARGET_USE_JCR_SECTION 0
#define TARGET_AIX_VERSION 51
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -166,10 +166,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
/* AIX 5.2 has the float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
#ifndef _AIX52
extern long long int atoll(const char *);
#endif

View File

@ -166,10 +166,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
/* AIX 5.2 has the float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
#ifndef _AIX52
extern long long int atoll(const char *);
#endif

View File

@ -190,10 +190,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
/* AIX 5.2 has the float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
#ifndef _AIX52
extern long long int atoll(const char *);
#endif

View File

@ -386,10 +386,8 @@ extern int darwin_emit_branch_islands;
#define OFFS_ASSIGNIVAR_FAST 0xFFFEFEC0
/* Old versions of Mac OS/Darwin don't have C99 functions available. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS \
(TARGET_64BIT \
|| strverscmp (darwin_macosx_version_min, "10.3") >= 0)
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION darwin_libc_has_function
/* When generating kernel code or kexts, we don't use Altivec by
default, as kernel code doesn't save/restore those registers. */

View File

@ -32,13 +32,10 @@
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
/* glibc has float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
/* Whether we have sincos that follows the GNU extension. */
#undef TARGET_HAS_SINCOS
#define TARGET_HAS_SINCOS (OPTION_GLIBC)
/* Determine what functions are present at the runtime;
this includes full c99 runtime and sincos. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \

View File

@ -292,13 +292,10 @@ extern int dot_symbols;
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
/* glibc has float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
/* Whether we have sincos that follows the GNU extension. */
#undef TARGET_HAS_SINCOS
#define TARGET_HAS_SINCOS (OPTION_GLIBC)
/* Determine what functions are present at the runtime;
this includes full c99 runtime and sincos. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \

View File

@ -94,9 +94,6 @@ along with GCC; see the file COPYING3. If not see
#define ASM_SPEC "%{m31&m64}%{mesa&mzarch}%{march=*} \
-alshd=%b.lst"
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
#define ENTRY_SPEC "%{mmain:-entry=_start} \
%{!mmain:-entry=0}"
@ -115,3 +112,7 @@ along with GCC; see the file COPYING3. If not see
#define MATH_LIBRARY "CLBM"
#define LIBSTDCXX "CPP2"
#endif /* ! _TPF_H */
/* We redefine this hook so the version from elfos.h header won't be used. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function

View File

@ -18,5 +18,7 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Solaris 10 has the float and long double forms of math functions. */
#define TARGET_C99_FUNCTIONS 1
/* /* Solaris 10 has the float and long double forms of math functions.
We redefine this hook so the version from elfos.h header won't be used. */
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function

View File

@ -285,6 +285,9 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_POSIX_IO
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
extern GTY(()) tree solaris_pending_aligns;
extern GTY(()) tree solaris_pending_inits;
extern GTY(()) tree solaris_pending_finis;

View File

@ -87,3 +87,6 @@ extern void vms_c_register_includes (const char *, const char *, int);
/* Special VMS debugger symbol to record the entry point. */
#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function

View File

@ -114,6 +114,9 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
/* Both kernels and RTPs have the facilities required by this macro. */
#define TARGET_POSIX_IO

View File

@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "convert.h"
#include "diagnostic-core.h"
#include "target.h"
#include "langhooks.h"
/* Convert EXPR to some pointer or reference type TYPE.
@ -386,7 +387,7 @@ convert_to_integer (tree type, tree expr)
{
CASE_FLT_FN (BUILT_IN_CEIL):
/* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@ -402,7 +403,7 @@ convert_to_integer (tree type, tree expr)
CASE_FLT_FN (BUILT_IN_FLOOR):
/* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@ -418,7 +419,7 @@ convert_to_integer (tree type, tree expr)
CASE_FLT_FN (BUILT_IN_ROUND):
/* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@ -439,7 +440,7 @@ convert_to_integer (tree type, tree expr)
/* ... Fall through ... */
CASE_FLT_FN (BUILT_IN_RINT):
/* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)

View File

@ -189,6 +189,15 @@ union _dont_use_tree_here_;
#endif
/* Classes of functions that compiler needs to check
whether they are present at the runtime or not. */
enum function_class {
function_c94,
function_c99_misc,
function_c99_math_complex,
function_sincos
};
/* Memory model types for the __atomic* builtins.
This must match the order in libstdc++-v3/include/bits/atomic_base.h. */
enum memmodel

View File

@ -1040,18 +1040,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif /* old constraint mechanism in use */
/* Determine whether the entire c99 runtime
is present in the runtime library. */
#ifndef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 0
#endif
/* Determine whether the target runtime library has
a sincos implementation following the GNU extension. */
#ifndef TARGET_HAS_SINCOS
#define TARGET_HAS_SINCOS 0
#endif
/* Determin whether the target runtime library is Bionic */
#ifndef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC 0

View File

@ -5358,26 +5358,10 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
@cindex C99 math functions, implicit usage
@defmac TARGET_C99_FUNCTIONS
When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
@code{sinf} and similarly for other functions defined by C99 standard. The
default is zero because a number of existing systems lack support for these
functions in their runtime so this macro needs to be redefined to one on
systems that do support the C99 runtime.
@end defmac
@cindex sincos math function, implicit usage
@defmac TARGET_HAS_SINCOS
When this macro is nonzero, GCC will implicitly optimize calls to @code{sin}
and @code{cos} with the same argument to a call to @code{sincos}. The
default is zero. The target has to provide the following functions:
@smallexample
void sincos(double x, double *sin, double *cos);
void sincosf(float x, float *sin, float *cos);
void sincosl(long double x, long double *sin, long double *cos);
@end smallexample
@end defmac
@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FUNCTION (enum function_class @var{fn_class})
This hook determines whether a function from a class of functions
@var{fn_class} is present at the runtime.
@end deftypefn
@defmac NEXT_OBJC_RUNTIME
Set this macro to 1 to use the "NeXT" Objective-C message sending conventions

View File

@ -4221,26 +4221,7 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
@cindex C99 math functions, implicit usage
@defmac TARGET_C99_FUNCTIONS
When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
@code{sinf} and similarly for other functions defined by C99 standard. The
default is zero because a number of existing systems lack support for these
functions in their runtime so this macro needs to be redefined to one on
systems that do support the C99 runtime.
@end defmac
@cindex sincos math function, implicit usage
@defmac TARGET_HAS_SINCOS
When this macro is nonzero, GCC will implicitly optimize calls to @code{sin}
and @code{cos} with the same argument to a call to @code{sincos}. The
default is zero. The target has to provide the following functions:
@smallexample
void sincos(double x, double *sin, double *cos);
void sincosf(float x, float *sin, float *cos);
void sincosl(long double x, long double *sin, long double *cos);
@end smallexample
@end defmac
@hook TARGET_LIBC_HAS_FUNCTION
@defmac NEXT_OBJC_RUNTIME
Set this macro to 1 to use the "NeXT" Objective-C message sending conventions

View File

@ -826,7 +826,7 @@ gfc_init_builtin_functions (void)
BUILT_IN_POWIF, "powif", ATTR_CONST_NOTHROW_LEAF_LIST);
if (TARGET_C99_FUNCTIONS)
if (targetm.libc_has_function (function_c99_math_complex))
{
gfc_define_builtin ("__builtin_cbrtl", mfunc_longdouble[0],
BUILT_IN_CBRTL, "cbrtl",
@ -848,7 +848,7 @@ gfc_init_builtin_functions (void)
ATTR_CONST_NOTHROW_LEAF_LIST);
}
if (TARGET_HAS_SINCOS)
if (targetm.libc_has_function (function_sincos))
{
gfc_define_builtin ("__builtin_sincosl",
func_longdouble_longdoublep_longdoublep,

View File

@ -914,7 +914,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
USE_COMMON_FOR_ONE_ONLY IFCVT_EXTRA_FIELDS IFCVT_INIT_EXTRA_FIELDS \
CASE_USE_BIT_TESTS FIXUNS_TRUNC_LIKE_FIX_TRUNC \
GO_IF_MODE_DEPENDENT_ADDRESS DELAY_SLOTS_FOR_EPILOGUE \
ELIGIBLE_FOR_EPILOGUE_DELAY
ELIGIBLE_FOR_EPILOGUE_DELAY TARGET_C99_FUNCTIONS TARGET_HAS_SINCOS
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \

View File

@ -2201,6 +2201,13 @@ set via @code{__attribute__}.",
unsigned int, (tree decl, const char *name, int reloc),
default_section_type_flags)
DEFHOOK
(libc_has_function,
"This hook determines whether a function from a class of functions\n\
@var{fn_class} is present at the runtime.",
bool, (enum function_class fn_class),
default_libc_has_function)
/* True if new jumps cannot be created, to replace existing ones or
not, at the current point in the compilation. */
DEFHOOK

View File

@ -166,6 +166,10 @@ extern rtx default_addr_space_convert (rtx, tree, tree);
extern unsigned int default_case_values_threshold (void);
extern bool default_have_conditional_execution (void);
extern bool default_libc_has_function (enum function_class);
extern bool no_c99_libc_has_function (enum function_class);
extern bool gnu_libc_has_function (enum function_class);
extern tree default_builtin_tm_load_store (tree);
extern int default_memory_move_cost (enum machine_mode, reg_class_t, bool);

View File

@ -1432,7 +1432,8 @@ execute_cse_sincos (void)
CASE_FLT_FN (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_CEXPI):
/* Make sure we have either sincos or cexp. */
if (!TARGET_HAS_SINCOS && !TARGET_C99_FUNCTIONS)
if (!targetm.libc_has_function (function_c99_math_complex)
&& !targetm.libc_has_function (function_sincos))
break;
arg = gimple_call_arg (stmt, 0);