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 0145a6afc14566c9d9df65b7e9974ab87d3de58e..4b812f6fb5212d88dd3967a7f1753a4159c66396 100644 (file)
@@ -1,3 +1,10 @@
+2012-06-21  Alexandre Oliva  <aoliva@redhat.com>
+
+       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
index a8a858a37affb46968b7dcf901090b6337066e74..9fdd25253796a8261836feb8bb577f265ee92d12 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