* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
+2004-08-25 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * trans.h (build2_v, build3_v): New macros.
+ (build_v): Remove.
+ * f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
+ build.
+ * trans-array.c (gfc_conv_descriptor_data,
+ gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
+ gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
+ gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
+ gfc_trans_allocate_temp_array,
+ gfc_trans_array_constructor_subarray,
+ gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
+ gfc_trans_array_bound_check, gfc_conv_array_index_offset,
+ gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
+ gfc_conv_array_ref, gfc_trans_preloop_setup,
+ gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
+ gfc_conv_loop_setup, gfc_array_init_size,
+ gfc_conv_array_initializer, gfc_trans_array_bounds,
+ gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
+ gfc_conv_expr_descriptor, gfc_conv_array_parameter,
+ gfc_trans_deferred_array): Use buildN and buildN_v macros instead
+ of build and build_v as appropriate.
+ * trans-common.c (create_common): Same.
+ * trans-decl.c (gfc_trans_auto_character_variable,
+ gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
+ * trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
+ gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
+ gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
+ gfc_conv_expr_op, gfc_conv_function_call,
+ gfc_trans_structure_assign): Same.
+ * trans-intrinsic.c (build_fixbound_expr, build_round_expr,
+ gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
+ gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
+ gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
+ gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
+ gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
+ gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
+ gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
+ gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
+ gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
+ gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
+ gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
+ gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
+ gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
+ gfc_conv_intrinsic_iargc): Same.
+ * trans-io.c (set_parameter_value, set_parameter_ref, set_string,
+ set_flag, add_case, io_result, transfer_namelist_element,
+ transfer_expr): Same.
+ * trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
+ gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
+ gfc_trans_integer_select, gfc_trans_logical_select,
+ gfc_trans_character_select, gfc_trans_forall_loop,
+ gfc_trans_nested_forall_loop, gfc_do_allocate,
+ generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
+ compute_inner_temp_size, compute_overall_iter_number,
+ allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
+ gfc_trans_forall_1, gfc_evaluate_where_mask,
+ gfc_trans_where_assign, gfc_trans_allocate): Same.
+ * trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
+ * trans.c (gfc_add_modify_expr, gfc_finish_block,
+ gfc_build_array_ref, gfc_build_function_call,
+ gfc_trans_runtime_check): Same.
+
2004-08-25 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* trans-const.c (gfc_conv_mpz_to_tree): Change call to
if (TREE_CODE (expr) == INTEGER_CST)
return integer_zerop (expr) ? boolean_false_node : boolean_true_node;
else
- return build (NE_EXPR, boolean_type_node, expr, integer_zero_node);
+ return build2 (NE_EXPR, boolean_type_node, expr, integer_zero_node);
default:
internal_error ("Unexpected type in truthvalue_conversion");
&& TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == ARRAY_TYPE);
- return build (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
+ return build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
}
tree
field = gfc_advance_chain (TYPE_FIELDS (type), OFFSET_FIELD);
assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
- return build (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
+ return build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
}
tree
field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD);
assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
- return build (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
+ return build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
}
static tree
&& TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == RECORD_TYPE);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
tmp = gfc_build_array_ref (tmp, dim);
return tmp;
}
field = gfc_advance_chain (field, STRIDE_SUBFIELD);
assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
return tmp;
}
field = gfc_advance_chain (field, LBOUND_SUBFIELD);
assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
return tmp;
}
field = gfc_advance_chain (field, UBOUND_SUBFIELD);
assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE);
return tmp;
}
if (onstack)
{
/* Make a temporary variable to hold the data. */
- tmp = fold (build (MINUS_EXPR, TREE_TYPE (nelem), nelem,
- integer_one_node));
+ tmp = fold (build2 (MINUS_EXPR, TREE_TYPE (nelem), nelem,
+ integer_one_node));
tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node,
tmp);
tmp = build_array_type (gfc_get_element_type (TREE_TYPE (desc)),
{
/* Callee allocated arrays may not have a known bound yet. */
if (loop->to[n])
- loop->to[n] = fold (build (MINUS_EXPR, gfc_array_index_type,
- loop->to[n], loop->from[n]));
+ loop->to[n] = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ loop->to[n], loop->from[n]));
loop->from[n] = gfc_index_zero_node;
}
{
/* For a callee allocated array express the loop bounds in terms
of the descriptor fields. */
- tmp = build (MINUS_EXPR, gfc_array_index_type,
- gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]),
- gfc_conv_descriptor_lbound (desc, gfc_rank_cst[n]));
+ tmp = build2 (MINUS_EXPR, gfc_array_index_type,
+ gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]),
+ gfc_conv_descriptor_lbound (desc, gfc_rank_cst[n]));
loop->to[n] = tmp;
size = NULL_TREE;
continue;
tmp = gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]);
gfc_add_modify_expr (&loop->pre, tmp, loop->to[n]);
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- loop->to[n], gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ loop->to[n], gfc_index_one_node));
- size = fold (build (MULT_EXPR, gfc_array_index_type, size, tmp));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, size, tmp));
size = gfc_evaluate_now (size, &loop->pre);
}
/* Get the size of the array. */
nelem = size;
if (size)
- size = fold (build (MULT_EXPR, gfc_array_index_type, size,
- TYPE_SIZE_UNIT (gfc_get_element_type (type))));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, size,
+ TYPE_SIZE_UNIT (gfc_get_element_type (type))));
gfc_trans_allocate_array_storage (loop, info, size, nelem);
gfc_add_modify_expr (&body, tmp, se.expr);
/* Increment the offset. */
- tmp = build (PLUS_EXPR, gfc_array_index_type, *poffset, gfc_index_one_node);
+ tmp = build2 (PLUS_EXPR, gfc_array_index_type, *poffset, gfc_index_one_node);
gfc_add_modify_expr (&body, *poffset, tmp);
/* Finish the loop. */
fold_convert (TREE_TYPE (ref), se.expr));
gfc_add_block_to_block (&body, &se.post);
- *poffset = fold (build (PLUS_EXPR, gfc_array_index_type,
- *poffset, gfc_index_one_node));
+ *poffset = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ *poffset, gfc_index_one_node));
}
else
{
tmp);
gfc_add_expr_to_block (&body, tmp);
- *poffset = fold (build (PLUS_EXPR, gfc_array_index_type,
- *poffset, bound));
+ *poffset = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ *poffset, bound));
}
if (!INTEGER_CST_P (*poffset))
{
gfc_start_block (&body);
/* Generate the exit condition. */
- end = build (GT_EXPR, boolean_type_node, loopvar, end);
+ end = build2 (GT_EXPR, boolean_type_node, loopvar, end);
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
- tmp = build_v (COND_EXPR, end, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, end, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
/* The main loop body. */
gfc_add_expr_to_block (&body, loopbody);
/* Increment the loop variable. */
- tmp = build (PLUS_EXPR, TREE_TYPE (loopvar), loopvar, step);
+ tmp = build2 (PLUS_EXPR, TREE_TYPE (loopvar), loopvar, step);
gfc_add_modify_expr (&body, loopvar, tmp);
/* Finish the loop. */
tmp = gfc_finish_block (&body);
- tmp = build_v (LOOP_EXPR, tmp);
+ tmp = build1_v (LOOP_EXPR, tmp);
gfc_add_expr_to_block (pblock, tmp);
/* Add the exit label. */
{
/* index = index + stride[n]*indices[n] */
tmp = gfc_conv_array_stride (se->expr, n);
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, indices[n], tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, indices[n], tmp));
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index, tmp));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, index, tmp));
}
/* Result = data[index]. */
index = gfc_evaluate_now (index, &se->pre);
/* Check lower bound. */
tmp = gfc_conv_array_lbound (descriptor, n);
- fault = fold (build (LT_EXPR, boolean_type_node, index, tmp));
+ fault = fold (build2 (LT_EXPR, boolean_type_node, index, tmp));
/* Check upper bound. */
tmp = gfc_conv_array_ubound (descriptor, n);
- cond = fold (build (GT_EXPR, boolean_type_node, index, tmp));
- fault = fold (build (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
+ cond = fold (build2 (GT_EXPR, boolean_type_node, index, tmp));
+ fault = fold (build2 (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
gfc_trans_runtime_check (fault, gfc_strconst_fault, &se->pre);
/* Multiply the loop variable by the stride and dela. */
index = se->loop->loopvar[i];
- index = fold (build (MULT_EXPR, gfc_array_index_type, index,
- info->stride[i]));
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index,
- info->delta[i]));
+ index = fold (build2 (MULT_EXPR, gfc_array_index_type, index,
+ info->stride[i]));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, index,
+ info->delta[i]));
if (ar->dimen_type[dim] == DIMEN_VECTOR)
{
assert (se->loop);
index = se->loop->loopvar[se->loop->order[i]];
if (!integer_zerop (info->delta[i]))
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index,
- info->delta[i]));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ index, info->delta[i]));
}
/* Multiply by the stride. */
- index = fold (build (MULT_EXPR, gfc_array_index_type, index, stride));
+ index = fold (build2 (MULT_EXPR, gfc_array_index_type, index, stride));
return index;
}
info->stride0);
/* Add the offset for this dimension to the stored offset for all other
dimensions. */
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index, info->offset));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, index, info->offset));
tmp = gfc_build_indirect_ref (info->data);
se->expr = gfc_build_array_ref (tmp, index);
indexse.expr = gfc_evaluate_now (indexse.expr, &se->pre);
tmp = gfc_conv_array_lbound (se->expr, n);
- cond = fold (build (LT_EXPR, boolean_type_node, indexse.expr, tmp));
+ cond = fold (build2 (LT_EXPR, boolean_type_node,
+ indexse.expr, tmp));
fault =
- fold (build (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
+ fold (build2 (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
tmp = gfc_conv_array_ubound (se->expr, n);
- cond = fold (build (GT_EXPR, boolean_type_node, indexse.expr, tmp));
+ cond = fold (build2 (GT_EXPR, boolean_type_node,
+ indexse.expr, tmp));
fault =
- fold (build (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
+ fold (build2 (TRUTH_OR_EXPR, boolean_type_node, fault, cond));
}
/* Multiply the index by the stride. */
stride = gfc_conv_array_stride (se->expr, n);
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, indexse.expr,
- stride));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, indexse.expr,
+ stride));
/* And add it to the total. */
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index, tmp));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, index, tmp));
}
if (flag_bounds_check)
tmp = gfc_conv_array_offset (se->expr);
if (!integer_zerop (tmp))
- index = fold (build (PLUS_EXPR, gfc_array_index_type, index, tmp));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, index, tmp));
/* Access the calculated element. */
tmp = gfc_conv_array_data (se->expr);
stride);
gfc_add_block_to_block (pblock, &se.pre);
- info->offset = fold (build (PLUS_EXPR, gfc_array_index_type,
- info->offset, index));
+ info->offset = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ info->offset, index));
info->offset = gfc_evaluate_now (info->offset, pblock);
}
index = gfc_conv_array_index_offset (&se, info, info->dim[i], i,
ar, stride);
gfc_add_block_to_block (pblock, &se.pre);
- info->offset = fold (build (PLUS_EXPR, gfc_array_index_type,
- info->offset, index));
+ info->offset = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ info->offset, index));
info->offset = gfc_evaluate_now (info->offset, pblock);
}
gfc_init_block (&block);
/* The exit condition. */
- cond = build (GT_EXPR, boolean_type_node, loop->loopvar[n], loop->to[n]);
+ cond = build2 (GT_EXPR, boolean_type_node, loop->loopvar[n], loop->to[n]);
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
- tmp = build_v (COND_EXPR, cond, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
/* The main body. */
gfc_add_expr_to_block (&block, loopbody);
/* Increment the loopvar. */
- tmp = build (PLUS_EXPR, gfc_array_index_type,
- loop->loopvar[n], gfc_index_one_node);
+ tmp = build2 (PLUS_EXPR, gfc_array_index_type,
+ loop->loopvar[n], gfc_index_one_node);
gfc_add_modify_expr (&block, loop->loopvar[n], tmp);
/* Build the loop. */
tmp = gfc_finish_block (&block);
- tmp = build_v (LOOP_EXPR, tmp);
+ tmp = build1_v (LOOP_EXPR, tmp);
gfc_add_expr_to_block (&loop->code[n], tmp);
/* Add the exit label. */
/* Check lower bound. */
bound = gfc_conv_array_lbound (desc, dim);
tmp = info->start[n];
- tmp = fold (build (LT_EXPR, boolean_type_node, tmp, bound));
- fault = fold (build (TRUTH_OR_EXPR, boolean_type_node, fault,
- tmp));
+ tmp = fold (build2 (LT_EXPR, boolean_type_node, tmp, bound));
+ fault = fold (build2 (TRUTH_OR_EXPR, boolean_type_node, fault,
+ tmp));
/* Check the upper bound. */
bound = gfc_conv_array_ubound (desc, dim);
end = gfc_conv_section_upper_bound (ss, n, &block);
- tmp = fold (build (GT_EXPR, boolean_type_node, end, bound));
- fault = fold (build (TRUTH_OR_EXPR, boolean_type_node, fault,
- tmp));
+ tmp = fold (build2 (GT_EXPR, boolean_type_node, end, bound));
+ fault = fold (build2 (TRUTH_OR_EXPR, boolean_type_node, fault,
+ tmp));
/* Check the section sizes match. */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, end,
- info->start[n]));
- tmp = fold (build (FLOOR_DIV_EXPR, gfc_array_index_type, tmp,
- info->stride[n]));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, end,
+ info->start[n]));
+ tmp = fold (build2 (FLOOR_DIV_EXPR, gfc_array_index_type, tmp,
+ info->stride[n]));
/* We remember the size of the first section, and check all the
others against this. */
if (size[n])
{
tmp =
- fold (build (NE_EXPR, boolean_type_node, tmp, size[n]));
+ fold (build2 (NE_EXPR, boolean_type_node, tmp, size[n]));
fault =
- build (TRUTH_OR_EXPR, boolean_type_node, fault, tmp);
+ build2 (TRUTH_OR_EXPR, boolean_type_node, fault, tmp);
}
else
size[n] = gfc_evaluate_now (tmp, &block);
/* To = from + (size - 1) * stride. */
tmp = gfc_conv_mpz_to_tree (i, gfc_index_integer_kind);
if (!integer_onep (info->stride[n]))
- {
- tmp = fold (build (MULT_EXPR, gfc_array_index_type,
- tmp, info->stride[n]));
- }
- loop->to[n] = fold (build (PLUS_EXPR, gfc_array_index_type,
- loop->from[n], tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type,
+ tmp, info->stride[n]));
+ loop->to[n] = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ loop->from[n], tmp));
}
else
{
with start = 0, this simplifies to
last = end / step;
for (i = 0; i<=last; i++){...}; */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, loop->to[n],
- loop->from[n]));
- tmp = fold (build (TRUNC_DIV_EXPR, gfc_array_index_type, tmp,
- info->stride[n]));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ loop->to[n], loop->from[n]));
+ tmp = fold (build2 (TRUNC_DIV_EXPR, gfc_array_index_type,
+ tmp, info->stride[n]));
loop->to[n] = gfc_evaluate_now (tmp, &loop->pre);
/* Make the loop variable start at 0. */
loop->from[n] = gfc_index_zero_node;
{
/* Calculate the offset relative to the loop variable.
First multiply by the stride. */
- tmp = fold (build (MULT_EXPR, gfc_array_index_type,
- loop->from[n], info->stride[n]));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type,
+ loop->from[n], info->stride[n]));
/* Then subtract this from our starting value. */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
- info->start[n], tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ info->start[n], tmp));
info->delta[n] = gfc_evaluate_now (tmp, &loop->pre);
}
gfc_add_modify_expr (pblock, tmp, se.expr);
/* Work out the offset for this component. */
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, se.expr, stride));
- offset = fold (build (MINUS_EXPR, gfc_array_index_type, offset, tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, se.expr, stride));
+ offset = fold (build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp));
/* Start the calculation for the size of this dimension. */
- size = build (MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, se.expr);
+ size = build2 (MINUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, se.expr);
/* Set upper bound. */
gfc_init_se (&se, NULL);
gfc_add_modify_expr (pblock, tmp, stride);
/* Calculate the size of this dimension. */
- size = fold (build (PLUS_EXPR, gfc_array_index_type, se.expr, size));
+ size = fold (build2 (PLUS_EXPR, gfc_array_index_type, se.expr, size));
/* Multiply the stride by the number of elements in this dimension. */
- stride = fold (build (MULT_EXPR, gfc_array_index_type, stride, size));
+ stride = fold (build2 (MULT_EXPR, gfc_array_index_type, stride, size));
stride = gfc_evaluate_now (stride, pblock);
}
/* The stride is the number of elements in the array, so multiply by the
size of an element to get the total size. */
tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
- size = fold (build (MULT_EXPR, gfc_array_index_type, stride, tmp));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, stride, tmp));
if (poffset != NULL)
{
else
tmp1 = gfc_conv_mpz_to_tree (c->n.offset, gfc_index_integer_kind);
- range = build (RANGE_EXPR, integer_type_node, tmp1, tmp2);
+ range = build2 (RANGE_EXPR, integer_type_node, tmp1, tmp2);
}
else
range = NULL;
gfc_add_modify_expr (pblock, ubound, se.expr);
}
/* The offset of this dimension. offset = offset - lbound * stride. */
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, lbound, size));
- offset = fold (build (MINUS_EXPR, gfc_array_index_type, offset, tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, lbound, size));
+ offset = fold (build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp));
/* The size of this dimension, and the stride of the next. */
if (dim + 1 < as->rank)
if (ubound != NULL_TREE && !(stride && INTEGER_CST_P (stride)))
{
/* Calculate stride = size * (ubound + 1 - lbound). */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, lbound));
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type, ubound, tmp));
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, size, tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, lbound));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type, ubound, tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, size, tmp));
if (stride)
gfc_add_modify_expr (pblock, stride, tmp);
else
/* Emit a DECL_EXPR for this variable, which will cause the
gimplifier to allocate stoage, and all that good stuff. */
- tmp = build (DECL_EXPR, TREE_TYPE (decl), decl);
+ tmp = build1 (DECL_EXPR, TREE_TYPE (decl), decl);
gfc_add_expr_to_block (&block, tmp);
}
/* The size is the number of elements in the array, so multiply by the
size of an element to get the total size. */
tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
- size = fold (build (MULT_EXPR, gfc_array_index_type, size, tmp));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, size, tmp));
/* Allocate memory to hold the data. */
tmp = gfc_chainon_list (NULL_TREE, size);
partial = gfc_create_var (boolean_type_node, "partial");
TREE_USED (partial) = 1;
tmp = gfc_conv_descriptor_stride (dumdesc, gfc_rank_cst[0]);
- tmp = fold (build (EQ_EXPR, boolean_type_node, tmp, integer_one_node));
+ tmp = fold (build2 (EQ_EXPR, boolean_type_node, tmp, integer_one_node));
gfc_add_modify_expr (&block, partial, tmp);
}
else
stride = gfc_conv_descriptor_stride (dumdesc, gfc_rank_cst[0]);
stride = gfc_evaluate_now (stride, &block);
- tmp = build (EQ_EXPR, boolean_type_node, stride, integer_zero_node);
- tmp = build (COND_EXPR, gfc_array_index_type, tmp,
- gfc_index_one_node, stride);
+ tmp = build2 (EQ_EXPR, boolean_type_node, stride, integer_zero_node);
+ tmp = build3 (COND_EXPR, gfc_array_index_type, tmp,
+ gfc_index_one_node, stride);
stride = GFC_TYPE_ARRAY_STRIDE (type, 0);
gfc_add_modify_expr (&block, stride, tmp);
if (stmt_packed != NULL_TREE && stmt_unpacked != NULL_TREE)
{
/* Don't repack unknown shape arrays when the first stride is 1. */
- tmp = build (COND_EXPR, TREE_TYPE (stmt_packed), partial,
- stmt_packed, stmt_unpacked);
+ tmp = build3 (COND_EXPR, TREE_TYPE (stmt_packed), partial,
+ stmt_packed, stmt_unpacked);
}
else
tmp = stmt_packed != NULL_TREE ? stmt_packed : stmt_unpacked;
{
/* Check (ubound(a) - lbound(a) == ubound(b) - lbound(b)). */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, ubound,
- lbound));
- stride = build (MINUS_EXPR, gfc_array_index_type, dubound,
- dlbound);
- tmp = fold (build (NE_EXPR, gfc_array_index_type, tmp, stride));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ ubound, lbound));
+ stride = build2 (MINUS_EXPR, gfc_array_index_type,
+ dubound, dlbound);
+ tmp = fold (build2 (NE_EXPR, gfc_array_index_type, tmp, stride));
gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block);
}
}
{
/* For assumed shape arrays move the upper bound by the same amount
as the lower bound. */
- tmp = build (MINUS_EXPR, gfc_array_index_type, dubound, dlbound);
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type, tmp, lbound));
+ tmp = build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound);
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type, tmp, lbound));
gfc_add_modify_expr (&block, ubound, tmp);
}
/* The offset of this dimension. offset = offset - lbound * stride. */
- tmp = fold (build (MULT_EXPR, gfc_array_index_type, lbound, stride));
- offset = fold (build (MINUS_EXPR, gfc_array_index_type, offset, tmp));
+ tmp = fold (build2 (MULT_EXPR, gfc_array_index_type, lbound, stride));
+ offset = fold (build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp));
/* The size of this dimension, and the stride of the next. */
if (n + 1 < sym->as->rank)
else
{
/* Calculate stride = size * (ubound + 1 - lbound). */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, lbound));
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- ubound, tmp));
- size = fold (build (MULT_EXPR, gfc_array_index_type,
- size, tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, lbound));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ ubound, tmp));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type,
+ size, tmp));
stmt_packed = size;
}
/* Assign the stride. */
if (stmt_packed != NULL_TREE && stmt_unpacked != NULL_TREE)
- {
- tmp = build (COND_EXPR, gfc_array_index_type, partial,
- stmt_unpacked, stmt_packed);
- }
+ tmp = build3 (COND_EXPR, gfc_array_index_type, partial,
+ stmt_unpacked, stmt_packed);
else
tmp = (stmt_packed != NULL_TREE) ? stmt_packed : stmt_unpacked;
gfc_add_modify_expr (&block, stride, tmp);
if (optional_arg)
{
tmp = gfc_conv_expr_present (sym);
- stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
+ stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
}
gfc_add_expr_to_block (&block, stmt);
/* Only do the cleanup if the array was repacked. */
tmp = gfc_build_indirect_ref (dumdesc);
tmp = gfc_conv_descriptor_data (tmp);
- tmp = build (NE_EXPR, boolean_type_node, tmp, tmpdesc);
- stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp, tmpdesc);
+ stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
if (optional_arg)
{
tmp = gfc_conv_expr_present (sym);
- stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
+ stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
}
gfc_add_expr_to_block (&block, stmt);
}
}
tmp = gfc_conv_array_lbound (desc, n);
- tmp = fold (build (MINUS_EXPR, TREE_TYPE (tmp), start, tmp));
+ tmp = fold (build2 (MINUS_EXPR, TREE_TYPE (tmp), start, tmp));
- tmp = fold (build (MULT_EXPR, TREE_TYPE (tmp), tmp, stride));
- offset = fold (build (PLUS_EXPR, TREE_TYPE (tmp), offset, tmp));
+ tmp = fold (build2 (MULT_EXPR, TREE_TYPE (tmp), tmp, stride));
+ offset = fold (build2 (PLUS_EXPR, TREE_TYPE (tmp), offset, tmp));
if (info->ref->u.ar.dimen_type[n] == DIMEN_ELEMENT)
{
if (!integer_onep (from))
{
/* Make sure the new section starts at 1. */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
gfc_index_one_node, from));
- to = fold (build (PLUS_EXPR, gfc_array_index_type, to, tmp));
+ to = fold (build2 (PLUS_EXPR, gfc_array_index_type, to, tmp));
from = gfc_index_one_node;
}
tmp = gfc_conv_descriptor_lbound (parm, gfc_rank_cst[dim]);
/* Multiply the stride by the section stride to get the
total stride. */
- stride = fold (build (MULT_EXPR, gfc_array_index_type, stride,
- info->stride[dim]));
+ stride = fold (build2 (MULT_EXPR, gfc_array_index_type,
+ stride, info->stride[dim]));
if (se->direct_byref)
- {
- base = fold (build (MINUS_EXPR, TREE_TYPE (base),
- base, stride));
- }
+ base = fold (build2 (MINUS_EXPR, TREE_TYPE (base),
+ base, stride));
/* Store the new stride. */
tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]);
loop cleanup code. */
tmp = gfc_build_indirect_ref (desc);
tmp = gfc_conv_array_data (tmp);
- tmp = build (NE_EXPR, boolean_type_node, ptr, tmp);
- tmp = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
+ tmp = build2 (NE_EXPR, boolean_type_node, ptr, tmp);
+ tmp = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &se->post);
deallocate = gfc_array_deallocate (descriptor);
tmp = gfc_conv_descriptor_data (descriptor);
- tmp = build (NE_EXPR, boolean_type_node, tmp, integer_zero_node);
- tmp = build_v (COND_EXPR, tmp, deallocate, build_empty_stmt ());
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp, integer_zero_node);
+ tmp = build3_v (COND_EXPR, tmp, deallocate, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
tmp = gfc_finish_block (&block);
/* Build component reference for each variable. */
for (s = current_common; s; s = next_s)
{
- s->sym->backend_decl = build (COMPONENT_REF, TREE_TYPE (s->field),
- decl, s->field, NULL_TREE);
+ s->sym->backend_decl = build3 (COMPONENT_REF, TREE_TYPE (s->field),
+ decl, s->field, NULL_TREE);
next_s = s->next;
gfc_free (s);
/* Emit a DECL_EXPR for this variable, which will cause the
gimplifier to allocate storage, and all that good stuff. */
- tmp = build (DECL_EXPR, TREE_TYPE (decl), decl);
+ tmp = build1 (DECL_EXPR, TREE_TYPE (decl), decl);
gfc_add_expr_to_block (&body, tmp);
gfc_add_expr_to_block (&body, fnbody);
label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
DECL_CONTEXT (label) = current_function_decl;
val = build_int_cst (gfc_array_index_type, el->id);
- tmp = build_v (CASE_LABEL_EXPR, val, NULL_TREE, label);
+ tmp = build3_v (CASE_LABEL_EXPR, val, NULL_TREE, label);
gfc_add_expr_to_block (&block, tmp);
/* And jump to the actual entry point. */
tmp = gfc_finish_block (&block);
/* The first argument selects the entry point. */
val = DECL_ARGUMENTS (current_function_decl);
- tmp = build_v (SWITCH_EXPR, val, tmp, NULL_TREE);
+ tmp = build3_v (SWITCH_EXPR, val, tmp, NULL_TREE);
return tmp;
}
else
{
/* Set the return value to the dummy result variable. */
- tmp = build (MODIFY_EXPR, TREE_TYPE (result),
- DECL_RESULT (fndecl), result);
- tmp = build_v (RETURN_EXPR, tmp);
+ tmp = build2 (MODIFY_EXPR, TREE_TYPE (result),
+ DECL_RESULT (fndecl), result);
+ tmp = build1_v (RETURN_EXPR, tmp);
gfc_add_expr_to_block (&block, tmp);
}
}
|| GFC_ARRAY_TYPE_P (TREE_TYPE (decl)));
decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
}
- return build (NE_EXPR, boolean_type_node, decl,
- fold_convert (TREE_TYPE (decl), null_pointer_node));
+ return build2 (NE_EXPR, boolean_type_node, decl,
+ fold_convert (TREE_TYPE (decl), null_pointer_node));
}
gfc_add_block_to_block (&se->pre, &end.pre);
}
tmp =
- build (MINUS_EXPR, gfc_strlen_type_node,
- fold_convert (gfc_strlen_type_node, integer_one_node),
- start.expr);
- tmp = build (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp);
+ build2 (MINUS_EXPR, gfc_strlen_type_node,
+ fold_convert (gfc_strlen_type_node, integer_one_node),
+ start.expr);
+ tmp = build2 (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp);
se->string_length = fold (tmp);
}
field = c->backend_decl;
assert (TREE_CODE (field) == FIELD_DECL);
decl = se->expr;
- tmp = build (COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE);
se->expr = tmp;
We must convert it to a compare to 0 (e.g. EQ_EXPR (op1, 0)).
All other unary operators have an equivalent GIMPLE unary operator. */
if (code == TRUTH_NOT_EXPR)
- se->expr = build (EQ_EXPR, type, operand.expr,
- convert (type, integer_zero_node));
+ se->expr = build2 (EQ_EXPR, type, operand.expr,
+ convert (type, integer_zero_node));
else
se->expr = build1 (code, type, operand.expr);
op1 = op0;
}
- tmp = fold (build (MULT_EXPR, TREE_TYPE (op0), op0, op1));
+ tmp = fold (build2 (MULT_EXPR, TREE_TYPE (op0), op0, op1));
tmp = gfc_evaluate_now (tmp, &se->pre);
if (n < POWI_TABLE_SIZE)
/* If rhs < 0 and lhs is an integer, the result is -1, 0 or 1. */
if ((sgn == -1) && (TREE_CODE (type) == INTEGER_TYPE))
{
- tmp = build (EQ_EXPR, boolean_type_node, lhs,
- fold_convert (TREE_TYPE (lhs), integer_minus_one_node));
- cond = build (EQ_EXPR, boolean_type_node, lhs,
- convert (TREE_TYPE (lhs), integer_one_node));
+ tmp = build2 (EQ_EXPR, boolean_type_node, lhs,
+ fold_convert (TREE_TYPE (lhs), integer_minus_one_node));
+ cond = build2 (EQ_EXPR, boolean_type_node, lhs,
+ convert (TREE_TYPE (lhs), integer_one_node));
/* If rhs is even,
result = (lhs == 1 || lhs == -1) ? 1 : 0. */
if ((n & 1) == 0)
{
- tmp = build (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
- se->expr = build (COND_EXPR, type, tmp,
- convert (type, integer_one_node),
- convert (type, integer_zero_node));
+ tmp = build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
+ se->expr = build3 (COND_EXPR, type, tmp,
+ convert (type, integer_one_node),
+ convert (type, integer_zero_node));
return 1;
}
/* If rhs is odd,
result = (lhs == 1) ? 1 : (lhs == -1) ? -1 : 0. */
- tmp = build (COND_EXPR, type, tmp,
- convert (type, integer_minus_one_node),
- convert (type, integer_zero_node));
- se->expr = build (COND_EXPR, type, cond,
- convert (type, integer_one_node),
- tmp);
+ tmp = build3 (COND_EXPR, type, tmp,
+ convert (type, integer_minus_one_node),
+ convert (type, integer_zero_node));
+ se->expr = build3 (COND_EXPR, type, cond,
+ convert (type, integer_one_node),
+ tmp);
return 1;
}
if (sgn == -1)
{
tmp = gfc_build_const (type, integer_one_node);
- vartmp[1] = build (RDIV_EXPR, type, tmp, vartmp[1]);
+ vartmp[1] = build2 (RDIV_EXPR, type, tmp, vartmp[1]);
}
se->expr = gfc_conv_powi (se, n, vartmp);
if (gfc_can_put_var_on_stack (len))
{
/* Create a temporary variable to hold the result. */
- tmp = fold (build (MINUS_EXPR, gfc_strlen_type_node, len,
- convert (gfc_strlen_type_node,
- integer_one_node)));
+ tmp = fold (build2 (MINUS_EXPR, gfc_strlen_type_node, len,
+ convert (gfc_strlen_type_node,
+ integer_one_node)));
tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp);
tmp = build_array_type (gfc_character1_type_node, tmp);
var = gfc_create_var (tmp, "str");
len = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
if (len == NULL_TREE)
{
- len = fold (build (PLUS_EXPR, TREE_TYPE (lse.string_length),
- lse.string_length, rse.string_length));
+ len = fold (build2 (PLUS_EXPR, TREE_TYPE (lse.string_length),
+ lse.string_length, rse.string_length));
}
type = build_pointer_type (type);
if (lop)
{
/* The result of logical ops is always boolean_type_node. */
- tmp = fold (build (code, type, lse.expr, rse.expr));
+ tmp = fold (build2 (code, type, lse.expr, rse.expr));
se->expr = convert (type, tmp);
}
else
- se->expr = fold (build (code, type, lse.expr, rse.expr));
+ se->expr = fold (build2 (code, type, lse.expr, rse.expr));
/* Add the post blocks. */
gfc_add_block_to_block (&se->post, &rse.post);
TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node;
fntype = TREE_TYPE (TREE_TYPE (se->expr));
- se->expr = build (CALL_EXPR, TREE_TYPE (fntype), se->expr,
- arglist, NULL_TREE);
+ se->expr = build3 (CALL_EXPR, TREE_TYPE (fntype), se->expr,
+ arglist, NULL_TREE);
/* A pure function may still have side-effects - it may modify its
parameters. */
/* Check the data pointer hasn't been modified. This would
happen in a function returning a pointer. */
tmp = gfc_conv_descriptor_data (info->descriptor);
- tmp = build (NE_EXPR, boolean_type_node, tmp, info->data);
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp, info->data);
gfc_trans_runtime_check (tmp, gfc_strconst_fault, &se->pre);
}
se->expr = info->descriptor;
continue;
field = cm->backend_decl;
- tmp = build (COMPONENT_REF, TREE_TYPE (field), dest, field, NULL_TREE);
+ tmp = 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);
}
intval = gfc_evaluate_now (intval, pblock);
tmp = convert (argtype, intval);
- cond = build (up ? GE_EXPR : LE_EXPR, boolean_type_node, tmp, arg);
+ cond = build2 (up ? GE_EXPR : LE_EXPR, boolean_type_node, tmp, arg);
- tmp = build (up ? PLUS_EXPR : MINUS_EXPR, type, intval,
- convert (type, integer_one_node));
- tmp = build (COND_EXPR, type, cond, intval, tmp);
+ tmp = build2 (up ? PLUS_EXPR : MINUS_EXPR, type, intval,
+ convert (type, integer_one_node));
+ tmp = build3 (COND_EXPR, type, cond, intval, tmp);
return tmp;
}
neg = build_real (argtype, r);
tmp = gfc_build_const (argtype, integer_zero_node);
- cond = fold (build (GT_EXPR, boolean_type_node, arg, tmp));
+ cond = fold (build2 (GT_EXPR, boolean_type_node, arg, tmp));
- tmp = fold (build (COND_EXPR, argtype, cond, pos, neg));
- tmp = fold (build (PLUS_EXPR, argtype, arg, tmp));
+ tmp = fold (build3 (COND_EXPR, argtype, cond, pos, neg));
+ tmp = fold (build2 (PLUS_EXPR, argtype, arg, tmp));
return fold (build1 (FIX_TRUNC_EXPR, type, tmp));
}
n = gfc_validate_kind (BT_INTEGER, kind);
mpfr_set_z (huge, gfc_integer_kinds[n].huge, GFC_RND_MODE);
tmp = gfc_conv_mpfr_to_tree (huge, kind);
- cond = build (LT_EXPR, boolean_type_node, arg, tmp);
+ cond = build2 (LT_EXPR, boolean_type_node, arg, tmp);
mpfr_neg (huge, huge, GFC_RND_MODE);
tmp = gfc_conv_mpfr_to_tree (huge, kind);
- tmp = build (GT_EXPR, boolean_type_node, arg, tmp);
- cond = build (TRUTH_AND_EXPR, boolean_type_node, cond, tmp);
+ tmp = build2 (GT_EXPR, boolean_type_node, arg, tmp);
+ cond = build2 (TRUTH_AND_EXPR, boolean_type_node, cond, tmp);
itype = gfc_get_int_type (kind);
tmp = build_fix_expr (&se->pre, arg, itype, op);
tmp = convert (type, tmp);
- se->expr = build (COND_EXPR, type, cond, tmp, arg);
+ se->expr = build3 (COND_EXPR, type, cond, tmp, arg);
mpfr_clear (huge);
}
assert (se->ss->expr == expr);
gfc_advance_se_ss_chain (se);
bound = se->loop->loopvar[0];
- bound = fold (build (MINUS_EXPR, gfc_array_index_type, bound,
- se->loop->from[0]));
+ bound = fold (build2 (MINUS_EXPR, gfc_array_index_type, bound,
+ se->loop->from[0]));
}
else
{
gfc_add_block_to_block (&se->pre, &argse.pre);
bound = argse.expr;
/* Convert from one based to zero based. */
- bound = fold (build (MINUS_EXPR, gfc_array_index_type, bound,
- gfc_index_one_node));
+ bound = fold (build2 (MINUS_EXPR, gfc_array_index_type, bound,
+ gfc_index_one_node));
}
/* TODO: don't re-evaluate the descriptor on each iteration. */
if (flag_bounds_check)
{
bound = gfc_evaluate_now (bound, &se->pre);
- cond = fold (build (LT_EXPR, boolean_type_node, bound,
- convert (TREE_TYPE (bound), integer_zero_node)));
+ cond = fold (build2 (LT_EXPR, boolean_type_node,
+ bound, convert (TREE_TYPE (bound),
+ integer_zero_node)));
tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
- tmp = fold (build (GE_EXPR, boolean_type_node, bound, tmp));
- cond = fold(build (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp));
+ tmp = fold (build2 (GE_EXPR, boolean_type_node, bound, tmp));
+ cond = fold(build2 (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp));
gfc_trans_runtime_check (cond, gfc_strconst_fault, &se->pre);
}
}
else
imag = build_real_from_int_cst (TREE_TYPE (type), integer_zero_node);
- se->expr = fold (build (COMPLEX_EXPR, type, real, imag));
+ se->expr = fold (build2 (COMPLEX_EXPR, type, real, imag));
}
/* Remainder function MOD(A, P) = A - INT(A / P) * P.
{
case BT_INTEGER:
/* Integer case is easy, we've got a builtin op. */
- se->expr = build (TRUNC_MOD_EXPR, type, arg, arg2);
+ se->expr = build2 (TRUNC_MOD_EXPR, type, arg, arg2);
break;
case BT_REAL:
arg = gfc_evaluate_now (arg, &se->pre);
arg2 = gfc_evaluate_now (arg2, &se->pre);
- tmp = build (RDIV_EXPR, type, arg, arg2);
+ tmp = build2 (RDIV_EXPR, type, arg, arg2);
/* Test if the value is too large to handle sensibly. */
gfc_set_model_kind (expr->ts.kind);
mpfr_init (huge);
n = gfc_validate_kind (BT_INTEGER, expr->ts.kind);
mpfr_set_z (huge, gfc_integer_kinds[n].huge, GFC_RND_MODE);
test = gfc_conv_mpfr_to_tree (huge, expr->ts.kind);
- test2 = build (LT_EXPR, boolean_type_node, tmp, test);
+ test2 = build2 (LT_EXPR, boolean_type_node, tmp, test);
mpfr_neg (huge, huge, GFC_RND_MODE);
test = gfc_conv_mpfr_to_tree (huge, expr->ts.kind);
- test = build (GT_EXPR, boolean_type_node, tmp, test);
- test2 = build (TRUTH_AND_EXPR, boolean_type_node, test, test2);
+ test = build2 (GT_EXPR, boolean_type_node, tmp, test);
+ test2 = build2 (TRUTH_AND_EXPR, boolean_type_node, test, test2);
itype = gfc_get_int_type (expr->ts.kind);
tmp = build_fix_expr (&se->pre, tmp, itype, FIX_TRUNC_EXPR);
tmp = convert (type, tmp);
- tmp = build (COND_EXPR, type, test2, tmp, arg);
- tmp = build (MULT_EXPR, type, tmp, arg2);
- se->expr = build (MINUS_EXPR, type, arg, tmp);
+ tmp = build3 (COND_EXPR, type, test2, tmp, arg);
+ tmp = build2 (MULT_EXPR, type, tmp, arg2);
+ se->expr = build2 (MINUS_EXPR, type, arg, tmp);
mpfr_clear (huge);
break;
{
zero = gfc_build_const (type, integer_zero_node);
/* Build !(A > 0 .xor. P > 0). */
- test = build (GT_EXPR, boolean_type_node, arg, zero);
- test2 = build (GT_EXPR, boolean_type_node, arg2, zero);
- test = build (TRUTH_XOR_EXPR, boolean_type_node, test, test2);
+ test = build2 (GT_EXPR, boolean_type_node, arg, zero);
+ test2 = build2 (GT_EXPR, boolean_type_node, arg2, zero);
+ test = build2 (TRUTH_XOR_EXPR, boolean_type_node, test, test2);
test = build1 (TRUTH_NOT_EXPR, boolean_type_node, test);
/* Build (A == 0) .or. !(A > 0 .xor. P > 0). */
- test2 = build (EQ_EXPR, boolean_type_node, arg, zero);
- test = build (TRUTH_OR_EXPR, boolean_type_node, test, test2);
+ test2 = build2 (EQ_EXPR, boolean_type_node, arg, zero);
+ test = build2 (TRUTH_OR_EXPR, boolean_type_node, test, test2);
- se->expr = build (COND_EXPR, type, test, se->expr,
- build (PLUS_EXPR, type, se->expr, arg2));
+ se->expr = build3 (COND_EXPR, type, test, se->expr,
+ build2 (PLUS_EXPR, type, se->expr, arg2));
}
}
arg = TREE_VALUE (arg);
type = TREE_TYPE (arg);
- val = build (MINUS_EXPR, type, arg, arg2);
+ val = build2 (MINUS_EXPR, type, arg, arg2);
val = gfc_evaluate_now (val, &se->pre);
zero = gfc_build_const (type, integer_zero_node);
- tmp = build (LE_EXPR, boolean_type_node, val, zero);
- se->expr = build (COND_EXPR, type, tmp, zero, val);
+ tmp = build2 (LE_EXPR, boolean_type_node, val, zero);
+ se->expr = build3 (COND_EXPR, type, tmp, zero, val);
}
type = TREE_TYPE (arg);
zero = gfc_build_const (type, integer_zero_node);
- testa = fold (build (GE_EXPR, boolean_type_node, arg, zero));
- testb = fold (build (GE_EXPR, boolean_type_node, arg2, zero));
- tmp = fold (build (TRUTH_XOR_EXPR, boolean_type_node, testa, testb));
- se->expr = fold (build (COND_EXPR, type, tmp,
- build1 (NEGATE_EXPR, type, arg), arg));
+ testa = fold (build2 (GE_EXPR, boolean_type_node, arg, zero));
+ testb = fold (build2 (GE_EXPR, boolean_type_node, arg2, zero));
+ tmp = fold (build2 (TRUTH_XOR_EXPR, boolean_type_node, testa, testb));
+ se->expr = fold (build3 (COND_EXPR, type, tmp,
+ build1 (NEGATE_EXPR, type, arg), arg));
}
type = gfc_typenode_for_spec (&expr->ts);
arg = convert (type, arg);
arg2 = convert (type, arg2);
- se->expr = build (MULT_EXPR, type, arg, arg2);
+ se->expr = build2 (MULT_EXPR, type, arg, arg2);
}
limit = gfc_evaluate_now(limit, &se->pre);
mvar = gfc_create_var (type, "M");
- elsecase = build_v (MODIFY_EXPR, mvar, limit);
+ elsecase = build2_v (MODIFY_EXPR, mvar, limit);
for (arg = TREE_CHAIN (arg); arg != NULL_TREE; arg = TREE_CHAIN (arg))
{
val = TREE_VALUE (arg);
if (TREE_CODE (val) != VAR_DECL && !TREE_CONSTANT (val))
val = gfc_evaluate_now(val, &se->pre);
- thencase = build_v (MODIFY_EXPR, mvar, convert (type, val));
+ thencase = build2_v (MODIFY_EXPR, mvar, convert (type, val));
- tmp = build (op, boolean_type_node, val, limit);
- tmp = build_v (COND_EXPR, tmp, thencase, elsecase);
+ tmp = build2 (op, boolean_type_node, val, limit);
+ tmp = build3_v (COND_EXPR, tmp, thencase, elsecase);
gfc_add_expr_to_block (&se->pre, tmp);
elsecase = build_empty_stmt ();
limit = mvar;
gfc_conv_expr_val (&arrayse, actual->expr);
gfc_add_block_to_block (&body, &arrayse.pre);
- tmp = build (op, boolean_type_node, arrayse.expr,
- fold_convert (TREE_TYPE (arrayse.expr),
- integer_zero_node));
- tmp = build_v (COND_EXPR, tmp, found, build_empty_stmt ());
+ tmp = build2 (op, boolean_type_node, arrayse.expr,
+ fold_convert (TREE_TYPE (arrayse.expr),
+ integer_zero_node));
+ tmp = build3_v (COND_EXPR, tmp, found, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
gfc_add_block_to_block (&body, &arrayse.post);
/* Generate the loop body. */
gfc_start_scalarized_body (&loop, &body);
- tmp = build (PLUS_EXPR, TREE_TYPE (resvar), resvar,
- convert (TREE_TYPE (resvar), integer_one_node));
- tmp = build_v (MODIFY_EXPR, resvar, tmp);
+ tmp = build2 (PLUS_EXPR, TREE_TYPE (resvar), resvar,
+ convert (TREE_TYPE (resvar), integer_one_node));
+ tmp = build2_v (MODIFY_EXPR, resvar, tmp);
gfc_init_se (&arrayse, NULL);
gfc_copy_loopinfo_to_se (&arrayse, &loop);
arrayse.ss = arrayss;
gfc_conv_expr_val (&arrayse, actual->expr);
- tmp = build_v (COND_EXPR, arrayse.expr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, arrayse.expr, tmp, build_empty_stmt ());
gfc_add_block_to_block (&body, &arrayse.pre);
gfc_add_expr_to_block (&body, tmp);
gfc_conv_expr_val (&arrayse, arrayexpr);
gfc_add_block_to_block (&block, &arrayse.pre);
- tmp = build (op, type, resvar, arrayse.expr);
+ tmp = build2 (op, type, resvar, arrayse.expr);
gfc_add_modify_expr (&block, resvar, tmp);
gfc_add_block_to_block (&block, &arrayse.post);
/* We enclose the above in if (mask) {...} . */
tmp = gfc_finish_block (&block);
- tmp = build_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
}
else
tmp = gfc_finish_block (&block);
size we need to return zero. Otherwise use the first element of the
array, in case all elements are equal to the limit.
ie. pos = (ubound >= lbound) ? lbound, lbound - 1; */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
- loop.from[0], gfc_index_one_node));
- cond = fold (build (GE_EXPR, boolean_type_node,
- loop.to[0], loop.from[0]));
- tmp = fold (build (COND_EXPR, gfc_array_index_type, cond,
- loop.from[0], tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ loop.from[0], gfc_index_one_node));
+ cond = fold (build2 (GE_EXPR, boolean_type_node,
+ loop.to[0], loop.from[0]));
+ tmp = fold (build3 (COND_EXPR, gfc_array_index_type, cond,
+ loop.from[0], tmp));
gfc_add_modify_expr (&loop.pre, pos, tmp);
gfc_mark_ss_chain_used (arrayss, 1);
ifbody = gfc_finish_block (&ifblock);
/* If it is a more extreme value. */
- tmp = build (op, boolean_type_node, arrayse.expr, limit);
- tmp = build_v (COND_EXPR, tmp, ifbody, build_empty_stmt ());
+ tmp = build2 (op, boolean_type_node, arrayse.expr, limit);
+ tmp = build3_v (COND_EXPR, tmp, ifbody, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
if (maskss)
/* We enclose the above in if (mask) {...}. */
tmp = gfc_finish_block (&block);
- tmp = build_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
}
else
tmp = gfc_finish_block (&block);
gfc_cleanup_loop (&loop);
/* Return a value in the range 1..SIZE(array). */
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, loop.from[0],
- gfc_index_one_node));
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, pos, tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, loop.from[0],
+ gfc_index_one_node));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, pos, tmp));
/* And convert to the required type. */
se->expr = convert (type, tmp);
}
gfc_add_block_to_block (&block, &arrayse.pre);
/* Assign the value to the limit... */
- ifbody = build_v (MODIFY_EXPR, limit, arrayse.expr);
+ ifbody = build2_v (MODIFY_EXPR, limit, arrayse.expr);
/* If it is a more extreme value. */
- tmp = build (op, boolean_type_node, arrayse.expr, limit);
- tmp = build_v (COND_EXPR, tmp, ifbody, build_empty_stmt ());
+ tmp = build2 (op, boolean_type_node, arrayse.expr, limit);
+ tmp = build3_v (COND_EXPR, tmp, ifbody, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &arrayse.post);
tmp = gfc_finish_block (&block);
if (maskss)
- {
- /* We enclose the above in if (mask) {...}. */
- tmp = build_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
- }
+ /* We enclose the above in if (mask) {...}. */
+ tmp = build3_v (COND_EXPR, maskse.expr, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
gfc_trans_scalarizing_loops (&loop, &body);
arg = TREE_VALUE (arg);
type = TREE_TYPE (arg);
- tmp = build (LSHIFT_EXPR, type, convert (type, integer_one_node), arg2);
- tmp = build (BIT_AND_EXPR, type, arg, tmp);
- tmp = fold (build (NE_EXPR, boolean_type_node, tmp,
- convert (type, integer_zero_node)));
+ tmp = build2 (LSHIFT_EXPR, type, convert (type, integer_one_node), arg2);
+ tmp = build2 (BIT_AND_EXPR, type, arg, tmp);
+ tmp = fold (build2 (NE_EXPR, boolean_type_node, tmp,
+ convert (type, integer_zero_node)));
type = gfc_typenode_for_spec (&expr->ts);
se->expr = convert (type, tmp);
}
arg = TREE_VALUE (arg);
type = TREE_TYPE (arg);
- se->expr = fold (build (op, type, arg, arg2));
+ se->expr = fold (build2 (op, type, arg, arg2));
}
/* Bitwise not. */
arg = TREE_VALUE (arg);
type = TREE_TYPE (arg);
- tmp = fold (build (LSHIFT_EXPR, type,
+ tmp = fold (build2 (LSHIFT_EXPR, type,
convert (type, integer_one_node), arg2));
if (set)
op = BIT_IOR_EXPR;
op = BIT_AND_EXPR;
tmp = fold (build1 (BIT_NOT_EXPR, type, tmp));
}
- se->expr = fold (build (op, type, arg, tmp));
+ se->expr = fold (build2 (op, type, arg, tmp));
}
/* Extract a sequence of bits.
type = TREE_TYPE (arg);
mask = build_int_cst (NULL_TREE, -1);
- mask = build (LSHIFT_EXPR, type, mask, arg3);
+ mask = build2 (LSHIFT_EXPR, type, mask, arg3);
mask = build1 (BIT_NOT_EXPR, type, mask);
- tmp = build (RSHIFT_EXPR, type, arg, arg2);
+ tmp = build2 (RSHIFT_EXPR, type, arg, arg2);
- se->expr = fold (build (BIT_AND_EXPR, type, tmp, mask));
+ se->expr = fold (build2 (BIT_AND_EXPR, type, tmp, mask));
}
/* ISHFT (I, SHIFT) = (shift >= 0) ? i << shift : i >> -shift. */
type = TREE_TYPE (arg);
/* Left shift if positive. */
- lshift = build (LSHIFT_EXPR, type, arg, arg2);
+ lshift = build2 (LSHIFT_EXPR, type, arg, arg2);
/* Right shift if negative. This will perform an arithmetic shift as
we are dealing with signed integers. Section 13.5.7 allows this. */
tmp = build1 (NEGATE_EXPR, TREE_TYPE (arg2), arg2);
- rshift = build (RSHIFT_EXPR, type, arg, tmp);
+ rshift = build2 (RSHIFT_EXPR, type, arg, tmp);
- tmp = build (GT_EXPR, boolean_type_node, arg2,
- convert (TREE_TYPE (arg2), integer_zero_node));
- rshift = build (COND_EXPR, type, tmp, lshift, rshift);
+ tmp = build2 (GT_EXPR, boolean_type_node, arg2,
+ convert (TREE_TYPE (arg2), integer_zero_node));
+ rshift = build3 (COND_EXPR, type, tmp, lshift, rshift);
/* Do nothing if shift == 0. */
- tmp = build (EQ_EXPR, boolean_type_node, arg2,
- convert (TREE_TYPE (arg2), integer_zero_node));
- se->expr = build (COND_EXPR, type, tmp, arg, rshift);
+ tmp = build2 (EQ_EXPR, boolean_type_node, arg2,
+ convert (TREE_TYPE (arg2), integer_zero_node));
+ se->expr = build3 (COND_EXPR, type, tmp, arg, rshift);
}
/* Circular shift. AKA rotate or barrel shift. */
type = TREE_TYPE (arg);
/* Rotate left if positive. */
- lrot = build (LROTATE_EXPR, type, arg, arg2);
+ lrot = build2 (LROTATE_EXPR, type, arg, arg2);
/* Rotate right if negative. */
tmp = build1 (NEGATE_EXPR, TREE_TYPE (arg2), arg2);
- rrot = build (RROTATE_EXPR, type, arg, tmp);
+ rrot = build2 (RROTATE_EXPR, type, arg, tmp);
- tmp = build (GT_EXPR, boolean_type_node, arg2,
- convert (TREE_TYPE (arg2), integer_zero_node));
- rrot = build (COND_EXPR, type, tmp, lrot, rrot);
+ tmp = build2 (GT_EXPR, boolean_type_node, arg2,
+ convert (TREE_TYPE (arg2), integer_zero_node));
+ rrot = build3 (COND_EXPR, type, tmp, lrot, rrot);
/* Do nothing if shift == 0. */
- tmp = build (EQ_EXPR, boolean_type_node, arg2,
- convert (TREE_TYPE (arg2), integer_zero_node));
- se->expr = build (COND_EXPR, type, tmp, arg, rrot);
+ tmp = build2 (EQ_EXPR, boolean_type_node, arg2,
+ convert (TREE_TYPE (arg2), integer_zero_node));
+ se->expr = build3 (COND_EXPR, type, tmp, arg, rrot);
}
/* The length of a character string. */
mask = TREE_VALUE (arg);
type = TREE_TYPE (tsource);
- se->expr = fold (build (COND_EXPR, type, mask, tsource, fsource));
+ se->expr = fold (build3 (COND_EXPR, type, mask, tsource, fsource));
}
se->expr = gfc_build_function_call (gfor_fndecl_compare_string, args);
type = gfc_typenode_for_spec (&expr->ts);
- se->expr = build (op, type, se->expr,
- convert (TREE_TYPE (se->expr), integer_zero_node));
+ se->expr = build2 (op, type, se->expr,
+ convert (TREE_TYPE (se->expr), integer_zero_node));
}
/* Generate a call to the adjustl/adjustr library function. */
gfc_conv_expr_descriptor (&arg1se, arg1->expr, ss1);
tmp = gfc_conv_descriptor_data (arg1se.expr);
- tmp = build (NE_EXPR, boolean_type_node, tmp,
- fold_convert (TREE_TYPE (tmp), null_pointer_node));
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp,
+ fold_convert (TREE_TYPE (tmp), null_pointer_node));
se->expr = convert (gfc_typenode_for_spec (&expr->ts), tmp);
}
gfc_conv_expr_lhs (&arg1se, arg1->expr);
tmp2 = gfc_conv_descriptor_data (arg1se.expr);
}
- tmp = build (NE_EXPR, boolean_type_node, tmp2,
- fold_convert (TREE_TYPE (tmp2), null_pointer_node));
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp2,
+ fold_convert (TREE_TYPE (tmp2), null_pointer_node));
se->expr = tmp;
}
else
gfc_conv_expr (&arg1se, arg1->expr);
arg2se.want_pointer = 1;
gfc_conv_expr (&arg2se, arg2->expr);
- tmp = build (EQ_EXPR, boolean_type_node, arg1se.expr, arg2se.expr);
+ tmp = build2 (EQ_EXPR, boolean_type_node, arg1se.expr, arg2se.expr);
se->expr = tmp;
}
else
rcs->fdigits = convert (masktype, tmp);
wbits = build_int_cst (NULL_TREE, TYPE_PRECISION (rcs->type) - 1);
wbits = convert (masktype, wbits);
- rcs->edigits = fold (build (MINUS_EXPR, masktype, wbits, tmp));
+ rcs->edigits = fold (build2 (MINUS_EXPR, masktype, wbits, tmp));
/* Form masks for exponent/fraction/sign */
one = gfc_build_const (masktype, integer_one_node);
- rcs->smask = fold (build (LSHIFT_EXPR, masktype, one, wbits));
- rcs->f1 = fold (build (LSHIFT_EXPR, masktype, one, rcs->fdigits));
- rcs->emask = fold (build (MINUS_EXPR, masktype, rcs->smask, rcs->f1));
- rcs->fmask = fold (build (MINUS_EXPR, masktype, rcs->f1, one));
+ rcs->smask = fold (build2 (LSHIFT_EXPR, masktype, one, wbits));
+ rcs->f1 = fold (build2 (LSHIFT_EXPR, masktype, one, rcs->fdigits));
+ rcs->emask = fold (build2 (MINUS_EXPR, masktype, rcs->smask, rcs->f1));
+ rcs->fmask = fold (build2 (MINUS_EXPR, masktype, rcs->f1, one));
/* Form bias. */
- tmp = fold (build (MINUS_EXPR, masktype, rcs->edigits, one));
- tmp = fold (build (LSHIFT_EXPR, masktype, one, tmp));
- rcs->bias = fold (build (MINUS_EXPR, masktype, tmp ,one));
+ tmp = fold (build2 (MINUS_EXPR, masktype, rcs->edigits, one));
+ tmp = fold (build2 (LSHIFT_EXPR, masktype, one, tmp));
+ rcs->bias = fold (build2 (MINUS_EXPR, masktype, tmp ,one));
if (all)
{
/* exponent, and fraction */
- tmp = build (BIT_AND_EXPR, masktype, arg, rcs->emask);
- tmp = build (RSHIFT_EXPR, masktype, tmp, rcs->fdigits);
+ tmp = build2 (BIT_AND_EXPR, masktype, arg, rcs->emask);
+ tmp = build2 (RSHIFT_EXPR, masktype, tmp, rcs->fdigits);
exponent = gfc_create_var (masktype, "exponent");
gfc_add_modify_expr(&se->pre, exponent, tmp);
rcs->expn = exponent;
- tmp = build (BIT_AND_EXPR, masktype, arg, rcs->fmask);
+ tmp = build2 (BIT_AND_EXPR, masktype, arg, rcs->fmask);
fraction = gfc_create_var (masktype, "fraction");
gfc_add_modify_expr(&se->pre, fraction, tmp);
rcs->frac = fraction;
fdigits = rcs.fdigits;
tiny = rcs.f1;
zero = gfc_build_const (masktype, integer_zero_node);
- tmp = build (BIT_AND_EXPR, masktype, rcs.emask, arg);
- tmp = build (RSHIFT_EXPR, masktype, tmp, fdigits);
- tmp = build (MINUS_EXPR, masktype, tmp, fdigits);
- cond = build (LE_EXPR, boolean_type_node, tmp, zero);
- t1 = build (LSHIFT_EXPR, masktype, tmp, fdigits);
- tmp = build (COND_EXPR, masktype, cond, tiny, t1);
+ tmp = build2 (BIT_AND_EXPR, masktype, rcs.emask, arg);
+ tmp = build2 (RSHIFT_EXPR, masktype, tmp, fdigits);
+ tmp = build2 (MINUS_EXPR, masktype, tmp, fdigits);
+ cond = build2 (LE_EXPR, boolean_type_node, tmp, zero);
+ t1 = build2 (LSHIFT_EXPR, masktype, tmp, fdigits);
+ tmp = build3 (COND_EXPR, masktype, cond, tiny, t1);
tmp = build1 (VIEW_CONVERT_EXPR, rcs.type, tmp);
se->expr = tmp;
fraction = rcs.frac;
one = gfc_build_const (masktype, integer_one_node);
zero = gfc_build_const (masktype, integer_zero_node);
- t2 = build (PLUS_EXPR, masktype, rcs.edigits, one);
+ t2 = build2 (PLUS_EXPR, masktype, rcs.edigits, one);
t1 = call_builtin_clz (masktype, fraction);
- tmp = build (PLUS_EXPR, masktype, t1, one);
- tmp = build (LSHIFT_EXPR, masktype, fraction, tmp);
- tmp = build (RSHIFT_EXPR, masktype, tmp, t2);
- cond = build (EQ_EXPR, boolean_type_node, rcs.expn, zero);
- fraction = build (COND_EXPR, masktype, cond, tmp, fraction);
+ tmp = build2 (PLUS_EXPR, masktype, t1, one);
+ tmp = build2 (LSHIFT_EXPR, masktype, fraction, tmp);
+ tmp = build2 (RSHIFT_EXPR, masktype, tmp, t2);
+ cond = build2 (EQ_EXPR, boolean_type_node, rcs.expn, zero);
+ fraction = build3 (COND_EXPR, masktype, cond, tmp, fraction);
- tmp = build (PLUS_EXPR, masktype, rcs.bias, fdigits);
- tmp = build (LSHIFT_EXPR, masktype, tmp, fdigits);
- tmp = build (BIT_IOR_EXPR, masktype, tmp, fraction);
+ tmp = build2 (PLUS_EXPR, masktype, rcs.bias, fdigits);
+ tmp = build2 (LSHIFT_EXPR, masktype, tmp, fdigits);
+ tmp = build2 (BIT_IOR_EXPR, masktype, tmp, fraction);
- cond2 = build (EQ_EXPR, boolean_type_node, rcs.frac, zero);
- cond = build (TRUTH_ANDIF_EXPR, boolean_type_node, cond, cond2);
- tmp = build (COND_EXPR, masktype, cond,
- convert (masktype, integer_zero_node), tmp);
+ cond2 = build2 (EQ_EXPR, boolean_type_node, rcs.frac, zero);
+ cond = build2 (TRUTH_ANDIF_EXPR, boolean_type_node, cond, cond2);
+ tmp = build3 (COND_EXPR, masktype, cond,
+ convert (masktype, integer_zero_node), tmp);
tmp = build1 (VIEW_CONVERT_EXPR, rcs.type, tmp);
se->expr = tmp;
gfc_add_expr_to_block (&se->pre, tmp);
/* Free the temporary afterwards, if necessary. */
- cond = build (GT_EXPR, boolean_type_node, len,
- convert (TREE_TYPE (len), integer_zero_node));
+ cond = build2 (GT_EXPR, boolean_type_node, len,
+ convert (TREE_TYPE (len), integer_zero_node));
arglist = gfc_chainon_list (NULL_TREE, var);
tmp = gfc_build_function_call (gfor_fndecl_internal_free, arglist);
- tmp = build_v (COND_EXPR, cond, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&se->post, tmp);
se->expr = var;
len = TREE_VALUE (args);
tmp = gfc_advance_chain (args, 2);
ncopies = TREE_VALUE (tmp);
- len = fold (build (MULT_EXPR, gfc_int4_type_node, len, ncopies));
+ len = fold (build2 (MULT_EXPR, gfc_int4_type_node, len, ncopies));
type = gfc_get_character_type (expr->ts.kind, expr->ts.cl);
var = gfc_conv_string_tmp (se, build_pointer_type (type), len);
tmp = fold_convert (type, tmp);
if (args_only)
- tmp = build (MINUS_EXPR, type, tmp, convert (type, integer_one_node));
+ tmp = build2 (MINUS_EXPR, type, tmp, convert (type, integer_one_node));
se->expr = tmp;
}
gfc_conv_expr_type (&se, e, TREE_TYPE (var));
gfc_add_block_to_block (block, &se.pre);
- tmp = build (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
gfc_add_modify_expr (block, tmp, se.expr);
}
gfc_conv_expr_type (&se, e, TREE_TYPE (var));
gfc_add_block_to_block (block, &se.pre);
- tmp = build (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
gfc_add_modify_expr (block, tmp, se.expr);
}
gfc_init_se (&se, NULL);
gfc_conv_expr (&se, e);
- io = build (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
- len = build (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
- NULL_TREE);
+ io = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
+ len = build3 (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
+ NULL_TREE);
/* Integer variable assigned a format label. */
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
msg =
gfc_build_string_const (37, "Assigned label is not a format label");
tmp = GFC_DECL_STRING_LEN (se.expr);
- tmp = build (LE_EXPR, boolean_type_node,
- tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
+ tmp = build2 (LE_EXPR, boolean_type_node,
+ tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
gfc_trans_runtime_check (tmp, msg, &se.pre);
gfc_add_modify_expr (&se.pre, io, GFC_DECL_ASSIGN_ADDR (se.expr));
gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
{
tree tmp, type = TREE_TYPE (var);
- tmp = build (COMPONENT_REF, type, ioparm_var, var, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, type, ioparm_var, var, NULL_TREE);
gfc_add_modify_expr (block, tmp, convert (type, integer_one_node));
}
DECL_CONTEXT (tmp) = current_function_decl;
/* And the case itself. */
- tmp = build_v (CASE_LABEL_EXPR, value, NULL_TREE, tmp);
+ tmp = build3_v (CASE_LABEL_EXPR, value, NULL_TREE, tmp);
gfc_add_expr_to_block (body, tmp);
/* Jump to the label. */
tmp = gfc_finish_block (&body);
- rc = build (COMPONENT_REF, TREE_TYPE (ioparm_library_return), ioparm_var,
- ioparm_library_return, NULL_TREE);
+ rc = build3 (COMPONENT_REF, TREE_TYPE (ioparm_library_return), ioparm_var,
+ ioparm_library_return, NULL_TREE);
- tmp = build_v (SWITCH_EXPR, rc, tmp, NULL_TREE);
+ tmp = build3_v (SWITCH_EXPR, rc, tmp, NULL_TREE);
gfc_add_expr_to_block (block, tmp);
}
{
tree field = c->backend_decl;
assert (field && TREE_CODE (field) == FIELD_DECL);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), expr, field, NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field),
+ expr, field, NULL_TREE);
if (c->dimension)
gfc_todo_error ("NAMELIST IO of array in derived type");
field = c->backend_decl;
assert (field && TREE_CODE (field) == FIELD_DECL);
- tmp = build (COMPONENT_REF, TREE_TYPE (field), expr, field,
- NULL_TREE);
+ tmp = build3 (COMPONENT_REF, TREE_TYPE (field), expr, field,
+ NULL_TREE);
if (c->ts.type == BT_CHARACTER)
{
assign_error =
gfc_build_string_const (37, "Assigned label is not a target label");
tmp = GFC_DECL_STRING_LEN (se.expr);
- tmp = build (NE_EXPR, boolean_type_node, tmp, integer_minus_one_node);
+ tmp = build2 (NE_EXPR, boolean_type_node, tmp, integer_minus_one_node);
gfc_trans_runtime_check (tmp, assign_error, &se.pre);
assigned_goto = GFC_DECL_ASSIGN_ADDR (se.expr);
{
tmp = gfc_get_label_decl (code->label);
tmp = gfc_build_addr_expr (pvoid_type_node, tmp);
- tmp = build (EQ_EXPR, boolean_type_node, tmp, assigned_goto);
- tmp = build_v (COND_EXPR, tmp, target, build_empty_stmt ());
+ tmp = build2 (EQ_EXPR, boolean_type_node, tmp, assigned_goto);
+ tmp = build3_v (COND_EXPR, tmp, target, build_empty_stmt ());
gfc_add_expr_to_block (&se.pre, tmp);
code = code->block;
}
gfc_conv_expr (&se, code->expr);
- tmp = build (MODIFY_EXPR, TREE_TYPE (result), result, se.expr);
+ tmp = build2 (MODIFY_EXPR, TREE_TYPE (result), result, se.expr);
gfc_add_expr_to_block (&se.pre, tmp);
tmp = build1_v (GOTO_EXPR, gfc_get_return_label ());
elsestmt = build_empty_stmt ();
/* Build the condition expression and add it to the condition block. */
- stmt = build_v (COND_EXPR, if_se.expr, stmt, elsestmt);
+ stmt = build3_v (COND_EXPR, if_se.expr, stmt, elsestmt);
gfc_add_expr_to_block (&if_se.pre, stmt);
branch1 = build1_v (GOTO_EXPR, gfc_get_label_decl (code->label));
branch2 = build1_v (GOTO_EXPR, gfc_get_label_decl (code->label2));
- tmp = build (LT_EXPR, boolean_type_node, se.expr, zero);
- branch1 = build_v (COND_EXPR, tmp, branch1, branch2);
+ tmp = build2 (LT_EXPR, boolean_type_node, se.expr, zero);
+ branch1 = build3_v (COND_EXPR, tmp, branch1, branch2);
/* if (cond <= 0) take branch1 else take branch2. */
branch2 = build1_v (GOTO_EXPR, gfc_get_label_decl (code->label3));
- tmp = build (LE_EXPR, boolean_type_node, se.expr, zero);
- branch1 = build_v (COND_EXPR, tmp, branch1, branch2);
+ tmp = build2 (LE_EXPR, boolean_type_node, se.expr, zero);
+ branch1 = build3_v (COND_EXPR, tmp, branch1, branch2);
/* Append the COND_EXPR to the evaluation of COND, and return. */
gfc_add_expr_to_block (&se.pre, branch1);
/* Initialise loop count. This code is executed before we enter the
loop body. We generate: count = (to + step - from) / step. */
- tmp = fold (build (MINUS_EXPR, type, step, from));
- tmp = fold (build (PLUS_EXPR, type, to, tmp));
- tmp = fold (build (TRUNC_DIV_EXPR, type, tmp, step));
+ tmp = fold (build2 (MINUS_EXPR, type, step, from));
+ tmp = fold (build2 (PLUS_EXPR, type, to, tmp));
+ tmp = fold (build2 (TRUNC_DIV_EXPR, type, tmp, step));
count = gfc_create_var (type, "count");
gfc_add_modify_expr (&block, count, tmp);
exit_label = gfc_build_label_decl (NULL_TREE);
/* Start with the loop condition. Loop until count <= 0. */
- cond = build (LE_EXPR, boolean_type_node, count, integer_zero_node);
+ cond = build2 (LE_EXPR, boolean_type_node, count, integer_zero_node);
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
- tmp = build_v (COND_EXPR, cond, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
/* Put these labels where they can be found later. We put the
}
/* Increment the loop variable. */
- tmp = build (PLUS_EXPR, type, dovar, step);
+ tmp = build2 (PLUS_EXPR, type, dovar, step);
gfc_add_modify_expr (&body, dovar, tmp);
/* Decrement the loop count. */
- tmp = build (MINUS_EXPR, type, count, gfc_index_one_node);
+ tmp = build2 (MINUS_EXPR, type, count, gfc_index_one_node);
gfc_add_modify_expr (&body, count, tmp);
/* End of loop body. */
tmp = gfc_finish_block (&body);
/* The for loop itself. */
- tmp = build_v (LOOP_EXPR, tmp);
+ tmp = build1_v (LOOP_EXPR, tmp);
gfc_add_expr_to_block (&block, tmp);
/* Add the exit label. */
/* Build "IF (! cond) GOTO exit_label". */
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
- tmp = build_v (COND_EXPR, cond.expr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond.expr, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
/* The main body of the loop. */
gfc_init_block (&block);
/* Build the loop. */
- tmp = build_v (LOOP_EXPR, tmp);
+ tmp = build1_v (LOOP_EXPR, tmp);
gfc_add_expr_to_block (&block, tmp);
/* Add the exit label. */
/* Add this case label.
Add parameter 'label', make it match GCC backend. */
- tmp = build (CASE_LABEL_EXPR, void_type_node, low, high, label);
+ tmp = build3 (CASE_LABEL_EXPR, void_type_node, low, high, label);
gfc_add_expr_to_block (&body, tmp);
}
}
tmp = gfc_finish_block (&body);
- tmp = build_v (SWITCH_EXPR, se.expr, tmp, NULL_TREE);
+ tmp = build3_v (SWITCH_EXPR, se.expr, tmp, NULL_TREE);
gfc_add_expr_to_block (&block, tmp);
tmp = build1_v (LABEL_EXPR, end_label);
if (f != NULL)
false_tree = gfc_trans_code (f->next);
- gfc_add_expr_to_block (&block, build_v (COND_EXPR, se.expr,
- true_tree, false_tree));
+ gfc_add_expr_to_block (&block, build3_v (COND_EXPR, se.expr,
+ true_tree, false_tree));
}
return gfc_finish_block (&block);
{
for (d = c->ext.case_list; d; d = d->next)
{
- tmp = build_v (LABEL_EXPR, labels[d->n]);
+ tmp = build1_v (LABEL_EXPR, labels[d->n]);
gfc_add_expr_to_block (&body, tmp);
}
tmp = gfc_trans_code (c->next);
gfc_add_expr_to_block (&body, tmp);
- tmp = build_v (GOTO_EXPR, end_label);
+ tmp = build1_v (GOTO_EXPR, end_label);
gfc_add_expr_to_block (&body, tmp);
}
tmp = gfc_finish_block (&body);
gfc_add_expr_to_block (&block, tmp);
- tmp = build_v (LABEL_EXPR, end_label);
+ tmp = build1_v (LABEL_EXPR, end_label);
gfc_add_expr_to_block (&block, tmp);
if (n != 0)
gfc_init_block (&block);
/* The exit condition. */
- cond = build (LE_EXPR, boolean_type_node, count, integer_zero_node);
+ cond = build2 (LE_EXPR, boolean_type_node, count, integer_zero_node);
tmp = build1_v (GOTO_EXPR, exit_label);
- tmp = build_v (COND_EXPR, cond, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
/* The main loop body. */
gfc_add_expr_to_block (&block, body);
/* Increment the loop variable. */
- tmp = build (PLUS_EXPR, TREE_TYPE (var), var, step);
+ tmp = build2 (PLUS_EXPR, TREE_TYPE (var), var, step);
gfc_add_modify_expr (&block, var, tmp);
/* Advance to the next mask element. */
maskindex = forall_tmp->maskindex;
if (mask)
{
- tmp = build (PLUS_EXPR, gfc_array_index_type,
- maskindex, gfc_index_one_node);
+ tmp = build2 (PLUS_EXPR, gfc_array_index_type,
+ maskindex, gfc_index_one_node);
gfc_add_modify_expr (&block, maskindex, tmp);
}
}
/* Decrement the loop counter. */
- tmp = build (MINUS_EXPR, TREE_TYPE (var), count, gfc_index_one_node);
+ tmp = build2 (MINUS_EXPR, TREE_TYPE (var), count, gfc_index_one_node);
gfc_add_modify_expr (&block, count, tmp);
body = gfc_finish_block (&block);
gfc_add_modify_expr (&block, var, start);
/* Initialize the loop counter. */
- tmp = fold (build (MINUS_EXPR, TREE_TYPE (var), step, start));
- tmp = fold (build (PLUS_EXPR, TREE_TYPE (var), end, tmp));
- tmp = fold (build (TRUNC_DIV_EXPR, TREE_TYPE (var), tmp, step));
+ tmp = fold (build2 (MINUS_EXPR, TREE_TYPE (var), step, start));
+ tmp = fold (build2 (PLUS_EXPR, TREE_TYPE (var), end, tmp));
+ tmp = fold (build2 (TRUNC_DIV_EXPR, TREE_TYPE (var), tmp, step));
gfc_add_modify_expr (&block, count, tmp);
/* The loop expression. */
- tmp = build_v (LOOP_EXPR, body);
+ tmp = build1_v (LOOP_EXPR, body);
gfc_add_expr_to_block (&block, tmp);
/* The exit label. */
tmp = mask;
tmp = gfc_build_array_ref (tmp, maskindex);
- body = build_v (COND_EXPR, tmp, body, build_empty_stmt ());
+ body = build3_v (COND_EXPR, tmp, body, build_empty_stmt ());
}
}
nvar = forall_tmp->nvar;
if (INTEGER_CST_P (size))
{
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, size,
- gfc_index_one_node));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, size,
+ gfc_index_one_node));
}
else
tmp = NULL_TREE;
gfc_add_block_to_block (&block, &lse.post);
/* Increment the count1. */
- tmp = fold (build (PLUS_EXPR, TREE_TYPE (count1), count1, size));
+ tmp = fold (build2 (PLUS_EXPR, TREE_TYPE (count1), count1, size));
gfc_add_modify_expr (&block, count1, tmp);
tmp = gfc_finish_block (&block);
}
/* Form the expression of the temporary. */
if (lss != gfc_ss_terminator)
{
- index = fold (build (PLUS_EXPR, gfc_array_index_type,
- count1, count2));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count1, count2));
rse.expr = gfc_build_array_ref (tmp1, index);
}
/* Translate expr. */
while (tmp2)
{
tmp1 = gfc_build_array_ref (tmp2, count3);
- wheremaskexpr = build (TRUTH_AND_EXPR, TREE_TYPE (tmp1),
- wheremaskexpr, tmp1);
+ wheremaskexpr = build2 (TRUTH_AND_EXPR, TREE_TYPE (tmp1),
+ wheremaskexpr, tmp1);
tmp2 = TREE_CHAIN (tmp2);
}
- tmp = build_v (COND_EXPR, wheremaskexpr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, wheremaskexpr, tmp, build_empty_stmt ());
}
gfc_add_expr_to_block (&body, tmp);
/* Increment count2. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count2, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count2, gfc_index_one_node));
gfc_add_modify_expr (&body, count2, tmp);
/* Increment count3. */
if (count3)
{
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count3, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count3, gfc_index_one_node));
gfc_add_modify_expr (&body, count3, tmp);
}
gfc_cleanup_loop (&loop1);
/* Increment count1. */
- tmp = fold (build (PLUS_EXPR, TREE_TYPE (count1), count1, size));
+ tmp = fold (build2 (PLUS_EXPR, TREE_TYPE (count1), count1, size));
gfc_add_modify_expr (&block, count1, tmp);
tmp = gfc_finish_block (&block);
}
gfc_conv_expr (&rse, expr2);
/* Form the expression of the temporary. */
- index = fold (build (PLUS_EXPR, gfc_array_index_type, count1, count2));
+ index = fold (build2 (PLUS_EXPR, gfc_array_index_type, count1, count2));
lse.expr = gfc_build_array_ref (tmp1, index);
}
while (tmp2)
{
tmp1 = gfc_build_array_ref (tmp2, count3);
- wheremaskexpr = build (TRUTH_AND_EXPR, TREE_TYPE (tmp1),
- wheremaskexpr, tmp1);
+ wheremaskexpr = build2 (TRUTH_AND_EXPR, TREE_TYPE (tmp1),
+ wheremaskexpr, tmp1);
tmp2 = TREE_CHAIN (tmp2);
}
- tmp = build_v (COND_EXPR, wheremaskexpr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, wheremaskexpr, tmp, build_empty_stmt ());
}
gfc_add_expr_to_block (&body1, tmp);
else
{
/* Increment count2. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count2, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count2, gfc_index_one_node));
gfc_add_modify_expr (&body1, count2, tmp);
/* Increment count3. */
if (count3)
{
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count3, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count3, gfc_index_one_node));
gfc_add_modify_expr (&body1, count3, tmp);
}
as tree nodes in SS may not be valid in different scope. */
}
/* Increment count1. */
- tmp = fold (build (PLUS_EXPR, TREE_TYPE (count1), count1, size));
+ tmp = fold (build2 (PLUS_EXPR, TREE_TYPE (count1), count1, size));
gfc_add_modify_expr (&block, count1, tmp);
tmp = gfc_finish_block (&block);
/* Figure out how many elements we need. */
for (i = 0; i < loop.dimen; i++)
{
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, loop.from[i]));
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- tmp, loop.to[i]));
- size = fold (build (MULT_EXPR, gfc_array_index_type, size, tmp));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, loop.from[i]));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ tmp, loop.to[i]));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, size, tmp));
}
gfc_add_block_to_block (pblock, &loop.pre);
size = gfc_evaluate_now (size, pblock);
gfc_start_block (&body);
if (nested_forall_info)
- tmp = build (PLUS_EXPR, gfc_array_index_type, number,
- inner_size);
+ tmp = build2 (PLUS_EXPR, gfc_array_index_type, number,
+ inner_size);
else
tmp = inner_size;
gfc_add_modify_expr (&body, number, tmp);
size = compute_overall_iter_number (nested_forall_info, inner_size, block);
unit = TYPE_SIZE_UNIT (type);
- bytesize = fold (build (MULT_EXPR, gfc_array_index_type, size, unit));
+ bytesize = fold (build2 (MULT_EXPR, gfc_array_index_type, size, unit));
*ptemp1 = NULL;
temp1 = gfc_do_allocate (bytesize, size, ptemp1, block, type);
gfc_add_block_to_block (&body, &rse.post);
/* Increment count. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count, gfc_index_one_node));
gfc_add_modify_expr (&body, count, tmp);
tmp = gfc_finish_block (&body);
gfc_add_modify_expr (&body, lse.expr, rse.expr);
gfc_add_block_to_block (&body, &lse.post);
/* Increment count. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count, gfc_index_one_node));
gfc_add_modify_expr (&body, count, tmp);
tmp = gfc_finish_block (&body);
gfc_add_block_to_block (&body, &lse.post);
/* Increment count. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count, gfc_index_one_node));
gfc_add_modify_expr (&body, count, tmp);
tmp = gfc_finish_block (&body);
gfc_add_block_to_block (&body, &lse.post);
/* Increment count. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count, gfc_index_one_node));
gfc_add_modify_expr (&body, count, tmp);
tmp = gfc_finish_block (&body);
lenvar = NULL_TREE;
/* size = (end + step - start) / step. */
- tmp = fold (build (MINUS_EXPR, TREE_TYPE (start[n]), step[n], start[n]));
- tmp = fold (build (PLUS_EXPR, TREE_TYPE (end[n]), end[n], tmp));
+ tmp = fold (build2 (MINUS_EXPR, TREE_TYPE (start[n]),
+ step[n], start[n]));
+ tmp = fold (build2 (PLUS_EXPR, TREE_TYPE (end[n]), end[n], tmp));
- tmp = fold (build (FLOOR_DIV_EXPR, TREE_TYPE (tmp), tmp, step[n]));
+ tmp = fold (build2 (FLOOR_DIV_EXPR, TREE_TYPE (tmp), tmp, step[n]));
tmp = convert (gfc_array_index_type, tmp);
- size = fold (build (MULT_EXPR, gfc_array_index_type, size, tmp));
+ size = fold (build2 (MULT_EXPR, gfc_array_index_type, size, tmp));
}
/* Record the nvar and size of current forall level. */
if (code->expr)
{
/* Allocate the mask temporary. */
- bytesize = fold (build (MULT_EXPR, gfc_array_index_type, size,
- TYPE_SIZE_UNIT (boolean_type_node)));
+ bytesize = fold (build2 (MULT_EXPR, gfc_array_index_type, size,
+ TYPE_SIZE_UNIT (boolean_type_node)));
mask = gfc_do_allocate (bytesize, size, &pmask, &block, boolean_type_node);
gfc_add_modify_expr (&body, tmp, se.expr);
/* Advance to the next mask element. */
- tmp = build (PLUS_EXPR, gfc_array_index_type,
+ tmp = build2 (PLUS_EXPR, gfc_array_index_type,
maskindex, gfc_index_one_node);
gfc_add_modify_expr (&body, maskindex, tmp);
else
{
/* Increment count. */
- tmp1 = fold (build (PLUS_EXPR, gfc_array_index_type, count,
+ tmp1 = fold (build2 (PLUS_EXPR, gfc_array_index_type, count,
gfc_index_one_node));
gfc_add_modify_expr (&body1, count, tmp1);
while (tmp)
{
tmp1 = gfc_build_array_ref (tmp, index);
- maskexpr = build (TRUTH_AND_EXPR, TREE_TYPE (tmp1), maskexpr, tmp1);
+ maskexpr = build2 (TRUTH_AND_EXPR, TREE_TYPE (tmp1), maskexpr, tmp1);
tmp = TREE_CHAIN (tmp);
}
/* Use the scalar assignment as is. */
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts.type);
- tmp = build_v (COND_EXPR, maskexpr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, maskexpr, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
if (lss == gfc_ss_terminator)
{
/* Increment count1. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count1, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count1, gfc_index_one_node));
gfc_add_modify_expr (&body, count1, tmp);
/* Use the scalar assignment as is. */
{
/* Increment count1 before finish the main body of a scalarized
expression. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count1, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count1, gfc_index_one_node));
gfc_add_modify_expr (&body, count1, tmp);
gfc_trans_scalarized_loop_boundary (&loop, &body);
while (tmp)
{
tmp1 = gfc_build_array_ref (tmp, index);
- maskexpr = build (TRUTH_AND_EXPR, TREE_TYPE (tmp1), maskexpr,
- tmp1);
+ maskexpr = build2 (TRUTH_AND_EXPR, TREE_TYPE (tmp1),
+ maskexpr, tmp1);
tmp = TREE_CHAIN (tmp);
}
/* Use the scalar assignment as is. */
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts.type);
- tmp = build_v (COND_EXPR, maskexpr, tmp, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, maskexpr, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp);
/* Increment count2. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count2, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count2, gfc_index_one_node));
gfc_add_modify_expr (&body, count2, tmp);
}
else
{
/* Increment count1. */
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type,
- count1, gfc_index_one_node));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type,
+ count1, gfc_index_one_node));
gfc_add_modify_expr (&body, count1, tmp);
}
{
tmp = build1_v (GOTO_EXPR, error_label);
parm =
- build (NE_EXPR, boolean_type_node, stat, integer_zero_node);
- tmp = build_v (COND_EXPR, parm, tmp, build_empty_stmt ());
+ build2 (NE_EXPR, boolean_type_node, stat, integer_zero_node);
+ tmp = build3_v (COND_EXPR, parm, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&se.pre, tmp);
}
}
if (size && !INTEGER_CST_P (size))
{
tmp = build_int_cst (gfc_array_index_type, GFC_DTYPE_SIZE_SHIFT);
- tmp = fold (build (LSHIFT_EXPR, gfc_array_index_type, size, tmp));
- dtype = fold (build (PLUS_EXPR, gfc_array_index_type, tmp, dtype));
+ tmp = fold (build2 (LSHIFT_EXPR, gfc_array_index_type, size, tmp));
+ dtype = fold (build2 (PLUS_EXPR, gfc_array_index_type, tmp, dtype));
}
/* If we don't know the size we leave it as zero. This should never happen
for anything that is actually used. */
if (upper != NULL_TREE && lower != NULL_TREE && stride != NULL_TREE)
{
- tmp = fold (build (MINUS_EXPR, gfc_array_index_type, upper, lower));
- tmp = fold (build (PLUS_EXPR, gfc_array_index_type, tmp,
- gfc_index_one_node));
+ tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, upper, lower));
+ tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type, tmp,
+ gfc_index_one_node));
stride =
- fold (build (MULT_EXPR, gfc_array_index_type, tmp, stride));
+ fold (build2 (MULT_EXPR, gfc_array_index_type, tmp, stride));
/* Check the folding worked. */
assert (INTEGER_CST_P (stride));
}
abort ();
#endif
- tmp = fold (build_v (MODIFY_EXPR, lhs, rhs));
+ tmp = fold (build2_v (MODIFY_EXPR, lhs, rhs));
gfc_add_expr_to_block (pblock, tmp);
}
if (decl)
{
block = poplevel (1, 0, 0);
- expr = build_v (BIND_EXPR, decl, expr, block);
+ expr = build3_v (BIND_EXPR, decl, expr, block);
}
else
poplevel (0, 0, 0);
if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
- return build (ARRAY_REF, type, base, offset, NULL_TREE, NULL_TREE);
+ return build4 (ARRAY_REF, type, base, offset, NULL_TREE, NULL_TREE);
}
tree call;
fn = gfc_build_addr_expr (NULL, fndecl);
- call = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fndecl)), fn, arglist, NULL);
+ call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fndecl)),
+ fn, arglist, NULL);
TREE_SIDE_EFFECTS (call) = 1;
return call;
tmp = gfc_chainon_list (tmp, integer_zero_node);
cond = gfc_build_function_call (built_in_decls[BUILT_IN_EXPECT], tmp);
- tmp = build_v (COND_EXPR, cond, body, build_empty_stmt ());
+ tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt ());
gfc_add_expr_to_block (pblock, tmp);
}
}
/* Build an expression with void type. */
#define build1_v(code, arg) build(code, void_type_node, arg)
-#define build_v(code, args...) build(code, void_type_node, args)
+#define build2_v(code, arg1, arg2) build2(code, void_type_node, \
+ arg1, arg2)
+#define build3_v(code, arg1, arg2, arg3) build3(code, void_type_node, \
+ arg1, arg2, arg3)
/* flag for alternative return labels. */
extern int has_alternate_specifier; /* for caller */