OSDN Git Service

PR debug/41353
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Sep 2009 16:30:39 +0000 (16:30 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Sep 2009 16:30:39 +0000 (16:30 +0000)
* var-tracking.c (add_with_sets): Sort MO_VAL_LOC last among uses.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152088 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/var-tracking.c

index 22941d3..8d461fa 100644 (file)
@@ -1,5 +1,10 @@
 2009-09-23  Alexandre Oliva  <aoliva@redhat.com>
 
+       PR debug/41353
+       * var-tracking.c (add_with_sets): Sort MO_VAL_LOC last among uses.
+
+2009-09-23  Alexandre Oliva  <aoliva@redhat.com>
+
        PR debug/41248
        * cfgexpand.c (convert_debug_memory_address): New.
        (expand_debug_expr): Convert base address and offset to the same
index 0e665b9..bdd3bde 100644 (file)
@@ -4977,8 +4977,8 @@ add_with_sets (rtx insn, struct cselib_set *sets, int n_sets)
   note_uses (&PATTERN (insn), add_uses_1, &cui);
   n2 = VTI (bb)->n_mos - 1;
 
-  /* Order the MO_USEs to be before MO_USE_NO_VARs,
-     MO_VAL_LOC and MO_VAL_USE.  */
+  /* Order the MO_USEs to be before MO_USE_NO_VARs and MO_VAL_USE, and
+     MO_VAL_LOC last.  */
   while (n1 < n2)
     {
       while (n1 < n2 && VTI (bb)->mos[n1].type == MO_USE)
@@ -4995,6 +4995,24 @@ add_with_sets (rtx insn, struct cselib_set *sets, int n_sets)
        }
     }
 
+  n2 = VTI (bb)->n_mos - 1;
+
+  while (n1 < n2)
+    {
+      while (n1 < n2 && VTI (bb)->mos[n1].type != MO_VAL_LOC)
+       n1++;
+      while (n1 < n2 && VTI (bb)->mos[n2].type == MO_VAL_LOC)
+       n2--;
+      if (n1 < n2)
+       {
+         micro_operation sw;
+
+         sw = VTI (bb)->mos[n1];
+         VTI (bb)->mos[n1] = VTI (bb)->mos[n2];
+         VTI (bb)->mos[n2] = sw;
+       }
+    }
+
   if (CALL_P (insn))
     {
       micro_operation *mo = VTI (bb)->mos + VTI (bb)->n_mos++;