OSDN Git Service

* trans-array.h (gfc_trans_create_temp_array): Remove loop argument.
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Nov 2011 23:06:22 +0000 (23:06 +0000)
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Nov 2011 23:06:22 +0000 (23:06 +0000)
* trans-array.c (gfc_trans_create_temp_array): Ditto.  Get loop from ss.
Update reference to loop.  Remove loop argument.
(gfc_trans_array_constructor, gfc_conv_loop_setup): Update calls to
gfc_trans_create_temp_array.
* trans-expr.c (gfc_conv_procedure_call): Ditto.
* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
* trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
Set loop before calling gfc_trans_create_temp_array.

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

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-array.h
gcc/fortran/trans-expr.c
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans-stmt.c

index 338fca6..ce4e619 100644 (file)
@@ -1,5 +1,17 @@
 2011-11-03  Mikael Morin  <mikael@gcc.gnu.org>
 
 2011-11-03  Mikael Morin  <mikael@gcc.gnu.org>
 
+       * trans-array.h (gfc_trans_create_temp_array): Remove loop argument.
+       * trans-array.c (gfc_trans_create_temp_array): Ditto.  Get loop from ss.
+       Update reference to loop.  Remove loop argument.
+       (gfc_trans_array_constructor, gfc_conv_loop_setup): Update calls to
+       gfc_trans_create_temp_array.
+       * trans-expr.c (gfc_conv_procedure_call): Ditto.
+       * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
+       * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
+       Set loop before calling gfc_trans_create_temp_array.
+
+2011-11-03  Mikael Morin  <mikael@gcc.gnu.org>
+
        * trans-array.c (gfc_trans_create_temp_array): New variable total_dim.
        Set total_dim to loop's rank. Replace usages of loop's rank.
 
        * trans-array.c (gfc_trans_create_temp_array): New variable total_dim.
        Set total_dim to loop's rank. Replace usages of loop's rank.
 
index b2388c1..d386a22 100644 (file)
@@ -888,15 +888,14 @@ get_array_ref_dim (gfc_ss *ss, int loop_dim)
    callee allocated array.
 
    PRE, POST, INITIAL, DYNAMIC and DEALLOC are as for
    callee allocated array.
 
    PRE, POST, INITIAL, DYNAMIC and DEALLOC are as for
-   gfc_trans_allocate_array_storage.
- */
+   gfc_trans_allocate_array_storage.  */
 
 tree
 
 tree
-gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
-                            gfc_loopinfo * loop, gfc_ss * ss,
+gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss,
                             tree eltype, tree initial, bool dynamic,
                             bool dealloc, bool callee_alloc, locus * where)
 {
                             tree eltype, tree initial, bool dynamic,
                             bool dealloc, bool callee_alloc, locus * where)
 {
+  gfc_loopinfo *loop;
   gfc_array_info *info;
   tree from[GFC_MAX_DIMENSIONS], to[GFC_MAX_DIMENSIONS];
   tree type;
   gfc_array_info *info;
   tree from[GFC_MAX_DIMENSIONS], to[GFC_MAX_DIMENSIONS];
   tree type;
@@ -915,11 +914,12 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
   info = &ss->info->data.array;
 
   gcc_assert (ss->dimen > 0);
   info = &ss->info->data.array;
 
   gcc_assert (ss->dimen > 0);
-  gcc_assert (loop->dimen == ss->dimen);
+  gcc_assert (ss->loop->dimen == ss->dimen);
 
   if (gfc_option.warn_array_temp && where)
     gfc_warning ("Creating array temporary at %L", where);
 
 
   if (gfc_option.warn_array_temp && where)
     gfc_warning ("Creating array temporary at %L", where);
 
+  loop = ss->loop;
   total_dim = loop->dimen;
   /* Set the lower bound to zero.  */
   for (n = 0; n < loop->dimen; n++)
   total_dim = loop->dimen;
   /* Set the lower bound to zero.  */
   for (n = 0; n < loop->dimen; n++)
@@ -1065,8 +1065,8 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
   gfc_trans_allocate_array_storage (pre, post, info, size, nelem, initial,
                                    dynamic, dealloc);
 
   gfc_trans_allocate_array_storage (pre, post, info, size, nelem, initial,
                                    dynamic, dealloc);
 
-  if (ss->dimen > loop->temp_dim)
-    loop->temp_dim = ss->dimen;
+  if (ss->dimen > ss->loop->temp_dim)
+    ss->loop->temp_dim = ss->dimen;
 
   return size;
 }
 
   return size;
 }
@@ -2113,8 +2113,8 @@ trans_array_constructor (gfc_ss * ss, locus * where)
   if (TREE_CODE (loop->to[0]) == VAR_DECL)
     dynamic = true;
 
   if (TREE_CODE (loop->to[0]) == VAR_DECL)
     dynamic = true;
 
-  gfc_trans_create_temp_array (&loop->pre, &loop->post, loop, ss,
-                              type, NULL_TREE, dynamic, true, false, where);
+  gfc_trans_create_temp_array (&loop->pre, &loop->post, ss, type, NULL_TREE,
+                              dynamic, true, false, where);
 
   desc = ss_info->data.array.descriptor;
   offset = gfc_index_zero_node;
 
   desc = ss_info->data.array.descriptor;
   offset = gfc_index_zero_node;
@@ -4211,9 +4211,8 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
 
       gcc_assert (tmp_ss->dimen != 0);
 
 
       gcc_assert (tmp_ss->dimen != 0);
 
-      gfc_trans_create_temp_array (&loop->pre, &loop->post, loop,
-                                  tmp_ss, tmp, NULL_TREE,
-                                  false, true, false, where);
+      gfc_trans_create_temp_array (&loop->pre, &loop->post, tmp_ss, tmp,
+                                  NULL_TREE, false, true, false, where);
     }
 
   /* For array parameters we don't have loop variables, so don't calculate the
     }
 
   /* For array parameters we don't have loop variables, so don't calculate the
index 57805b6..aad8c47 100644 (file)
@@ -31,9 +31,8 @@ void gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping *,
                                          gfc_se *, gfc_array_spec *);
 
 /* Generate code to create a temporary array.  */
                                          gfc_se *, gfc_array_spec *);
 
 /* Generate code to create a temporary array.  */
-tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_loopinfo *,
-                                 gfc_ss *, tree, tree, bool, bool, bool,
-                                 locus *);
+tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_ss *,
+                                 tree, tree, bool, bool, bool, locus *);
 
 /* Generate function entry code for allocation of compiler allocated array
    variables.  */
 
 /* Generate function entry code for allocation of compiler allocated array
    variables.  */
index 01d4ca3..e091c89 100644 (file)
@@ -3606,7 +3606,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
             returns a pointer, the temporary will be a shallow copy and
             mustn't be deallocated.  */
          callee_alloc = comp->attr.allocatable || comp->attr.pointer;
             returns a pointer, the temporary will be a shallow copy and
             mustn't be deallocated.  */
          callee_alloc = comp->attr.allocatable || comp->attr.pointer;
-         gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, se->ss,
+         gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
                                       tmp, NULL_TREE, false,
                                       !comp->attr.pointer, callee_alloc,
                                       &se->ss->info->expr->where);
                                       tmp, NULL_TREE, false,
                                       !comp->attr.pointer, callee_alloc,
                                       &se->ss->info->expr->where);
@@ -3642,7 +3642,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
             returns a pointer, the temporary will be a shallow copy and
             mustn't be deallocated.  */
          callee_alloc = sym->attr.allocatable || sym->attr.pointer;
             returns a pointer, the temporary will be a shallow copy and
             mustn't be deallocated.  */
          callee_alloc = sym->attr.allocatable || sym->attr.pointer;
-         gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, se->ss,
+         gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
                                       tmp, NULL_TREE, false,
                                       !sym->attr.pointer, callee_alloc,
                                       &se->ss->info->expr->where);
                                       tmp, NULL_TREE, false,
                                       !sym->attr.pointer, callee_alloc,
                                       &se->ss->info->expr->where);
index fcc59d7..c3a414b 100644 (file)
@@ -5501,9 +5501,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
 
   /* Build a destination descriptor, using the pointer, source, as the
      data field.  */
 
   /* Build a destination descriptor, using the pointer, source, as the
      data field.  */
-  gfc_trans_create_temp_array (&se->pre, &se->post, se->loop,
-                              se->ss, mold_type, NULL_TREE, false, true, false,
-                              &expr->where);
+  gfc_trans_create_temp_array (&se->pre, &se->post, se->ss, mold_type,
+                              NULL_TREE, false, true, false, &expr->where);
 
   /* Cast the pointer to the result.  */
   tmp = gfc_conv_descriptor_data_get (info->descriptor);
 
   /* Cast the pointer to the result.  */
   tmp = gfc_conv_descriptor_data_get (info->descriptor);
index 86a56e8..2e02320 100644 (file)
@@ -309,11 +309,10 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
          size = gfc_create_var (gfc_array_index_type, NULL);
          data = gfc_create_var (pvoid_type_node, NULL);
          gfc_init_block (&temp_post);
          size = gfc_create_var (gfc_array_index_type, NULL);
          data = gfc_create_var (pvoid_type_node, NULL);
          gfc_init_block (&temp_post);
-         tmp = gfc_trans_create_temp_array (&se->pre, &temp_post,
-                                            &tmp_loop, ss, temptype,
-                                            initial,
-                                            false, true, false,
-                                            &arg->expr->where);
+         ss->loop = &tmp_loop;
+         tmp = gfc_trans_create_temp_array (&se->pre, &temp_post, ss,
+                                            temptype, initial, false, true,
+                                            false, &arg->expr->where);
          gfc_add_modify (&se->pre, size, tmp);
          tmp = fold_convert (pvoid_type_node, info->data);
          gfc_add_modify (&se->pre, data, tmp);
          gfc_add_modify (&se->pre, size, tmp);
          tmp = fold_convert (pvoid_type_node, info->data);
          gfc_add_modify (&se->pre, data, tmp);