Commit a1ae4f43 by Mikael Morin Committed by Mikael Morin

trans-array.h (gfc_get_temp_ss): New prototype.

2011-09-08  Mikael Morin  <mikael.morin@sfr.fr>

	* trans-array.h (gfc_get_temp_ss): New prototype.
	* trans-array.c (gfc_get_temp_ss): New function.
	(gfc_conv_resolve_dependencies): Re-use gfc_get_temp_ss.
	(gfc_conv_expr_descriptor): Ditto.
	* trans-expr.c (gfc_conv_subref_array_arg): Ditto.

From-SVN: r178696
parent 66877276
2011-09-08 Mikael Morin <mikael.morin@sfr.fr> 2011-09-08 Mikael Morin <mikael.morin@sfr.fr>
* trans-array.h (gfc_get_temp_ss): New prototype.
* trans-array.c (gfc_get_temp_ss): New function.
(gfc_conv_resolve_dependencies): Re-use gfc_get_temp_ss.
(gfc_conv_expr_descriptor): Ditto.
* trans-expr.c (gfc_conv_subref_array_arg): Ditto.
2011-09-08 Mikael Morin <mikael.morin@sfr.fr>
* trans-array.h (gfc_get_array_ss): New prototype. * trans-array.h (gfc_get_array_ss): New prototype.
* trans-array.c (gfc_get_array_ss): New function. * trans-array.c (gfc_get_array_ss): New function.
(gfc_walk_variable_expr, gfc_walk_function_expr, (gfc_walk_variable_expr, gfc_walk_function_expr,
......
...@@ -534,6 +534,24 @@ gfc_get_array_ss (gfc_ss *next, gfc_expr *expr, int dimen, gfc_ss_type type) ...@@ -534,6 +534,24 @@ gfc_get_array_ss (gfc_ss *next, gfc_expr *expr, int dimen, gfc_ss_type type)
} }
/* Creates and initializes a temporary type gfc_ss struct. */
gfc_ss *
gfc_get_temp_ss (tree type, tree string_length, int dimen)
{
gfc_ss *ss;
ss = gfc_get_ss ();
ss->next = gfc_ss_terminator;
ss->type = GFC_SS_TEMP;
ss->string_length = string_length;
ss->data.temp.dimen = dimen;
ss->data.temp.type = type;
return ss;
}
/* Free all the SS associated with a loop. */ /* Free all the SS associated with a loop. */
void void
...@@ -3821,13 +3839,9 @@ temporary: ...@@ -3821,13 +3839,9 @@ temporary:
if (GFC_ARRAY_TYPE_P (base_type) if (GFC_ARRAY_TYPE_P (base_type)
|| GFC_DESCRIPTOR_TYPE_P (base_type)) || GFC_DESCRIPTOR_TYPE_P (base_type))
base_type = gfc_get_element_type (base_type); base_type = gfc_get_element_type (base_type);
loop->temp_ss = gfc_get_ss (); loop->temp_ss = gfc_get_temp_ss (base_type, dest->string_length,
loop->temp_ss->type = GFC_SS_TEMP; loop->dimen);
loop->temp_ss->data.temp.type = base_type;
loop->temp_ss->string_length = dest->string_length;
loop->temp_ss->data.temp.dimen = loop->dimen;
loop->temp_ss->data.temp.codimen = loop->codimen; loop->temp_ss->data.temp.codimen = loop->codimen;
loop->temp_ss->next = gfc_ss_terminator;
gfc_add_ss_to_loop (loop, loop->temp_ss); gfc_add_ss_to_loop (loop, loop->temp_ss);
} }
else else
...@@ -5874,21 +5888,15 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) ...@@ -5874,21 +5888,15 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
if (need_tmp) if (need_tmp)
{ {
/* Tell the scalarizer to make a temporary. */ if (expr->ts.type == BT_CHARACTER && !expr->ts.u.cl->backend_decl)
loop.temp_ss = gfc_get_ss ();
loop.temp_ss->type = GFC_SS_TEMP;
loop.temp_ss->next = gfc_ss_terminator;
if (expr->ts.type == BT_CHARACTER
&& !expr->ts.u.cl->backend_decl)
get_array_charlen (expr, se); get_array_charlen (expr, se);
loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts); /* Tell the scalarizer to make a temporary. */
loop.temp_ss = gfc_get_temp_ss (gfc_typenode_for_spec (&expr->ts),
if (expr->ts.type == BT_CHARACTER) ((expr->ts.type == BT_CHARACTER)
loop.temp_ss->string_length = expr->ts.u.cl->backend_decl; ? expr->ts.u.cl->backend_decl
else : NULL),
loop.temp_ss->string_length = NULL; loop.dimen);
se->string_length = loop.temp_ss->string_length; se->string_length = loop.temp_ss->string_length;
loop.temp_ss->data.temp.dimen = loop.dimen; loop.temp_ss->data.temp.dimen = loop.dimen;
......
...@@ -89,6 +89,8 @@ void gfc_mark_ss_chain_used (gfc_ss *, unsigned); ...@@ -89,6 +89,8 @@ void gfc_mark_ss_chain_used (gfc_ss *, unsigned);
void gfc_free_ss_chain (gfc_ss *); void gfc_free_ss_chain (gfc_ss *);
/* Allocate a new array type ss. */ /* Allocate a new array type ss. */
gfc_ss *gfc_get_array_ss (gfc_ss *, gfc_expr *, int, gfc_ss_type); gfc_ss *gfc_get_array_ss (gfc_ss *, gfc_expr *, int, gfc_ss_type);
/* Allocate a new temporary type ss. */
gfc_ss *gfc_get_temp_ss (tree, tree, int);
/* Calculates the lower bound and stride of array sections. */ /* Calculates the lower bound and stride of array sections. */
void gfc_conv_ss_startstride (gfc_loopinfo *); void gfc_conv_ss_startstride (gfc_loopinfo *);
......
...@@ -2395,18 +2395,12 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77, ...@@ -2395,18 +2395,12 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
|| GFC_DESCRIPTOR_TYPE_P (base_type)) || GFC_DESCRIPTOR_TYPE_P (base_type))
base_type = gfc_get_element_type (base_type); base_type = gfc_get_element_type (base_type);
loop.temp_ss = gfc_get_ss ();; loop.temp_ss = gfc_get_temp_ss (base_type, ((expr->ts.type == BT_CHARACTER)
loop.temp_ss->type = GFC_SS_TEMP; ? expr->ts.u.cl->backend_decl
loop.temp_ss->data.temp.type = base_type; : NULL),
loop.dimen);
if (expr->ts.type == BT_CHARACTER)
loop.temp_ss->string_length = expr->ts.u.cl->backend_decl;
else
loop.temp_ss->string_length = NULL;
parmse->string_length = loop.temp_ss->string_length; parmse->string_length = loop.temp_ss->string_length;
loop.temp_ss->data.temp.dimen = loop.dimen;
loop.temp_ss->next = gfc_ss_terminator;
/* Associate the SS with the loop. */ /* Associate the SS with the loop. */
gfc_add_ss_to_loop (&loop, loop.temp_ss); gfc_add_ss_to_loop (&loop, loop.temp_ss);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment