This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] [26/66] inline sum and product: Update core structs: Move scalar struct.


This moves data::scalar field from gfc_ss to gfc_ss_info.
The expr subfield is renamed to value, as it is not the expression really,
it is a reference to a variable containing the pre-calculated value.
OK?

Attachment: pr43829-26.CL
Description: Text document

diff --git a/trans-array.c b/trans-array.c
index 827d13d..eef0f09 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -2208,7 +2208,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
 	  else
 	    gfc_add_block_to_block (&loop->post, &se.post);
 
-	  ss->data.scalar.expr = se.expr;
+	  ss_info->data.scalar.value = se.expr;
 	  ss_info->string_length = se.string_length;
 	  break;
 
@@ -2220,7 +2220,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
 	  gfc_add_block_to_block (&loop->pre, &se.pre);
 	  gfc_add_block_to_block (&loop->post, &se.post);
 
-	  ss->data.scalar.expr = gfc_evaluate_now (se.expr, &loop->pre);
+	  ss_info->data.scalar.value = gfc_evaluate_now (se.expr, &loop->pre);
 	  ss_info->string_length = se.string_length;
 	  break;
 
@@ -2571,7 +2571,7 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
 	  gcc_assert (info->subscript[dim]
 		      && info->subscript[dim]->info->type == GFC_SS_SCALAR);
 	  /* We've already translated this value outside the loop.  */
-	  index = info->subscript[dim]->data.scalar.expr;
+	  index = info->subscript[dim]->info->data.scalar.value;
 
 	  index = trans_array_bound_check (se, ss, index, dim, &ar->where,
 					   ar->as->type != AS_ASSUMED_SIZE
@@ -6134,7 +6134,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 	    {
 	      gcc_assert (info->subscript[n]
 			  && info->subscript[n]->info->type == GFC_SS_SCALAR);
-	      start = info->subscript[n]->data.scalar.expr;
+	      start = info->subscript[n]->info->data.scalar.value;
 	    }
 	  else
 	    {
diff --git a/trans-const.c b/trans-const.c
index 35a5e68..fa820ef 100644
--- a/trans-const.c
+++ b/trans-const.c
@@ -392,7 +392,7 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
       gcc_assert (ss_info->type == GFC_SS_SCALAR);
       gcc_assert (ss_info->expr == expr);
 
-      se->expr = se->ss->data.scalar.expr;
+      se->expr = ss_info->data.scalar.value;
       se->string_length = ss_info->string_length;
       gfc_advance_se_ss_chain (se);
       return;
diff --git a/trans-expr.c b/trans-expr.c
index 87734f1..55853f1 100644
--- a/trans-expr.c
+++ b/trans-expr.c
@@ -4840,7 +4840,7 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr)
       ss_info = ss->info;
       /* Substitute a scalar expression evaluated outside the scalarization
          loop.  */
-      se->expr = se->ss->data.scalar.expr;
+      se->expr = ss_info->data.scalar.value;
       if (ss_info->type == GFC_SS_REFERENCE)
 	se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
       se->string_length = ss_info->string_length;
diff --git a/trans.h b/trans.h
index f1b109a..567e5a3 100644
--- a/trans.h
+++ b/trans.h
@@ -188,6 +188,17 @@ typedef struct gfc_ss_info
   gfc_ss_type type;
   gfc_expr *expr;
   tree string_length;
+
+  union
+  {
+    /* If type is GFC_SS_SCALAR or GFC_SS_REFERENCE.  */
+    struct
+    {
+      tree value;
+    }
+    scalar;
+  }
+  data;
 }
 gfc_ss_info;
 
@@ -208,13 +219,6 @@ typedef struct gfc_ss
 
   union
   {
-    /* If type is GFC_SS_SCALAR or GFC_SS_REFERENCE.  */
-    struct
-    {
-      tree expr;
-    }
-    scalar;
-
     /* GFC_SS_TEMP.  */
     struct
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]