This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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/rfc] Deprecate STACK_ALIGN


Hello,

This patch deprecates STACK_ALIGN. Since, when creating an inferior function call, frame_align establishes correct alignment, and then frame_red_zone_size, push_dummy_call keep et.al. maintain it, STACK_ALIGN is entirely redundant.

Mark, your moves against REG_STRUCT_HAS_ADDR make this possible!
Eli, note the s/STACK_ALIGN/DEPRECATED_STACK_ALIGN/ in the doco.

I'll look to commit this in a few days,
Andrew
2003-09-09  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh (DEPRECATED_STACK_ALIGN): Rename STACK_ALIGN.
	* gdbarch.h, gdbarch.c: Re-generate.
	* infcall.c (call_function_by_hand): Update.
	* hppa-tdep.c (hppa_push_arguments): Update.
	* ada-lang.c (place_on_stack): Update.
	* xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
	* sparc-tdep.c (sparc_gdbarch_init): Update.
	* m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
	* hppa-tdep.c (hppa_gdbarch_init): Update.
	* h8300-tdep.c (h8300_gdbarch_init): Delete comment refering to
	stack_align.

Index: doc/ChangeLog
2003-09-09  Andrew Cagney  <cagney@redhat.com>

	* gdbint.texinfo (Target Architecture Definition): Replace
	STACK_ALIGN with DEPRECATED_STACK_ALIGN.

Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.31
diff -u -r1.31 ada-lang.c
--- ada-lang.c	26 Jun 2003 17:18:41 -0000	1.31
+++ ada-lang.c	9 Sep 2003 18:43:36 -0000
@@ -3022,9 +3022,9 @@
 {
   CORE_ADDR old_sp = *sp;
 
-#ifdef STACK_ALIGN
+#ifdef DEPRECATED_STACK_ALIGN
   *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
-		    STACK_ALIGN (TYPE_LENGTH
+		    DEPRECATED_STACK_ALIGN (TYPE_LENGTH
 				 (check_typedef (VALUE_TYPE (val)))));
 #else
   *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.266
diff -u -r1.266 gdbarch.sh
--- gdbarch.sh	9 Sep 2003 04:41:32 -0000	1.266
+++ gdbarch.sh	9 Sep 2003 18:43:47 -0000
@@ -640,7 +640,11 @@
 F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame
 F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame
 #
-F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp
+# DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call
+# to frame_align and the requirement that methods such as
+# push_dummy_call and frame_red_zone_size maintain correct stack/frame
+# alignment.
+F:2:DEPRECATED_STACK_ALIGN:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp
 M:::CORE_ADDR:frame_align:CORE_ADDR address:address
 F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type
 v::FRAME_RED_ZONE_SIZE:int:frame_red_zone_size
Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.77
diff -u -r1.77 h8300-tdep.c
--- h8300-tdep.c	9 Sep 2003 04:41:32 -0000	1.77
+++ h8300-tdep.c	9 Sep 2003 18:43:51 -0000
@@ -1331,7 +1331,6 @@
   set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
 
-  /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   /* Char is unsigned.  */
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.91
diff -u -r1.91 hppa-tdep.c
--- hppa-tdep.c	4 Sep 2003 18:04:24 -0000	1.91
+++ hppa-tdep.c	9 Sep 2003 18:44:00 -0000
@@ -1869,7 +1869,7 @@
 
   /* The value of SP as it was passed into this function after
      aligning.  */
-  CORE_ADDR orig_sp = STACK_ALIGN (sp);
+  CORE_ADDR orig_sp = DEPRECATED_STACK_ALIGN (sp);
 
   /* The number of stack bytes occupied by the current argument.  */
   int bytes_reserved;
@@ -1932,7 +1932,7 @@
 
      The ABIs also mandate minimum stack alignments which we must
      preserve.  */
-  cum_bytes_aligned = STACK_ALIGN (cum_bytes_reserved);
+  cum_bytes_aligned = DEPRECATED_STACK_ALIGN (cum_bytes_reserved);
   sp += max (cum_bytes_aligned, REG_PARM_STACK_SPACE);
 
   /* Now write each of the args at the proper offset down the stack.  */
@@ -2039,7 +2039,7 @@
 
      The ABI also mandates minimum stack alignments which we must
      preserve.  */
-  cum_bytes_aligned = STACK_ALIGN (cum_bytes_reserved);
+  cum_bytes_aligned = DEPRECATED_STACK_ALIGN (cum_bytes_reserved);
   sp += max (cum_bytes_aligned, REG_PARM_STACK_SPACE);
 
   /* Now write each of the args at the proper offset down the stack.
@@ -5117,7 +5117,7 @@
           (gdbarch, hppa32_register_virtual_type);
         set_gdbarch_deprecated_call_dummy_length
           (gdbarch, hppa32_call_dummy_length);
-        set_gdbarch_stack_align (gdbarch, hppa32_stack_align);
+        set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align);
         set_gdbarch_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr);
         set_gdbarch_deprecated_extract_return_value
           (gdbarch, hppa32_extract_return_value);
@@ -5135,7 +5135,7 @@
           (gdbarch, hppa64_call_dummy_breakpoint_offset);
         set_gdbarch_deprecated_call_dummy_length
           (gdbarch, hppa64_call_dummy_length);
-        set_gdbarch_stack_align (gdbarch, hppa64_stack_align);
+        set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align);
         set_gdbarch_deprecated_extract_return_value
           (gdbarch, hppa64_extract_return_value);
         set_gdbarch_use_struct_convention
Index: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.25
diff -u -r1.25 infcall.c
--- infcall.c	9 Sep 2003 03:58:18 -0000	1.25
+++ infcall.c	9 Sep 2003 18:44:03 -0000
@@ -689,12 +689,12 @@
 	      arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i]));
 	      len = TYPE_LENGTH (arg_type);
 
-	      if (STACK_ALIGN_P ())
+	      if (DEPRECATED_STACK_ALIGN_P ())
 		/* MVS 11/22/96: I think at least some of this
 		   stack_align code is really broken.  Better to let
 		   PUSH_ARGUMENTS adjust the stack in a target-defined
 		   manner.  */
-		aligned_len = STACK_ALIGN (len);
+		aligned_len = DEPRECATED_STACK_ALIGN (len);
 	      else
 		aligned_len = len;
 	      if (INNER_THAN (1, 2))
@@ -732,10 +732,10 @@
   if (struct_return)
     {
       int len = TYPE_LENGTH (value_type);
-      if (STACK_ALIGN_P ())
+      if (DEPRECATED_STACK_ALIGN_P ())
 	/* NOTE: cagney/2003-03-22: Should rely on frame align, rather
            than stack align to force the alignment of the stack.  */
-	len = STACK_ALIGN (len);
+	len = DEPRECATED_STACK_ALIGN (len);
       if (INNER_THAN (1, 2))
 	{
 	  /* Stack grows downward.  Align STRUCT_ADDR and SP after
@@ -770,7 +770,7 @@
       /* MVS 11/22/96: I think at least some of this stack_align code
 	 is really broken.  Better to let push_dummy_call() adjust the
 	 stack in a target-defined manner.  */
-      if (STACK_ALIGN_P () && INNER_THAN (1, 2))
+      if (DEPRECATED_STACK_ALIGN_P () && INNER_THAN (1, 2))
 	{
 	  /* If stack grows down, we must leave a hole at the top. */
 	  int len = 0;
@@ -779,7 +779,7 @@
 	    len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
 	  if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())
 	    len += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
-	  sp -= STACK_ALIGN (len) - len;
+	  sp -= DEPRECATED_STACK_ALIGN (len) - len;
 	}
     }
 
@@ -824,13 +824,13 @@
      handled any alignment issues, the code below is entirely
      redundant.  */
   if (!gdbarch_push_dummy_call_p (current_gdbarch)
-      && STACK_ALIGN_P () && !INNER_THAN (1, 2))
+      && DEPRECATED_STACK_ALIGN_P () && !INNER_THAN (1, 2))
     {
       /* If stack grows up, we must leave a hole at the bottom, note
          that sp already has been advanced for the arguments!  */
       if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())
 	sp += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
-      sp = STACK_ALIGN (sp);
+      sp = DEPRECATED_STACK_ALIGN (sp);
     }
 
 /* XXX This seems wrong.  For stacks that grow down we shouldn't do
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.88
diff -u -r1.88 m68hc11-tdep.c
--- m68hc11-tdep.c	18 Aug 2003 17:35:16 -0000	1.88
+++ m68hc11-tdep.c	9 Sep 2003 18:44:05 -0000
@@ -1572,7 +1572,7 @@
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_function_start_offset (gdbarch, 0);
   set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);
-  set_gdbarch_stack_align (gdbarch, m68hc11_stack_align);
+  set_gdbarch_deprecated_stack_align (gdbarch, m68hc11_stack_align);
   set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11);
 
   m68hc11_add_reggroups (gdbarch);
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.122
diff -u -r1.122 sparc-tdep.c
--- sparc-tdep.c	9 Sep 2003 04:41:32 -0000	1.122
+++ sparc-tdep.c	9 Sep 2003 18:44:12 -0000
@@ -3398,7 +3398,7 @@
 #else
       set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
 #endif
-      set_gdbarch_stack_align (gdbarch, sparc32_stack_align);
+      set_gdbarch_deprecated_stack_align (gdbarch, sparc32_stack_align);
       set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
       set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
@@ -3451,7 +3451,7 @@
 #else
       set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
 #endif
-      set_gdbarch_stack_align (gdbarch, sparc64_stack_align);
+      set_gdbarch_deprecated_stack_align (gdbarch, sparc64_stack_align);
       set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
       set_gdbarch_deprecated_store_struct_return (gdbarch, sparc64_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
Index: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.61
diff -u -r1.61 xstormy16-tdep.c
--- xstormy16-tdep.c	9 Sep 2003 04:41:32 -0000	1.61
+++ xstormy16-tdep.c	9 Sep 2003 18:44:14 -0000
@@ -1103,7 +1103,7 @@
   set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
   set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
 
-  set_gdbarch_stack_align (gdbarch, xstormy16_stack_align);
+  set_gdbarch_deprecated_stack_align (gdbarch, xstormy16_stack_align);
 
   set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
 
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.159
diff -u -r1.159 gdbint.texinfo
--- doc/gdbint.texinfo	18 Aug 2003 20:04:56 -0000	1.159
+++ doc/gdbint.texinfo	9 Sep 2003 18:44:39 -0000
@@ -3218,14 +3218,14 @@
 Define this to adjust @var{address} so that it meets the alignment
 requirements for the start of a new stack frame.  A stack frame's
 alignment requirements are typically stronger than a target processors
-stack alignment requirements (@pxref{STACK_ALIGN}).
+stack alignment requirements (@pxref{DEPRECATED_STACK_ALIGN}).
 
 This function is used to ensure that, when creating a dummy frame, both
 the initial stack pointer and (if needed) the address of the return
 value are correctly aligned.
 
-Unlike @code{STACK_ALIGN}, this function always adjusts the address in
-the direction of stack growth.
+Unlike @code{DEPRECATED_STACK_ALIGN}, this function always adjusts the
+address in the direction of stack growth.
 
 By default, no frame based stack alignment is performed.
 
@@ -3812,9 +3812,9 @@
 declarations) into @value{GDBN} regnums.  If not defined, no conversion will be
 done.
 
-@item STACK_ALIGN (@var{addr})
-@anchor{STACK_ALIGN}
-@findex STACK_ALIGN
+@item DEPRECATED_STACK_ALIGN (@var{addr})
+@anchor{DEPRECATED_STACK_ALIGN}
+@findex DEPRECATED_STACK_ALIGN
 Define this to increase @var{addr} so that it meets the alignment
 requirements for the processor's stack.
 

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