+2005-12-16 Richard Guenther <rguenther@suse.de>
+
+ * trans.h (gfc_build_indirect_ref): Remove declaration.
+ * trans.c (gfc_build_indirect_ref): Remove.
+ * trans-array.c (gfc_trans_array_ctor_element): Use
+ build_fold_indirect_ref instead of gfc_build_indirect_ref.
+ (gfc_trans_array_constructor_value): Likewise.
+ (gfc_conv_array_index_offset): Likewise.
+ (gfc_conv_scalarized_array_ref): Likewise.
+ (gfc_conv_array_ref): Likewise.
+ (gfc_trans_dummy_array_bias): Likewise.
+ (gfc_conv_expr_descriptor): Likewise.
+ (gfc_conv_array_parameter): Likewise.
+ * trans-decl.c (gfc_finish_cray_pointee): Likewise.
+ (gfc_get_symbol_decl): Likewise.
+ * trans-expr.c (gfc_conv_substring): Likewise.
+ (gfc_conv_component_ref): Likewise.
+ (gfc_conv_variable): Likewise.
+ (gfc_add_interface_mapping): Likewise.
+ (gfc_conv_function_call): Likewise.
+ * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Likewise.
+ (gfc_conv_intrinsic_transfer): Likewise.
+ * trans-io.c (nml_get_addr_expr): Likewise.
+ (transfer_namelist_element): Likewise.
+ (transfer_expr): Likewise.
+ * trans-stmt.c (gfc_trans_nested_forall_loop): Likewise.
+ (allocate_temp_for_forall_nest_1): Likewise.
+ (gfc_trans_forall_1): Likewise.
+
2005-12-16 Richard Guenther <rguenther@suse.de>
* trans-array.c (gfc_conv_descriptor_data_addr): Use
gfc_conv_expr (se, expr);
/* Store the value. */
- tmp = gfc_build_indirect_ref (gfc_conv_descriptor_data_get (desc));
+ tmp = build_fold_indirect_ref (gfc_conv_descriptor_data_get (desc));
tmp = gfc_build_array_ref (tmp, offset);
if (expr->ts.type == BT_CHARACTER)
{
/* Use BUILTIN_MEMCPY to assign the values. */
tmp = gfc_conv_descriptor_data_get (desc);
- tmp = gfc_build_indirect_ref (tmp);
+ tmp = build_fold_indirect_ref (tmp);
tmp = gfc_build_array_ref (tmp, *poffset);
tmp = build_fold_addr_expr (tmp);
init = build_fold_addr_expr (init);
index, gfc_conv_array_stride (desc, 0));
/* Read the vector to get an index into info->descriptor. */
- data = gfc_build_indirect_ref (gfc_conv_array_data (desc));
+ data = build_fold_indirect_ref (gfc_conv_array_data (desc));
index = gfc_build_array_ref (data, index);
index = gfc_evaluate_now (index, &se->pre);
dimensions. */
index = fold_build2 (PLUS_EXPR, gfc_array_index_type, index, info->offset);
- tmp = gfc_build_indirect_ref (info->data);
+ tmp = build_fold_indirect_ref (info->data);
se->expr = gfc_build_array_ref (tmp, index);
}
/* Access the calculated element. */
tmp = gfc_conv_array_data (se->expr);
- tmp = gfc_build_indirect_ref (tmp);
+ tmp = build_fold_indirect_ref (tmp);
se->expr = gfc_build_array_ref (tmp, index);
}
type = TREE_TYPE (tmpdesc);
gcc_assert (GFC_ARRAY_TYPE_P (type));
dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc);
- dumdesc = gfc_build_indirect_ref (dumdesc);
+ dumdesc = build_fold_indirect_ref (dumdesc);
gfc_start_block (&block);
if (sym->ts.type == BT_CHARACTER
stmt = gfc_finish_block (&cleanup);
/* Only do the cleanup if the array was repacked. */
- tmp = gfc_build_indirect_ref (dumdesc);
+ tmp = build_fold_indirect_ref (dumdesc);
tmp = gfc_conv_descriptor_data_get (tmp);
tmp = build2 (NE_EXPR, boolean_type_node, tmp, tmpdesc);
stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
if (expr->ts.type == BT_CHARACTER)
{
gfc_conv_expr (&rse, expr);
- rse.expr = gfc_build_indirect_ref (rse.expr);
+ rse.expr = build_fold_indirect_ref (rse.expr);
}
else
gfc_conv_expr_val (&rse, expr);
/* Point the data pointer at the first element in the section. */
tmp = gfc_conv_array_data (desc);
- tmp = gfc_build_indirect_ref (tmp);
+ tmp = build_fold_indirect_ref (tmp);
tmp = gfc_build_array_ref (tmp, offset);
offset = gfc_build_addr_expr (gfc_array_dataptr_type (desc), tmp);
gfc_conv_descriptor_data_set (&loop.pre, parm, offset);
gfc_init_block (&block);
/* Only if it was repacked. This code needs to be executed before the
loop cleanup code. */
- tmp = gfc_build_indirect_ref (desc);
+ tmp = build_fold_indirect_ref (desc);
tmp = gfc_conv_array_data (tmp);
tmp = build2 (NE_EXPR, boolean_type_node, ptr, tmp);
tmp = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
/* Parameters need to be dereferenced. */
if (sym->cp_pointer->attr.dummy)
- ptr_decl = gfc_build_indirect_ref (ptr_decl);
+ ptr_decl = build_fold_indirect_ref (ptr_decl);
/* Check to see if we're dealing with a variable-sized array. */
if (sym->attr.dimension
{
ptr_decl = convert (build_pointer_type (TREE_TYPE (decl)),
ptr_decl);
- value = gfc_build_indirect_ref (ptr_decl);
+ value = build_fold_indirect_ref (ptr_decl);
}
SET_DECL_VALUE_EXPR (decl, value);
if (sym->attr.pointer && sym->attr.dummy
&& sym->attr.dimension)
{
- tmp = gfc_build_indirect_ref (sym->backend_decl);
+ tmp = build_fold_indirect_ref (sym->backend_decl);
etype = gfc_get_element_type (TREE_TYPE (tmp));
if (TYPE_SIZE_UNIT (etype) == NULL_TREE)
{
if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
tmp = se->expr;
else
- tmp = gfc_build_indirect_ref (se->expr);
+ tmp = build_fold_indirect_ref (se->expr);
tmp = gfc_build_array_ref (tmp, start.expr);
se->expr = gfc_build_addr_expr (type, tmp);
}
}
if (c->pointer && c->dimension == 0 && c->ts.type != BT_CHARACTER)
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
}
&& (sym->attr.dummy
|| sym->attr.function
|| sym->attr.result))
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
}
else
{
/* Dereference non-character scalar dummy arguments. */
if (sym->attr.dummy && !sym->attr.dimension)
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
/* Dereference scalar hidden result. */
if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX
&& (sym->attr.function || sym->attr.result)
&& !sym->attr.dimension && !sym->attr.pointer)
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
/* Dereference non-character pointer variables.
These must be dummies, results, or scalars. */
|| sym->attr.function
|| sym->attr.result
|| !sym->attr.dimension))
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
}
ref = expr->ref;
value = fold_convert (tmp, se->expr);
if (sym->attr.pointer)
- value = gfc_build_indirect_ref (value);
+ value = build_fold_indirect_ref (value);
}
/* If the argument is a scalar or a pointer to an array, dereference it. */
else if (!sym->attr.dimension || sym->attr.pointer)
- value = gfc_build_indirect_ref (se->expr);
+ value = build_fold_indirect_ref (se->expr);
/* If the argument is an array descriptor, use it to determine
information about the actual argument's shape. */
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr))))
{
/* Get the actual argument's descriptor. */
- desc = gfc_build_indirect_ref (se->expr);
+ desc = build_fold_indirect_ref (se->expr);
/* Create the replacement variable. */
tmp = gfc_conv_descriptor_data_get (desc);
x = f()
where f is pointer valued, we have to dereference the result. */
if (!se->want_pointer && !byref && sym->attr.pointer)
- se->expr = gfc_build_indirect_ref (se->expr);
+ se->expr = build_fold_indirect_ref (se->expr);
/* f2c calling conventions require a scalar default real function to
return a double precision result. Convert this back to default
{
/* Dereference for character pointer results. */
if (sym->attr.pointer || sym->attr.allocatable)
- se->expr = gfc_build_indirect_ref (var);
+ se->expr = build_fold_indirect_ref (var);
else
se->expr = var;
else
{
gcc_assert (sym->ts.type == BT_COMPLEX && gfc_option.flag_f2c);
- se->expr = gfc_build_indirect_ref (var);
+ se->expr = build_fold_indirect_ref (var);
}
}
}
arg = build1 (NOP_EXPR, pchar_type_node, arg);
type = gfc_typenode_for_spec (&expr->ts);
- se->expr = gfc_build_indirect_ref (arg);
+ se->expr = build_fold_indirect_ref (arg);
se->expr = convert (type, se->expr);
}
}
else
{
- se->expr = gfc_build_indirect_ref (ptr);
+ se->expr = build_fold_indirect_ref (ptr);
}
}
dummy_arg_flagged = POINTER_TYPE_P (TREE_TYPE(tmp));
- itmp = (dummy_arg_flagged) ? gfc_build_indirect_ref (tmp) : tmp;
+ itmp = (dummy_arg_flagged) ? build_fold_indirect_ref (tmp) : tmp;
/* If an array, set flag and use indirect ref. if built. */
/* If scalar dummy, resolve indirect reference now. */
if (dummy_arg_flagged && !array_flagged)
- tmp = gfc_build_indirect_ref (tmp);
+ tmp = build_fold_indirect_ref (tmp);
gcc_assert (tmp && POINTER_TYPE_P (TREE_TYPE (tmp)));
/* Provide the RECORD_TYPE to build component references. */
- tree expr = gfc_build_indirect_ref (addr_expr);
+ tree expr = build_fold_indirect_ref (addr_expr);
for (cmp = ts->derived->components; cmp; cmp = cmp->next)
{
arg2 = se->string_length;
else
{
- tmp = gfc_build_indirect_ref (addr_expr);
+ tmp = build_fold_indirect_ref (addr_expr);
gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
}
case BT_DERIVED:
/* Recurse into the elements of the derived type. */
expr = gfc_evaluate_now (addr_expr, &se->pre);
- expr = gfc_build_indirect_ref (expr);
+ expr = build_fold_indirect_ref (expr);
for (c = ts->derived->components; c; c = c->next)
{
{
/* If a mask was specified make the assignment conditional. */
if (pmask)
- tmp = gfc_build_indirect_ref (mask);
+ tmp = build_fold_indirect_ref (mask);
else
tmp = mask;
tmp = gfc_build_array_ref (tmp, maskindex);
temp1 = gfc_do_allocate (bytesize, size, ptemp1, block, type);
if (*ptemp1)
- tmp = gfc_build_indirect_ref (temp1);
+ tmp = build_fold_indirect_ref (temp1);
else
tmp = temp1;
se.expr = convert (smallest_boolean_type_node, se.expr);
if (pmask)
- tmp = gfc_build_indirect_ref (mask);
+ tmp = build_fold_indirect_ref (mask);
else
tmp = mask;
tmp = gfc_build_array_ref (tmp, maskindex);
}
-/* Build an INDIRECT_REF with its natural type. */
-
-tree
-gfc_build_indirect_ref (tree t)
-{
- tree type = TREE_TYPE (t);
- gcc_assert (POINTER_TYPE_P (type));
- type = TREE_TYPE (type);
-
- if (TREE_CODE (t) == ADDR_EXPR)
- return TREE_OPERAND (t, 0);
- else
- return build1 (INDIRECT_REF, type, t);
-}
-
-
/* Build an ARRAY_REF with its natural type. */
tree
/* Build an ADDR_EXPR. */
tree gfc_build_addr_expr (tree, tree);
-/* Build an INDIRECT_REF. */
-tree gfc_build_indirect_ref (tree);
-
/* Build an ARRAY_REF. */
tree gfc_build_array_ref (tree, tree);