re PR debug/53671 (Many guality test failures)
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 22 Jun 2012 01:33:46 +0000 (01:33 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 22 Jun 2012 01:33:46 +0000 (01:33 +0000)
PR debug/53671
PR debug/49888
* var-tracking.c (vt_initialize): Record initial offset between
arg pointer and stack pointer.

From-SVN: r188870

gcc/ChangeLog
gcc/var-tracking.c

index 0145a6a..4b812f6 100644 (file)
@@ -2,6 +2,13 @@
 
        PR debug/53671
        PR debug/49888
+       * var-tracking.c (vt_initialize): Record initial offset between
+       arg pointer and stack pointer.
+
+2012-06-21  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/53671
+       PR debug/49888
        * var-tracking.c (vt_init_cfa_base): Drop redundant recording of
        CFA base.
 
index a8a858a..9fdd252 100644 (file)
@@ -9504,6 +9504,41 @@ vt_initialize (void)
       valvar_pool = NULL;
     }
 
+  if (MAY_HAVE_DEBUG_INSNS)
+    {
+      rtx reg, expr;
+      int ofst;
+      cselib_val *val;
+
+#ifdef FRAME_POINTER_CFA_OFFSET
+      reg = frame_pointer_rtx;
+      ofst = FRAME_POINTER_CFA_OFFSET (current_function_decl);
+#else
+      reg = arg_pointer_rtx;
+      ofst = ARG_POINTER_CFA_OFFSET (current_function_decl);
+#endif
+
+      ofst -= INCOMING_FRAME_SP_OFFSET;
+
+      val = cselib_lookup_from_insn (reg, GET_MODE (reg), 1,
+                                    VOIDmode, get_insns ());
+      preserve_value (val);
+      cselib_preserve_cfa_base_value (val, REGNO (reg));
+      expr = plus_constant (GET_MODE (stack_pointer_rtx),
+                           stack_pointer_rtx, -ofst);
+      cselib_add_permanent_equiv (val, expr, get_insns ());
+
+      if (ofst)
+       {
+         val = cselib_lookup_from_insn (stack_pointer_rtx,
+                                        GET_MODE (stack_pointer_rtx), 1,
+                                        VOIDmode, get_insns ());
+         preserve_value (val);
+         expr = plus_constant (GET_MODE (reg), reg, ofst);
+         cselib_add_permanent_equiv (val, expr, get_insns ());
+       }
+    }
+
   /* In order to factor out the adjustments made to the stack pointer or to
      the hard frame pointer and thus be able to use DW_OP_fbreg operations
      instead of individual location lists, we're going to rewrite MEMs based