aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobi@gcc.gnu.org>2008-02-24 17:43:23 +0100
committerTobias Schlüter <tobi@gcc.gnu.org>2008-02-24 17:43:23 +0100
commit44855d8c09f755264f7fd7f86a343413e2edcd44 (patch)
tree405bd7396b605b64b780b51b408b0d9c87bcc36e /gcc/fortran/trans-expr.c
parentfaebccf9b6ec3f4bfdcc268fc55cf58c397bed6c (diff)
downloadgcc-44855d8c09f755264f7fd7f86a343413e2edcd44.zip
gcc-44855d8c09f755264f7fd7f86a343413e2edcd44.tar.gz
gcc-44855d8c09f755264f7fd7f86a343413e2edcd44.tar.bz2
trans-array.c (gfc_conv_descriptor_data_get, [...]): Use fold_buildN instead of buildN.
* trans-array.c (gfc_conv_descriptor_data_get, gfc_conv_descriptor_data_set_internal, gfc_conv_descriptor_data_addr, gfc_conv_descriptor_offset, gfc_conv_descriptor_dtype, gfc_conv_descriptor_dimension, gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound, gfc_conv_descriptor_ubound, gfc_trans_create_temp_array, gfc_conv_array_transpose, gfc_grow_array, gfc_trans_array_constructor_subarray, gfc_trans_array_constructor_value, gfc_trans_scalarized_loop_end, gfc_array_init_size, gfc_array_allocate, gfc_array_deallocate, gfc_conv_array_initializer, gfc_trans_array_bounds, gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias, gfc_get_dataptr_offset, gfc_conv_array_parameter, gfc_trans_dealloc_allocated, get_full_array_size, gfc_duplicate_allocatable, structure_alloc_comps): Use fold_buildN instead of buildN. * trans-expr.c (gfc_conv_expr_present, gfc_conv_missing_dummy, gfc_conv_component_ref, gfc_conv_cst_int_power, gfc_conv_function_call, gfc_trans_structur_assign): Likewise. * trans-common.c (create_common): Likewise. * trans-openmp.c (gfc_trans_omp_atomic, gfc_trans_omp_do): Likewise. * trans-const.c (gfc_conv_constant_to_tree): Likewise. * trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_do, gfc_trans_integer_select, gfc_trans_character_select, gfc_trans_forall_loop, compute_overall_iter_number, gfc_trans_forall_1, gfc_evaluate_where_mask, gfc_trans_allocate, gfc_trans_deallocate): Likewise. * trans.c (gfc_build_addr_expr, gfc_trans_runtime_check, gfc_allocate_with_status, gfc_allocate_array_with_status, gfc_deallocate_with_status): Likewise. * f95-lang.c (gfc_truthvalue_conversion): Likewise. * trans-io.c (set_parameter_const, set_parameter_value, set_parameter_ref, set_string, set_internal_unit, io_result, set_error_locus, nml_get_addr_expr, transfer_expr): Likewise. * trans-decl.c (gfc_build_qualified_array, build_entry_thunks, gfc_get_fake_result_decl, gfc_trans_auto_character_variable, gfc_generate_function_code): Likewise. * convert.c (convert): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_conversion, build_fixbound_expr, build_fix_expr, gfc_conv_intrinsic_aint, gfc_conv_intrinsic_int, gfc_conv_intrinsic_imagpart, gfc_conv_intrinsic_conjg, gfc_conv_intrinsic_abs, gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod, gfc_conv_intrinsic_dim, gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_ctime, gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam, gfc_conv_intrinsic_minmax, gfc_conv_intrinsic_minmax_char, gfc_conv_intrinsic_count, gfc_conv_intrinsic_arith, gfc_conv_intrinsic_dot_product, gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest, gfc_conv_intrinsic_not, gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft, gfc_conv_intrinsic_ichar, gfc_conv_intrinsic_size, gfc_conv_intrinsic_array_transfer, gfc_conv_intrinsic_transfer, gfc_conv_allocated, gfc_conv_associated, gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat): Likewise. From-SVN: r132592
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 37fc728..471f168 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1,5 +1,5 @@
/* Expression translation
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
and Steven Bosscher <s.bosscher@student.tudelft.nl>
@@ -139,8 +139,8 @@ gfc_conv_expr_present (gfc_symbol * sym)
|| GFC_ARRAY_TYPE_P (TREE_TYPE (decl)));
decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
}
- return build2 (NE_EXPR, boolean_type_node, decl,
- fold_convert (TREE_TYPE (decl), null_pointer_node));
+ return fold_build2 (NE_EXPR, boolean_type_node, decl,
+ fold_convert (TREE_TYPE (decl), null_pointer_node));
}
@@ -176,8 +176,8 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
if (ts.type == BT_CHARACTER)
{
tmp = build_int_cst (gfc_charlen_type_node, 0);
- tmp = build3 (COND_EXPR, gfc_charlen_type_node, present,
- se->string_length, tmp);
+ tmp = fold_build3 (COND_EXPR, gfc_charlen_type_node,
+ present, se->string_length, tmp);
tmp = gfc_evaluate_now (tmp, &se->pre);
se->string_length = tmp;
}
@@ -378,7 +378,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
field = c->backend_decl;
gcc_assert (TREE_CODE (field) == FIELD_DECL);
decl = se->expr;
- tmp = build3 (COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE);
+ tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE);
se->expr = tmp;
@@ -748,25 +748,27 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs)
/* If rhs < 0 and lhs is an integer, the result is -1, 0 or 1. */
if ((sgn == -1) && (TREE_CODE (type) == INTEGER_TYPE))
{
- tmp = build2 (EQ_EXPR, boolean_type_node, lhs,
- build_int_cst (TREE_TYPE (lhs), -1));
- cond = build2 (EQ_EXPR, boolean_type_node, lhs,
- build_int_cst (TREE_TYPE (lhs), 1));
+ tmp = fold_build2 (EQ_EXPR, boolean_type_node,
+ lhs, build_int_cst (TREE_TYPE (lhs), -1));
+ cond = fold_build2 (EQ_EXPR, boolean_type_node,
+ lhs, build_int_cst (TREE_TYPE (lhs), 1));
/* If rhs is even,
result = (lhs == 1 || lhs == -1) ? 1 : 0. */
if ((n & 1) == 0)
{
- tmp = build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
- se->expr = build3 (COND_EXPR, type, tmp, build_int_cst (type, 1),
- build_int_cst (type, 0));
+ tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
+ se->expr = fold_build3 (COND_EXPR, type,
+ tmp, build_int_cst (type, 1),
+ build_int_cst (type, 0));
return 1;
}
/* If rhs is odd,
result = (lhs == 1) ? 1 : (lhs == -1) ? -1 : 0. */
- tmp = build3 (COND_EXPR, type, tmp, build_int_cst (type, -1),
- build_int_cst (type, 0));
- se->expr = build3 (COND_EXPR, type, cond, build_int_cst (type, 1), tmp);
+ tmp = fold_build3 (COND_EXPR, type, tmp, build_int_cst (type, -1),
+ build_int_cst (type, 0));
+ se->expr = fold_build3 (COND_EXPR, type,
+ cond, build_int_cst (type, 1), tmp);
return 1;
}
@@ -775,7 +777,7 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs)
if (sgn == -1)
{
tmp = gfc_build_const (type, integer_one_node);
- vartmp[1] = build2 (RDIV_EXPR, type, tmp, vartmp[1]);
+ vartmp[1] = fold_build2 (RDIV_EXPR, type, tmp, vartmp[1]);
}
se->expr = gfc_conv_powi (se, n, vartmp);
@@ -2306,9 +2308,9 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
if (arg->next == NULL)
/* Only given one arg so generate a null and do a
not-equal comparison against the first arg. */
- se->expr = build2 (NE_EXPR, boolean_type_node, arg1se.expr,
- fold_convert (TREE_TYPE (arg1se.expr),
- null_pointer_node));
+ se->expr = fold_build2 (NE_EXPR, boolean_type_node, arg1se.expr,
+ fold_convert (TREE_TYPE (arg1se.expr),
+ null_pointer_node));
else
{
tree eq_expr;
@@ -2321,16 +2323,16 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
gfc_add_block_to_block (&se->post, &arg2se.post);
/* Generate test to compare that the two args are equal. */
- eq_expr = build2 (EQ_EXPR, boolean_type_node, arg1se.expr,
- arg2se.expr);
+ eq_expr = fold_build2 (EQ_EXPR, boolean_type_node,
+ arg1se.expr, arg2se.expr);
/* Generate test to ensure that the first arg is not null. */
- not_null_expr = build2 (NE_EXPR, boolean_type_node, arg1se.expr,
- null_pointer_node);
+ not_null_expr = fold_build2 (NE_EXPR, boolean_type_node,
+ arg1se.expr, null_pointer_node);
/* Finally, the generated test must check that both arg1 is not
NULL and that it is equal to the second arg. */
- se->expr = build2 (TRUTH_AND_EXPR, boolean_type_node,
- not_null_expr, eq_expr);
+ se->expr = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
+ not_null_expr, eq_expr);
}
return 0;
@@ -3418,7 +3420,8 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr)
}
field = cm->backend_decl;
- tmp = build3 (COMPONENT_REF, TREE_TYPE (field), dest, field, NULL_TREE);
+ tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (field),
+ dest, field, NULL_TREE);
tmp = gfc_trans_subcomponent_assign (tmp, cm, c->expr);
gfc_add_expr_to_block (&block, tmp);
}