This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Hookize BUILTIN_SETJMP_FRAME_VALUE.


Hi Daniel,

> > Attached is a patch to remove BUILTIN_SETJMP_FRAME_VALUE as there is
> > only a single definition of the macro.
> > 
> > i960 port used to use this, but it's gone now.
> > 
> > Bootstrapped on i686-pc-linux-gnu.  OK to apply?
> 
> Actually, I'd rather you didn't.  I have a patch in my queue (alluded
> to in one of my recent ARM bug reports, I think) where I need to define
> this.

Do you mind if I hookize like so?  You would have to adjust your
patch, but I am hoping that's not too bad.  Otherwise, I could do this
after you check in your patch.

Bootstrapped on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-03-02  Kazu Hirata  <kazu@cs.umass.edu>

	* builtins.c (BUILTIN_SETJMP_FRAME_VALUE): Remove.
	(expand_builtin_setjmp_setup): Use
	targetm.builtin_setjmp_frame_value instead of
	BUILTIN_SETJMP_FRAME_VALUE.
	* system.h (BUILTIN_SETJMP_FRAME_VALUE): Poison.
	* target-def.h (TARGET_BUILTIN_SETJMP_FRAME_VALUE): New.
	(TARGET_INITIALIZER): Add TARGET_BUILTIN_SETJMP_FRAME_VALUE.
	* target.h (gcc_target): Add builtin_setjmp_frame_value.
	* targhooks.c (default_builtin_setjmp_frame_value): New.
	* targhooks.h: Add a prototype for
	default_builtin_setjmp_frame_value.
	* doc/tm.texi (BUILTIN_SETJMP_FRAME_VALUE): Change to
	TARGET_BUILTIN_SETJMP_FRAME_VALUE.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.287
diff -u -r1.287 builtins.c
--- builtins.c	26 Feb 2004 23:44:26 -0000	1.287
+++ builtins.c	2 Mar 2004 18:14:45 -0000
@@ -490,13 +490,9 @@
      the buffer and use the rest of it for the stack save area, which
      is machine-dependent.  */
 
-#ifndef BUILTIN_SETJMP_FRAME_VALUE
-#define BUILTIN_SETJMP_FRAME_VALUE virtual_stack_vars_rtx
-#endif
-
   mem = gen_rtx_MEM (Pmode, buf_addr);
   set_mem_alias_set (mem, setjmp_alias_set);
-  emit_move_insn (mem, BUILTIN_SETJMP_FRAME_VALUE);
+  emit_move_insn (mem, targetm.builtin_setjmp_frame_value ());
 
   mem = gen_rtx_MEM (Pmode, plus_constant (buf_addr, GET_MODE_SIZE (Pmode))),
   set_mem_alias_set (mem, setjmp_alias_set);
Index: system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.203
diff -u -r1.203 system.h
--- system.h	2 Mar 2004 04:54:56 -0000	1.203
+++ system.h	2 Mar 2004 18:14:46 -0000
@@ -640,7 +640,7 @@
 	MAX_WCHAR_TYPE_SIZE GCOV_TYPE_SIZE SHARED_SECTION_ASM_OP	   \
 	FINAL_REG_PARM_STACK_SPACE MAYBE_REG_PARM_STACK_SPACE		   \
 	TRADITIONAL_PIPELINE_INTERFACE DFA_PIPELINE_INTERFACE		   \
-	DBX_OUTPUT_STANDARD_TYPES
+	DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
Index: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.70
diff -u -r1.70 target-def.h
--- target-def.h	24 Feb 2004 17:28:28 -0000	1.70
+++ target-def.h	2 Mar 2004 18:14:46 -0000
@@ -331,6 +331,8 @@
 
 #define TARGET_DEFAULT_SHORT_ENUMS hook_bool_void_false
 
+#define TARGET_BUILTIN_SETJMP_FRAME_VALUE default_builtin_setjmp_frame_value
+
 #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false
 #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_false
 #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false
@@ -397,6 +399,7 @@
   TARGET_GET_PCH_VALIDITY,			\
   TARGET_PCH_VALID_P,				\
   TARGET_DEFAULT_SHORT_ENUMS,			\
+  TARGET_BUILTIN_SETJMP_FRAME_VALUE,		\
   TARGET_HAVE_NAMED_SECTIONS,			\
   TARGET_HAVE_CTORS_DTORS,			\
   TARGET_HAVE_TLS,				\
Index: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.79
diff -u -r1.79 target.h
--- target.h	24 Feb 2004 17:28:28 -0000	1.79
+++ target.h	2 Mar 2004 18:14:46 -0000
@@ -421,6 +421,10 @@
      that type.  */
   bool (* default_short_enums) (void);
 
+  /* This target hook returns an rtx that is used to store the address
+     of the current frame into the built in @code{setjmp} buffer.  */
+  rtx (* builtin_setjmp_frame_value) (void);
+
   /* Leave the boolean fields at the end.  */
 
   /* True if arbitrary sections are supported.  */
Index: targhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/targhooks.c,v
retrieving revision 2.19
diff -u -r2.19 targhooks.c
--- targhooks.c	19 Feb 2004 11:06:26 -0000	2.19
+++ targhooks.c	2 Mar 2004 18:14:46 -0000
@@ -105,6 +105,14 @@
 {
 }
 
+/* The default implementation of TARGET_BUILTIN_SETJMP_FRAME_VALUE.  */
+
+rtx
+default_builtin_setjmp_frame_value (void)
+{
+  return virtual_stack_vars_rtx;
+}
+
 /* Generic hook that takes a CUMULATIVE_ARGS pointer and returns true.  */
 
 bool
Index: targhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/targhooks.h,v
retrieving revision 2.11
diff -u -r2.11 targhooks.h
--- targhooks.h	19 Feb 2004 11:06:26 -0000	2.11
+++ targhooks.h	2 Mar 2004 18:14:46 -0000
@@ -27,6 +27,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 hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *);
 extern bool default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
 
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.306
diff -u -r1.306 tm.texi
--- doc/tm.texi	2 Mar 2004 04:55:00 -0000	1.306
+++ doc/tm.texi	2 Mar 2004 18:14:54 -0000
@@ -2853,13 +2853,13 @@
 define this macro.
 @end defmac
 
-@defmac BUILTIN_SETJMP_FRAME_VALUE
-If defined, a C expression that contains an rtx that is used to store
+@deftypefn {Target Hook} bool TARGET_BUILTIN_SETJMP_FRAME_VALUE ()
+This target hook should return an rtx that is used to store
 the address of the current frame into the built in @code{setjmp} buffer.
 The default value, @code{virtual_stack_vars_rtx}, is correct for most
-machines.  One reason you may need to define this macro is if
+machines.  One reason you may need to define this target hook is if
 @code{hard_frame_pointer_rtx} is the appropriate value on your machine.
-@end defmac
+@end deftypefn
 
 @defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
 A C expression whose value is RTL representing the value of the return


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]