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]

Re: [PATCH] Fix -mno-accumulate-outgoing-args -fasynchronous-unwind-tables (PR rtl-optimization/36419, take 2)


On Mon, Jul 28, 2008 at 03:09:00PM -0400, Jakub Jelinek wrote:
> On Mon, Jul 28, 2008 at 10:46:48AM -0700, H.J. Lu wrote:
> > is after saving ebx, esi and edi onto stack, our testcase doesn't fail.
> > We could factor out
> > 
> > 
> >               if (offset != 0)
> >                 {
> >                   if (cfa.reg == STACK_POINTER_REGNUM)
> >                     cfa.offset += offset;
> > 
> >                   if (cfa_store.reg == STACK_POINTER_REGNUM)
> >                     cfa_store.offset += offset;
> > 
> > #ifndef STACK_GROWS_DOWNWARD
> >                   offset = -offset;
> > #endif
> > 
> >                   args_size += offset;
> >                   if (args_size < 0)
> >                     args_size = 0;
> > 
> >                   def_cfa_1 (label, &cfa);
> >                   if (flag_asynchronous_unwind_tables)
> >                     dwarf2out_args_size (label, args_size);
> >                 }
> > 
> > into a function and call it from dwarf2out_frame_debug_expr
> > and  dwarf2out_stack_adjust.
> 
> Good idea, can you take care of that?
> Just note that label if created in the latter, but just used
> in the former case, so you probably want to pass both
> offset and label to that factored out function, in the latter
> case e.g. pass NULL and if it is NULL, call dwarf2out_cfi_label ()
> when you need the label.  Or only factor out the body of
> if (offset != 0) and pass dwarf2out_cfi_label () in the latter
> case.
> 

I am testing it on Linux/ia32, Linux/ia64 and Linux/Intel64. OK
for trunk if all pass?

Thanks.


H.J.
----
2008-07-28  H.J. Lu  <hongjiu.lu@intel.com>

	* dwarf2out.c (dwarf2out_args_size_adjust): New.
	(dwarf2out_stack_adjust): Use it.
	(dwarf2out_frame_debug_expr): Likewise.

--- dwarf2out.c.csa	2008-07-28 08:26:54.000000000 -0700
+++ dwarf2out.c	2008-07-28 13:54:30.000000000 -0700
@@ -378,6 +378,7 @@ static void output_cfi (dw_cfi_ref, dw_f
 static void output_call_frame_info (int);
 static void dwarf2out_note_section_used (void);
 static void dwarf2out_stack_adjust (rtx, bool);
+static void dwarf2out_args_size_adjust (HOST_WIDE_INT, const char *);
 static void flush_queued_reg_saves (void);
 static bool clobbers_queued_reg_save (const_rtx);
 static void dwarf2out_frame_debug_expr (rtx, const char *);
@@ -1185,9 +1186,21 @@ dwarf2out_stack_adjust (rtx insn, bool a
   if (offset == 0)
     return;
 
+  label = dwarf2out_cfi_label ();
+  dwarf2out_args_size_adjust (offset, label);
+}
+
+/* Adjust args_size based on stack adjustment OFFSET.  */
+
+static void
+dwarf2out_args_size_adjust (HOST_WIDE_INT offset, const char *label)
+{
   if (cfa.reg == STACK_POINTER_REGNUM)
     cfa.offset += offset;
 
+  if (cfa_store.reg == STACK_POINTER_REGNUM)
+    cfa_store.offset += offset;
+
 #ifndef STACK_GROWS_DOWNWARD
   offset = -offset;
 #endif
@@ -1196,7 +1209,6 @@ dwarf2out_stack_adjust (rtx insn, bool a
   if (args_size < 0)
     args_size = 0;
 
-  label = dwarf2out_cfi_label ();
   def_cfa_1 (label, &cfa);
   if (flag_asynchronous_unwind_tables)
     dwarf2out_args_size (label, args_size);
@@ -1588,22 +1600,7 @@ dwarf2out_frame_debug_expr (rtx expr, co
 	      HOST_WIDE_INT offset = stack_adjust_offset (elem);
 
 	      if (offset != 0)
-		{
-		  if (cfa.reg == STACK_POINTER_REGNUM)
-		    cfa.offset += offset;
-
-#ifndef STACK_GROWS_DOWNWARD
-		  offset = -offset;
-#endif
-
-		  args_size += offset;
-		  if (args_size < 0)
-		    args_size = 0;
-
-		  def_cfa_1 (label, &cfa);
-		  if (flag_asynchronous_unwind_tables)
-		    dwarf2out_args_size (label, args_size);
-		}
+		dwarf2out_args_size_adjust (offset, label);
 	    }
 	}
       return;


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