Commit bcc4d4e0 by Mikael Morin

trans.h (struct gfc_ss_info): New struct.

	* trans.h (struct gfc_ss_info): New struct.
	(gfc_get_ss_info): New macro.
	(struct gfc_ss): Move type field to struct gfc_ss_info.
	Add an info field of type gfc_ss_info.
	* trans-array.c (free_ss_info): New function.
	(gfc_free_ss): Call free_ss_info.
	(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss):
	Allocate gfc_ss_info field.
	(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss,
	gfc_set_vector_loop_bounds, gfc_add_loop_ss_code,
	gfc_conv_array_index_offset, gfc_trans_preloop_setup,
	gfc_trans_scalarized_loop_boundary, gfc_conv_section_startstride,
	gfc_conv_ss_startstride, gfc_conv_resolve_dependencies,
	gfc_conv_loop_setup, transposed_dims, gfc_conv_expr_descriptor,
	gfc_walk_elemental_function_args): Update references to type.
	* trans-const.c (gfc_conv_constant): Factor common reference chains
	and update reference to type.
	* trans-expr.c (gfc_conv_procedure_call, gfc_trans_assignment_1):
	Update reference to type.
	(gfc_conv_array_constructor_expr, gfc_conv_expr,
	gfc_conv_expr_reference): Ditto. Factor common reference chains.
	* trans-intrinsic.c (walk_inline_intrinsic_transpose): Update references
	to type
	* trans-stmt.c (gfc_trans_where_assign): Ditto.

From-SVN: r180867
parent 08dcec61
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans.h (struct gfc_ss_info): New struct.
(gfc_get_ss_info): New macro.
(struct gfc_ss): Move type field to struct gfc_ss_info.
Add an info field of type gfc_ss_info.
* trans-array.c (free_ss_info): New function.
(gfc_free_ss): Call free_ss_info.
(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss):
Allocate gfc_ss_info field.
(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss,
gfc_set_vector_loop_bounds, gfc_add_loop_ss_code,
gfc_conv_array_index_offset, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_boundary, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_resolve_dependencies,
gfc_conv_loop_setup, transposed_dims, gfc_conv_expr_descriptor,
gfc_walk_elemental_function_args): Update references to type.
* trans-const.c (gfc_conv_constant): Factor common reference chains
and update reference to type.
* trans-expr.c (gfc_conv_procedure_call, gfc_trans_assignment_1):
Update reference to type.
(gfc_conv_array_constructor_expr, gfc_conv_expr,
gfc_conv_expr_reference): Ditto. Factor common reference chains.
* trans-intrinsic.c (walk_inline_intrinsic_transpose): Update references
to type
* trans-stmt.c (gfc_trans_where_assign): Ditto.
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans.h (struct gfc_ss, struct gfc_array_info): Move shape field
from the former struct to the latter.
* trans-array.c (gfc_conv_ss_startstride, gfc_conv_loop_setup):
......
......@@ -358,6 +358,8 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
void
gfc_conv_constant (gfc_se * se, gfc_expr * expr)
{
gfc_ss *ss;
/* We may be receiving an expression for C_NULL_PTR or C_NULL_FUNPTR. If
so, the expr_type will not yet be an EXPR_CONSTANT. We need to make
it so here. */
......@@ -380,10 +382,11 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
return;
}
if (se->ss != NULL)
ss = se->ss;
if (ss != NULL)
{
gcc_assert (se->ss != gfc_ss_terminator);
gcc_assert (se->ss->type == GFC_SS_SCALAR);
gcc_assert (ss != gfc_ss_terminator);
gcc_assert (ss->info->type == GFC_SS_SCALAR);
gcc_assert (se->ss->expr == expr);
se->expr = se->ss->data.scalar.expr;
......
......@@ -2893,7 +2893,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
if (!sym->attr.elemental)
{
gcc_assert (se->ss->type == GFC_SS_FUNCTION);
gcc_assert (se->ss->info->type == GFC_SS_FUNCTION);
if (se->ss->useflags)
{
gcc_assert ((!comp && gfc_return_by_reference (sym)
......@@ -4239,8 +4239,11 @@ is_zero_initializer_p (gfc_expr * expr)
static void
gfc_conv_array_constructor_expr (gfc_se * se, gfc_expr * expr)
{
gcc_assert (se->ss != NULL && se->ss != gfc_ss_terminator);
gcc_assert (se->ss->expr == expr && se->ss->type == GFC_SS_CONSTRUCTOR);
gfc_ss *ss;
ss = se->ss;
gcc_assert (ss != NULL && ss != gfc_ss_terminator);
gcc_assert (ss->expr == expr && ss->info->type == GFC_SS_CONSTRUCTOR);
gfc_conv_tmp_array_ref (se);
}
......@@ -4821,13 +4824,17 @@ gfc_conv_substring_expr (gfc_se * se, gfc_expr * expr)
void
gfc_conv_expr (gfc_se * se, gfc_expr * expr)
{
if (se->ss && se->ss->expr == expr
&& (se->ss->type == GFC_SS_SCALAR || se->ss->type == GFC_SS_REFERENCE))
gfc_ss *ss;
ss = se->ss;
if (ss && ss->expr == expr
&& (ss->info->type == GFC_SS_SCALAR
|| ss->info->type == GFC_SS_REFERENCE))
{
/* Substitute a scalar expression evaluated outside the scalarization
loop. */
se->expr = se->ss->data.scalar.expr;
if (se->ss->type == GFC_SS_REFERENCE)
if (ss->info->type == GFC_SS_REFERENCE)
se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
se->string_length = se->ss->string_length;
gfc_advance_se_ss_chain (se);
......@@ -4946,10 +4953,12 @@ gfc_conv_expr_type (gfc_se * se, gfc_expr * expr, tree type)
void
gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
{
gfc_ss *ss;
tree var;
if (se->ss && se->ss->expr == expr
&& se->ss->type == GFC_SS_REFERENCE)
ss = se->ss;
if (ss && ss->expr == expr
&& ss->info->type == GFC_SS_REFERENCE)
{
/* Returns a reference to the scalar evaluated outside the loop
for this case. */
......@@ -6154,7 +6163,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
/* Find a non-scalar SS from the lhs. */
while (lss_section != gfc_ss_terminator
&& lss_section->type != GFC_SS_SECTION)
&& lss_section->info->type != GFC_SS_SECTION)
lss_section = lss_section->next;
gcc_assert (lss_section != gfc_ss_terminator);
......
......@@ -6753,8 +6753,8 @@ walk_inline_intrinsic_transpose (gfc_ss *ss, gfc_expr *expr)
for (tmp_ss = arg_ss; ; tmp_ss = tmp_ss->next)
{
if (tmp_ss->type != GFC_SS_SCALAR
&& tmp_ss->type != GFC_SS_REFERENCE)
if (tmp_ss->info->type != GFC_SS_SCALAR
&& tmp_ss->info->type != GFC_SS_REFERENCE)
{
int tmp_dim;
......
......@@ -4048,7 +4048,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
/* Find a non-scalar SS from the lhs. */
while (lss_section != gfc_ss_terminator
&& lss_section->type != GFC_SS_SECTION)
&& lss_section->info->type != GFC_SS_SECTION)
lss_section = lss_section->next;
gcc_assert (lss_section != gfc_ss_terminator);
......
......@@ -183,6 +183,15 @@ typedef enum
gfc_ss_type;
typedef struct gfc_ss_info
{
gfc_ss_type type;
}
gfc_ss_info;
#define gfc_get_ss_info() XCNEW (gfc_ss_info)
/* Scalarization State chain. Created by walking an expression tree before
creating the scalarization loops. Then passed as part of a gfc_se structure
to translate the expression inside the loop. Note that these chains are
......@@ -193,7 +202,8 @@ gfc_ss_type;
typedef struct gfc_ss
{
gfc_ss_type type;
gfc_ss_info *info;
gfc_expr *expr;
tree string_length;
union
......
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