]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
trans.h (struct gfc_loopinfo): New fields nested and next.
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 3 Nov 2011 23:39:11 +0000 (23:39 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 3 Nov 2011 23:39:11 +0000 (23:39 +0000)
* trans.h (struct gfc_loopinfo): New fields nested and next.
* trans-array.c (gfc_add_ss_to_loop): Update list of nested list if
ss has non-null nested_ss field.

From-SVN: r180897

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans.h

index e973d4875538e20143dc93e3f0014b0b6e4c228e..a8d38424326d0c9db2c04acc4f600d0201309b18 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-03  Mikael Morin  <mikael@gcc.gnu.org>
+
+       * trans.h (struct gfc_loopinfo): New fields nested and next.
+       * trans-array.c (gfc_add_ss_to_loop): Update list of nested list if
+       ss has non-null nested_ss field.
+
 2011-11-03  Mikael Morin  <mikael@gcc.gnu.org>
 
        * trans-array.c (gfc_trans_create_temp_array): Loop over the parents.
index 1a86ae66c59e2814d7735d66c6418b46fa59585b..0c1dc895d0d4eac8870803526d3823a237b9186a 100644 (file)
@@ -645,6 +645,7 @@ void
 gfc_add_ss_to_loop (gfc_loopinfo * loop, gfc_ss * head)
 {
   gfc_ss *ss;
+  gfc_loopinfo *nested_loop;
 
   if (head == gfc_ss_terminator)
     return;
@@ -654,6 +655,21 @@ gfc_add_ss_to_loop (gfc_loopinfo * loop, gfc_ss * head)
   ss = head;
   for (; ss && ss != gfc_ss_terminator; ss = ss->next)
     {
+      if (ss->nested_ss)
+       {
+         nested_loop = ss->nested_ss->loop;
+
+         /* More than one ss can belong to the same loop.  Hence, we add the
+            loop to the chain only if it is different from the previously
+            added one, to avoid duplicate nested loops.  */
+         if (nested_loop != loop->nested)
+           {
+             gcc_assert (nested_loop->next == NULL);
+             nested_loop->next = loop->nested;
+             loop->nested = nested_loop;
+           }
+       }
+
       if (ss->next == gfc_ss_terminator)
        ss->loop_chain = loop->ss;
       else
index 06088797f64fbfd27f0e548b47b5ac0e90cfc803..0549aa7930132a0de8dba3c3ce237cb3a6fe9409 100644 (file)
@@ -279,6 +279,9 @@ typedef struct gfc_loopinfo
   /* The SS describing the temporary used in an assignment.  */
   gfc_ss *temp_ss;
 
+  /* Chain of nested loops.  */
+  struct gfc_loopinfo *nested, *next;
+
   /* The scalarization loop index variables.  */
   tree loopvar[GFC_MAX_DIMENSIONS];