From c2dda19b3b1e6e53a807ef3446c6fd8a38be93e5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 20 Sep 2004 14:47:20 +0000 Subject: [PATCH] builtins.c (fold_builtin): Call the new omonymous target hook for machine-dependent built-ins. 2004-09-20 Paolo Bonzini * builtins.c (fold_builtin): Call the new omonymous target hook for machine-dependent built-ins. * target-def.h (TARGET_FOLD_BUILTIN): New. * target.h (struct gcc_target): Add the fold_builtin hook. * targhooks.c (default_fold_builtin): New. * targhooks.h (default_fold_builtin): Declare it. From-SVN: r87756 --- gcc/ChangeLog | 9 +++++++++ gcc/builtins.c | 2 +- gcc/target-def.h | 2 ++ gcc/target.h | 3 +++ gcc/targhooks.c | 6 ++++++ gcc/targhooks.h | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a175283ffdf..1a28aa24c40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-09-20 Paolo Bonzini + + * builtins.c (fold_builtin): Call the new omonymous + target hook for machine-dependent built-ins. + * target-def.h (TARGET_FOLD_BUILTIN): New. + * target.h (struct gcc_target): Add the fold_builtin hook. + * targhooks.c (default_fold_builtin): New. + * targhooks.h (default_fold_builtin): Declare it. + 2004-09-20 Kazu Hirata * cfg.c, tree-ssa-threadupdate.c, tree-vectorizer.c: Fix diff --git a/gcc/builtins.c b/gcc/builtins.c index 8502087cc77..dab12e64be5 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8206,7 +8206,7 @@ fold_builtin_1 (tree exp, bool ignore) tree type = TREE_TYPE (TREE_TYPE (fndecl)); if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) - return 0; + return targetm.fold_builtin (exp, ignore); switch (DECL_FUNCTION_CODE (fndecl)) { diff --git a/gcc/target-def.h b/gcc/target-def.h index 38042069122..a77c3be82b1 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -287,6 +287,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* In builtins.c. */ #define TARGET_INIT_BUILTINS hook_void_void #define TARGET_EXPAND_BUILTIN default_expand_builtin +#define TARGET_FOLD_BUILTIN default_fold_builtin /* In varasm.c. */ #ifndef TARGET_SECTION_TYPE_FLAGS @@ -477,6 +478,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TARGET_ALIGN_ANON_BITFIELD, \ TARGET_INIT_BUILTINS, \ TARGET_EXPAND_BUILTIN, \ + TARGET_FOLD_BUILTIN, \ TARGET_MANGLE_FUNDAMENTAL_TYPE, \ TARGET_INIT_LIBFUNCS, \ TARGET_SECTION_TYPE_FLAGS, \ diff --git a/gcc/target.h b/gcc/target.h index a6d69e1938e..6824c13562e 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -324,6 +324,9 @@ struct gcc_target rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore); + /* Fold a target-specific builtin. */ + tree (* fold_builtin) (tree exp, bool ignore); + /* For a vendor-specific fundamental TYPE, return a pointer to a statically-allocated string containing the C++ mangling for TYPE. In all other cases, return NULL. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 95a4909d43b..c7170752444 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -97,6 +97,12 @@ default_expand_builtin_saveregs (void) return const0_rtx; } +tree +default_fold_builtin (tree t ATTRIBUTE_UNUSED, bool ignore ATTRIBUTE_UNUSED) +{ + return NULL_TREE; +} + void default_setup_incoming_varargs (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, diff --git a/gcc/targhooks.h b/gcc/targhooks.h index bbdfacdc0a5..4ff0ea36af8 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -29,6 +29,7 @@ extern rtx default_expand_builtin_saveregs (void); extern void default_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); extern rtx default_builtin_setjmp_frame_value (void); extern bool default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *); +extern tree default_fold_builtin (tree t, bool ignore); extern enum machine_mode default_eh_return_filter_mode (void); extern unsigned HOST_WIDE_INT default_shift_truncation_mask -- 2.30.2