Commit 923ab88c by Tobias Schlüter Committed by Tobias Schlüter

trans.h (build2_v, build3_v): New macros.

* 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
parent 905af9e9
2004-08-25 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> 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 * trans-const.c (gfc_conv_mpz_to_tree): Change call to
build_int_cst to build_int_cst_wide in accordance to Nathan's build_int_cst to build_int_cst_wide in accordance to Nathan's
previous patch. previous patch.
......
...@@ -237,7 +237,7 @@ gfc_truthvalue_conversion (tree expr) ...@@ -237,7 +237,7 @@ gfc_truthvalue_conversion (tree expr)
if (TREE_CODE (expr) == INTEGER_CST) if (TREE_CODE (expr) == INTEGER_CST)
return integer_zerop (expr) ? boolean_false_node : boolean_true_node; return integer_zerop (expr) ? boolean_false_node : boolean_true_node;
else else
return build (NE_EXPR, boolean_type_node, expr, integer_zero_node); return build2 (NE_EXPR, boolean_type_node, expr, integer_zero_node);
default: default:
internal_error ("Unexpected type in truthvalue_conversion"); internal_error ("Unexpected type in truthvalue_conversion");
......
...@@ -422,8 +422,8 @@ create_common (gfc_common_head *com) ...@@ -422,8 +422,8 @@ create_common (gfc_common_head *com)
/* Build component reference for each variable. */ /* Build component reference for each variable. */
for (s = current_common; s; s = next_s) for (s = current_common; s; s = next_s)
{ {
s->sym->backend_decl = build (COMPONENT_REF, TREE_TYPE (s->field), s->sym->backend_decl = build3 (COMPONENT_REF, TREE_TYPE (s->field),
decl, s->field, NULL_TREE); decl, s->field, NULL_TREE);
next_s = s->next; next_s = s->next;
gfc_free (s); gfc_free (s);
......
...@@ -1856,7 +1856,7 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody) ...@@ -1856,7 +1856,7 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody)
/* Emit a DECL_EXPR for this variable, which will cause the /* Emit a DECL_EXPR for this variable, which will cause the
gimplifier to allocate storage, and all that good stuff. */ 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, tmp);
gfc_add_expr_to_block (&body, fnbody); gfc_add_expr_to_block (&body, fnbody);
...@@ -2114,7 +2114,7 @@ gfc_trans_entry_master_switch (gfc_entry_list * el) ...@@ -2114,7 +2114,7 @@ gfc_trans_entry_master_switch (gfc_entry_list * el)
label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
DECL_CONTEXT (label) = current_function_decl; DECL_CONTEXT (label) = current_function_decl;
val = build_int_cst (gfc_array_index_type, el->id); 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); gfc_add_expr_to_block (&block, tmp);
/* And jump to the actual entry point. */ /* And jump to the actual entry point. */
...@@ -2130,7 +2130,7 @@ gfc_trans_entry_master_switch (gfc_entry_list * el) ...@@ -2130,7 +2130,7 @@ gfc_trans_entry_master_switch (gfc_entry_list * el)
tmp = gfc_finish_block (&block); tmp = gfc_finish_block (&block);
/* The first argument selects the entry point. */ /* The first argument selects the entry point. */
val = DECL_ARGUMENTS (current_function_decl); 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; return tmp;
} }
...@@ -2233,9 +2233,9 @@ gfc_generate_function_code (gfc_namespace * ns) ...@@ -2233,9 +2233,9 @@ gfc_generate_function_code (gfc_namespace * ns)
else else
{ {
/* Set the return value to the dummy result variable. */ /* Set the return value to the dummy result variable. */
tmp = build (MODIFY_EXPR, TREE_TYPE (result), tmp = build2 (MODIFY_EXPR, TREE_TYPE (result),
DECL_RESULT (fndecl), result); DECL_RESULT (fndecl), result);
tmp = build_v (RETURN_EXPR, tmp); tmp = build1_v (RETURN_EXPR, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
} }
} }
......
...@@ -136,8 +136,8 @@ gfc_conv_expr_present (gfc_symbol * sym) ...@@ -136,8 +136,8 @@ gfc_conv_expr_present (gfc_symbol * sym)
|| GFC_ARRAY_TYPE_P (TREE_TYPE (decl))); || GFC_ARRAY_TYPE_P (TREE_TYPE (decl)));
decl = GFC_DECL_SAVED_DESCRIPTOR (decl); decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
} }
return build (NE_EXPR, boolean_type_node, decl, return build2 (NE_EXPR, boolean_type_node, decl,
fold_convert (TREE_TYPE (decl), null_pointer_node)); fold_convert (TREE_TYPE (decl), null_pointer_node));
} }
...@@ -199,10 +199,10 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind) ...@@ -199,10 +199,10 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind)
gfc_add_block_to_block (&se->pre, &end.pre); gfc_add_block_to_block (&se->pre, &end.pre);
} }
tmp = tmp =
build (MINUS_EXPR, gfc_strlen_type_node, build2 (MINUS_EXPR, gfc_strlen_type_node,
fold_convert (gfc_strlen_type_node, integer_one_node), fold_convert (gfc_strlen_type_node, integer_one_node),
start.expr); start.expr);
tmp = build (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp); tmp = build2 (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp);
se->string_length = fold (tmp); se->string_length = fold (tmp);
} }
...@@ -224,7 +224,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) ...@@ -224,7 +224,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
field = c->backend_decl; field = c->backend_decl;
assert (TREE_CODE (field) == FIELD_DECL); assert (TREE_CODE (field) == FIELD_DECL);
decl = se->expr; 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; se->expr = tmp;
...@@ -379,8 +379,8 @@ gfc_conv_unary_op (enum tree_code code, gfc_se * se, gfc_expr * expr) ...@@ -379,8 +379,8 @@ gfc_conv_unary_op (enum tree_code code, gfc_se * se, gfc_expr * expr)
We must convert it to a compare to 0 (e.g. EQ_EXPR (op1, 0)). 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. */ All other unary operators have an equivalent GIMPLE unary operator. */
if (code == TRUTH_NOT_EXPR) if (code == TRUTH_NOT_EXPR)
se->expr = build (EQ_EXPR, type, operand.expr, se->expr = build2 (EQ_EXPR, type, operand.expr,
convert (type, integer_zero_node)); convert (type, integer_zero_node));
else else
se->expr = build1 (code, type, operand.expr); se->expr = build1 (code, type, operand.expr);
...@@ -469,7 +469,7 @@ gfc_conv_powi (gfc_se * se, int n, tree * tmpvar) ...@@ -469,7 +469,7 @@ gfc_conv_powi (gfc_se * se, int n, tree * tmpvar)
op1 = op0; 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); tmp = gfc_evaluate_now (tmp, &se->pre);
if (n < POWI_TABLE_SIZE) if (n < POWI_TABLE_SIZE)
...@@ -508,29 +508,29 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs) ...@@ -508,29 +508,29 @@ 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 rhs < 0 and lhs is an integer, the result is -1, 0 or 1. */
if ((sgn == -1) && (TREE_CODE (type) == INTEGER_TYPE)) if ((sgn == -1) && (TREE_CODE (type) == INTEGER_TYPE))
{ {
tmp = build (EQ_EXPR, boolean_type_node, lhs, tmp = build2 (EQ_EXPR, boolean_type_node, lhs,
fold_convert (TREE_TYPE (lhs), integer_minus_one_node)); fold_convert (TREE_TYPE (lhs), integer_minus_one_node));
cond = build (EQ_EXPR, boolean_type_node, lhs, cond = build2 (EQ_EXPR, boolean_type_node, lhs,
convert (TREE_TYPE (lhs), integer_one_node)); convert (TREE_TYPE (lhs), integer_one_node));
/* If rhs is even, /* If rhs is even,
result = (lhs == 1 || lhs == -1) ? 1 : 0. */ result = (lhs == 1 || lhs == -1) ? 1 : 0. */
if ((n & 1) == 0) if ((n & 1) == 0)
{ {
tmp = build (TRUTH_OR_EXPR, boolean_type_node, tmp, cond); tmp = build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
se->expr = build (COND_EXPR, type, tmp, se->expr = build3 (COND_EXPR, type, tmp,
convert (type, integer_one_node), convert (type, integer_one_node),
convert (type, integer_zero_node)); convert (type, integer_zero_node));
return 1; return 1;
} }
/* If rhs is odd, /* If rhs is odd,
result = (lhs == 1) ? 1 : (lhs == -1) ? -1 : 0. */ result = (lhs == 1) ? 1 : (lhs == -1) ? -1 : 0. */
tmp = build (COND_EXPR, type, tmp, tmp = build3 (COND_EXPR, type, tmp,
convert (type, integer_minus_one_node), convert (type, integer_minus_one_node),
convert (type, integer_zero_node)); convert (type, integer_zero_node));
se->expr = build (COND_EXPR, type, cond, se->expr = build3 (COND_EXPR, type, cond,
convert (type, integer_one_node), convert (type, integer_one_node),
tmp); tmp);
return 1; return 1;
} }
...@@ -539,7 +539,7 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs) ...@@ -539,7 +539,7 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs)
if (sgn == -1) if (sgn == -1)
{ {
tmp = gfc_build_const (type, integer_one_node); 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); se->expr = gfc_conv_powi (se, n, vartmp);
...@@ -691,9 +691,9 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) ...@@ -691,9 +691,9 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len)
if (gfc_can_put_var_on_stack (len)) if (gfc_can_put_var_on_stack (len))
{ {
/* Create a temporary variable to hold the result. */ /* Create a temporary variable to hold the result. */
tmp = fold (build (MINUS_EXPR, gfc_strlen_type_node, len, tmp = fold (build2 (MINUS_EXPR, gfc_strlen_type_node, len,
convert (gfc_strlen_type_node, convert (gfc_strlen_type_node,
integer_one_node))); integer_one_node)));
tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp); tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp);
tmp = build_array_type (gfc_character1_type_node, tmp); tmp = build_array_type (gfc_character1_type_node, tmp);
var = gfc_create_var (tmp, "str"); var = gfc_create_var (tmp, "str");
...@@ -750,8 +750,8 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr) ...@@ -750,8 +750,8 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
len = TYPE_MAX_VALUE (TYPE_DOMAIN (type)); len = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
if (len == NULL_TREE) if (len == NULL_TREE)
{ {
len = fold (build (PLUS_EXPR, TREE_TYPE (lse.string_length), len = fold (build2 (PLUS_EXPR, TREE_TYPE (lse.string_length),
lse.string_length, rse.string_length)); lse.string_length, rse.string_length));
} }
type = build_pointer_type (type); type = build_pointer_type (type);
...@@ -944,11 +944,11 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr) ...@@ -944,11 +944,11 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr)
if (lop) if (lop)
{ {
/* The result of logical ops is always boolean_type_node. */ /* 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); se->expr = convert (type, tmp);
} }
else 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. */ /* Add the post blocks. */
gfc_add_block_to_block (&se->post, &rse.post); gfc_add_block_to_block (&se->post, &rse.post);
...@@ -1167,8 +1167,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, ...@@ -1167,8 +1167,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node; TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node;
fntype = TREE_TYPE (TREE_TYPE (se->expr)); fntype = TREE_TYPE (TREE_TYPE (se->expr));
se->expr = build (CALL_EXPR, TREE_TYPE (fntype), se->expr, se->expr = build3 (CALL_EXPR, TREE_TYPE (fntype), se->expr,
arglist, NULL_TREE); arglist, NULL_TREE);
/* A pure function may still have side-effects - it may modify its /* A pure function may still have side-effects - it may modify its
parameters. */ parameters. */
...@@ -1193,7 +1193,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, ...@@ -1193,7 +1193,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
/* Check the data pointer hasn't been modified. This would /* Check the data pointer hasn't been modified. This would
happen in a function returning a pointer. */ happen in a function returning a pointer. */
tmp = gfc_conv_descriptor_data (info->descriptor); 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); gfc_trans_runtime_check (tmp, gfc_strconst_fault, &se->pre);
} }
se->expr = info->descriptor; se->expr = info->descriptor;
...@@ -1617,7 +1617,7 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr) ...@@ -1617,7 +1617,7 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr)
continue; continue;
field = cm->backend_decl; 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); tmp = gfc_trans_subcomponent_assign (tmp, cm, c->expr);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
} }
......
...@@ -360,7 +360,7 @@ set_parameter_value (stmtblock_t * block, tree var, gfc_expr * e) ...@@ -360,7 +360,7 @@ set_parameter_value (stmtblock_t * block, tree var, gfc_expr * e)
gfc_conv_expr_type (&se, e, TREE_TYPE (var)); gfc_conv_expr_type (&se, e, TREE_TYPE (var));
gfc_add_block_to_block (block, &se.pre); 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_add_modify_expr (block, tmp, se.expr);
} }
...@@ -380,7 +380,7 @@ set_parameter_ref (stmtblock_t * block, tree var, gfc_expr * e) ...@@ -380,7 +380,7 @@ set_parameter_ref (stmtblock_t * block, tree var, gfc_expr * e)
gfc_conv_expr_type (&se, e, TREE_TYPE (var)); gfc_conv_expr_type (&se, e, TREE_TYPE (var));
gfc_add_block_to_block (block, &se.pre); 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_add_modify_expr (block, tmp, se.expr);
} }
...@@ -401,9 +401,9 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, ...@@ -401,9 +401,9 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
gfc_init_se (&se, NULL); gfc_init_se (&se, NULL);
gfc_conv_expr (&se, e); gfc_conv_expr (&se, e);
io = build (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE); io = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
len = build (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len, len = build3 (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
NULL_TREE); NULL_TREE);
/* Integer variable assigned a format label. */ /* Integer variable assigned a format label. */
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1) if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
...@@ -411,8 +411,8 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, ...@@ -411,8 +411,8 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
msg = msg =
gfc_build_string_const (37, "Assigned label is not a format label"); gfc_build_string_const (37, "Assigned label is not a format label");
tmp = GFC_DECL_STRING_LEN (se.expr); tmp = GFC_DECL_STRING_LEN (se.expr);
tmp = build (LE_EXPR, boolean_type_node, tmp = build2 (LE_EXPR, boolean_type_node,
tmp, convert (TREE_TYPE (tmp), integer_minus_one_node)); tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
gfc_trans_runtime_check (tmp, msg, &se.pre); 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, io, GFC_DECL_ASSIGN_ADDR (se.expr));
gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr)); gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
...@@ -436,7 +436,7 @@ set_flag (stmtblock_t *block, tree var) ...@@ -436,7 +436,7 @@ set_flag (stmtblock_t *block, tree var)
{ {
tree tmp, type = TREE_TYPE (var); 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)); gfc_add_modify_expr (block, tmp, convert (type, integer_one_node));
} }
...@@ -458,7 +458,7 @@ add_case (int label_value, gfc_st_label * label, stmtblock_t * body) ...@@ -458,7 +458,7 @@ add_case (int label_value, gfc_st_label * label, stmtblock_t * body)
DECL_CONTEXT (tmp) = current_function_decl; DECL_CONTEXT (tmp) = current_function_decl;
/* And the case itself. */ /* 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); gfc_add_expr_to_block (body, tmp);
/* Jump to the label. */ /* Jump to the label. */
...@@ -498,10 +498,10 @@ io_result (stmtblock_t * block, gfc_st_label * err_label, ...@@ -498,10 +498,10 @@ io_result (stmtblock_t * block, gfc_st_label * err_label,
tmp = gfc_finish_block (&body); tmp = gfc_finish_block (&body);
rc = build (COMPONENT_REF, TREE_TYPE (ioparm_library_return), ioparm_var, rc = build3 (COMPONENT_REF, TREE_TYPE (ioparm_library_return), ioparm_var,
ioparm_library_return, NULL_TREE); 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); gfc_add_expr_to_block (block, tmp);
} }
...@@ -873,7 +873,8 @@ transfer_namelist_element (stmtblock_t * block, gfc_typespec * ts, tree addr_exp ...@@ -873,7 +873,8 @@ transfer_namelist_element (stmtblock_t * block, gfc_typespec * ts, tree addr_exp
{ {
tree field = c->backend_decl; tree field = c->backend_decl;
assert (field && TREE_CODE (field) == FIELD_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) if (c->dimension)
gfc_todo_error ("NAMELIST IO of array in derived type"); gfc_todo_error ("NAMELIST IO of array in derived type");
...@@ -1185,8 +1186,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) ...@@ -1185,8 +1186,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
field = c->backend_decl; field = c->backend_decl;
assert (field && TREE_CODE (field) == FIELD_DECL); assert (field && TREE_CODE (field) == FIELD_DECL);
tmp = build (COMPONENT_REF, TREE_TYPE (field), expr, field, tmp = build3 (COMPONENT_REF, TREE_TYPE (field), expr, field,
NULL_TREE); NULL_TREE);
if (c->ts.type == BT_CHARACTER) if (c->ts.type == BT_CHARACTER)
{ {
......
...@@ -603,8 +603,8 @@ gfc_get_dtype (tree type, int rank) ...@@ -603,8 +603,8 @@ gfc_get_dtype (tree type, int rank)
if (size && !INTEGER_CST_P (size)) if (size && !INTEGER_CST_P (size))
{ {
tmp = build_int_cst (gfc_array_index_type, GFC_DTYPE_SIZE_SHIFT); tmp = build_int_cst (gfc_array_index_type, GFC_DTYPE_SIZE_SHIFT);
tmp = fold (build (LSHIFT_EXPR, gfc_array_index_type, size, tmp)); tmp = fold (build2 (LSHIFT_EXPR, gfc_array_index_type, size, tmp));
dtype = fold (build (PLUS_EXPR, gfc_array_index_type, tmp, dtype)); 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 /* If we don't know the size we leave it as zero. This should never happen
for anything that is actually used. */ for anything that is actually used. */
...@@ -836,11 +836,11 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound, ...@@ -836,11 +836,11 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
if (upper != NULL_TREE && lower != NULL_TREE && stride != NULL_TREE) if (upper != NULL_TREE && lower != NULL_TREE && stride != NULL_TREE)
{ {
tmp = fold (build (MINUS_EXPR, gfc_array_index_type, upper, lower)); tmp = fold (build2 (MINUS_EXPR, gfc_array_index_type, upper, lower));
tmp = fold (build (PLUS_EXPR, gfc_array_index_type, tmp, tmp = fold (build2 (PLUS_EXPR, gfc_array_index_type, tmp,
gfc_index_one_node)); gfc_index_one_node));
stride = 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. */ /* Check the folding worked. */
assert (INTEGER_CST_P (stride)); assert (INTEGER_CST_P (stride));
} }
......
...@@ -156,7 +156,7 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs) ...@@ -156,7 +156,7 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs)
abort (); abort ();
#endif #endif
tmp = fold (build_v (MODIFY_EXPR, lhs, rhs)); tmp = fold (build2_v (MODIFY_EXPR, lhs, rhs));
gfc_add_expr_to_block (pblock, tmp); gfc_add_expr_to_block (pblock, tmp);
} }
...@@ -238,7 +238,7 @@ gfc_finish_block (stmtblock_t * stmtblock) ...@@ -238,7 +238,7 @@ gfc_finish_block (stmtblock_t * stmtblock)
if (decl) if (decl)
{ {
block = poplevel (1, 0, 0); block = poplevel (1, 0, 0);
expr = build_v (BIND_EXPR, decl, expr, block); expr = build3_v (BIND_EXPR, decl, expr, block);
} }
else else
poplevel (0, 0, 0); poplevel (0, 0, 0);
...@@ -316,7 +316,7 @@ gfc_build_array_ref (tree base, tree offset) ...@@ -316,7 +316,7 @@ gfc_build_array_ref (tree base, tree offset)
if (DECL_P (base)) if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1; 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);
} }
...@@ -330,7 +330,8 @@ gfc_build_function_call (tree fndecl, tree arglist) ...@@ -330,7 +330,8 @@ gfc_build_function_call (tree fndecl, tree arglist)
tree call; tree call;
fn = gfc_build_addr_expr (NULL, fndecl); 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; TREE_SIDE_EFFECTS (call) = 1;
return call; return call;
...@@ -384,7 +385,7 @@ gfc_trans_runtime_check (tree cond, tree msg, stmtblock_t * pblock) ...@@ -384,7 +385,7 @@ gfc_trans_runtime_check (tree cond, tree msg, stmtblock_t * pblock)
tmp = gfc_chainon_list (tmp, integer_zero_node); tmp = gfc_chainon_list (tmp, integer_zero_node);
cond = gfc_build_function_call (built_in_decls[BUILT_IN_EXPECT], tmp); 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); gfc_add_expr_to_block (pblock, tmp);
} }
} }
......
...@@ -557,7 +557,10 @@ struct lang_decl GTY(()) ...@@ -557,7 +557,10 @@ struct lang_decl GTY(())
/* Build an expression with void type. */ /* Build an expression with void type. */
#define build1_v(code, arg) build(code, void_type_node, arg) #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. */ /* flag for alternative return labels. */
extern int has_alternate_specifier; /* for caller */ extern int has_alternate_specifier; /* for caller */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment