From b0160cb4a801854674765bc7f224fa818b30df0f Mon Sep 17 00:00:00 2001 From: bonzini Date: Mon, 20 Sep 2004 14:47:20 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87756 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 a175283..1a28aa2 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 8502087..dab12e6 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 3804206..a77c3be 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 a6d69e1..6824c13 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 95a4909..c717075 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 bbdfacd..4ff0ea3 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.7.4