From 3244e67d15cd8cf65da89849a2bea5161a7ed102 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Sun, 25 Jul 2004 19:15:50 +0000 Subject: [PATCH] convert.c (convert_to_real, [...]): Replace calls to build with calls to buildN. * convert.c (convert_to_real, convert_to_integer, convert_to_complex): Replace calls to build with calls to buildN. * coverage.c (tree_coverage_counter_ref): Likewise. * dojump.c (do_jump): Likewise. * dwarf2out.c (loc_descriptor_from_tree): Likewise. * emit-rtl.c (component_ref_for_mem_expr, set_mem_attributes_minus_bitpos): Likewise. * explow.c (update_nonlocal_goto_save_area): Likewise. * expmed.c (expand_shift, make_tree, const_mult_add_overflow_p, expand_mult_add): Likewise. * expr.c (emit_block_move_via_libcall, clear_storage_via_libcall, store_constructor, get_inner_reference, expand_expr_real_1, try_casesi, try_tablejump): Likewise. * function.c (expand_function_start): Likewise. * stmt.c (emit_case_bit_tests, expand_end_case_type, node_has_low_bound, node_has_high_bound, emit_case_nodes): Likewise. * stor-layout.c (place_union_field, layout_type): Likewise. * tree.c (substitute_in_expr, tree_fold_gcd): Likewise. * varasm.c (copy_constant): Likewise. From-SVN: r85160 --- gcc/ChangeLog | 22 +++++++++++++++ gcc/convert.c | 49 ++++++++++++++++----------------- gcc/coverage.c | 10 +++---- gcc/dojump.c | 38 +++++++++++++------------ gcc/dwarf2out.c | 6 ++-- gcc/emit-rtl.c | 8 +++--- gcc/explow.c | 4 +-- gcc/expmed.c | 70 +++++++++++++++++++++++------------------------ gcc/expr.c | 60 ++++++++++++++++++++-------------------- gcc/function.c | 5 ++-- gcc/stmt.c | 36 ++++++++++++------------ gcc/stor-layout.c | 12 ++++---- gcc/tree.c | 17 ++++++------ gcc/varasm.c | 6 ++-- 14 files changed, 184 insertions(+), 159 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d38c8268c71..5bf60dede09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2004-07-25 Roger Sayle + + * convert.c (convert_to_real, convert_to_integer, + convert_to_complex): Replace calls to build with calls to buildN. + * coverage.c (tree_coverage_counter_ref): Likewise. + * dojump.c (do_jump): Likewise. + * dwarf2out.c (loc_descriptor_from_tree): Likewise. + * emit-rtl.c (component_ref_for_mem_expr, + set_mem_attributes_minus_bitpos): Likewise. + * explow.c (update_nonlocal_goto_save_area): Likewise. + * expmed.c (expand_shift, make_tree, const_mult_add_overflow_p, + expand_mult_add): Likewise. + * expr.c (emit_block_move_via_libcall, clear_storage_via_libcall, + store_constructor, get_inner_reference, expand_expr_real_1, + try_casesi, try_tablejump): Likewise. + * function.c (expand_function_start): Likewise. + * stmt.c (emit_case_bit_tests, expand_end_case_type, + node_has_low_bound, node_has_high_bound, emit_case_nodes): Likewise. + * stor-layout.c (place_union_field, layout_type): Likewise. + * tree.c (substitute_in_expr, tree_fold_gcd): Likewise. + * varasm.c (copy_constant): Likewise. + 2004-07-25 Bernardo Innocenti * c-common.c: Rename all identifiers named `new'. diff --git a/gcc/convert.c b/gcc/convert.c index 9e89163e1b1..6ff1a541131 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -268,9 +268,9 @@ convert_to_real (tree type, tree expr) newtype = TREE_TYPE (arg1); if (TYPE_PRECISION (newtype) < TYPE_PRECISION (itype)) { - expr = build (TREE_CODE (expr), newtype, - fold (convert_to_real (newtype, arg0)), - fold (convert_to_real (newtype, arg1))); + expr = build2 (TREE_CODE (expr), newtype, + fold (convert_to_real (newtype, arg0)), + fold (convert_to_real (newtype, arg1))); if (newtype == type) return expr; } @@ -525,7 +525,7 @@ convert_to_integer (tree type, tree expr) /* If the original expression had side-effects, we must preserve it. */ if (TREE_SIDE_EFFECTS (expr)) - return build (COMPOUND_EXPR, type, expr, t); + return build2 (COMPOUND_EXPR, type, expr, t); else return t; } @@ -605,9 +605,9 @@ convert_to_integer (tree type, tree expr) else typex = lang_hooks.types.signed_type (typex); return convert (type, - fold (build (ex_form, typex, - convert (typex, arg0), - convert (typex, arg1)))); + fold (build2 (ex_form, typex, + convert (typex, arg0), + convert (typex, arg1)))); } } } @@ -658,9 +658,9 @@ convert_to_integer (tree type, tree expr) case COND_EXPR: /* It is sometimes worthwhile to push the narrowing down through the conditional and never loses. */ - return fold (build (COND_EXPR, type, TREE_OPERAND (expr, 0), - convert (type, TREE_OPERAND (expr, 1)), - convert (type, TREE_OPERAND (expr, 2)))); + return fold (build3 (COND_EXPR, type, TREE_OPERAND (expr, 0), + convert (type, TREE_OPERAND (expr, 1)), + convert (type, TREE_OPERAND (expr, 2)))); default: break; @@ -704,8 +704,8 @@ convert_to_complex (tree type, tree expr) case ENUMERAL_TYPE: case BOOLEAN_TYPE: case CHAR_TYPE: - return build (COMPLEX_EXPR, type, convert (subtype, expr), - convert (subtype, integer_zero_node)); + return build2 (COMPLEX_EXPR, type, convert (subtype, expr), + convert (subtype, integer_zero_node)); case COMPLEX_TYPE: { @@ -714,23 +714,22 @@ convert_to_complex (tree type, tree expr) if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype)) return expr; else if (TREE_CODE (expr) == COMPLEX_EXPR) - return fold (build (COMPLEX_EXPR, - type, - convert (subtype, TREE_OPERAND (expr, 0)), - convert (subtype, TREE_OPERAND (expr, 1)))); + return fold (build2 (COMPLEX_EXPR, type, + convert (subtype, TREE_OPERAND (expr, 0)), + convert (subtype, TREE_OPERAND (expr, 1)))); else { expr = save_expr (expr); return - fold (build (COMPLEX_EXPR, - type, convert (subtype, - fold (build1 (REALPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), - expr))), - convert (subtype, - fold (build1 (IMAGPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), - expr))))); + fold (build2 (COMPLEX_EXPR, type, + convert (subtype, + fold (build1 (REALPART_EXPR, + TREE_TYPE (TREE_TYPE (expr)), + expr))), + convert (subtype, + fold (build1 (IMAGPART_EXPR, + TREE_TYPE (TREE_TYPE (expr)), + expr))))); } } diff --git a/gcc/coverage.c b/gcc/coverage.c index 888d5cde2c3..eb6f801982b 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -435,11 +435,11 @@ tree_coverage_counter_ref (unsigned counter, unsigned no) no += prg_n_ctrs[counter] + fn_b_ctrs[counter]; /* "no" here is an array index, scaled to bytes later. */ - return build (ARRAY_REF, GCOV_TYPE_NODE, tree_ctr_tables[counter], - fold_convert (domain_type, build_int_2 (no, 0)), - TYPE_MIN_VALUE (domain_type), - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (GCOV_TYPE_NODE), - size_int (TYPE_ALIGN (GCOV_TYPE_NODE)))); + return build4 (ARRAY_REF, GCOV_TYPE_NODE, tree_ctr_tables[counter], + fold_convert (domain_type, build_int_2 (no, 0)), + TYPE_MIN_VALUE (domain_type), + size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (GCOV_TYPE_NODE), + size_int (TYPE_ALIGN (GCOV_TYPE_NODE)))); } /* Generate a checksum for a string. CHKSUM is the current diff --git a/gcc/dojump.c b/gcc/dojump.c index 96493f3de8f..ab81d047947 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -219,18 +219,19 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) a test and can be longer if the test is eliminated. */ case PLUS_EXPR: /* Reduce to minus. */ - exp = build (MINUS_EXPR, TREE_TYPE (exp), - TREE_OPERAND (exp, 0), - fold (build1 (NEGATE_EXPR, TREE_TYPE (TREE_OPERAND (exp, 1)), - TREE_OPERAND (exp, 1)))); + exp = build2 (MINUS_EXPR, TREE_TYPE (exp), + TREE_OPERAND (exp, 0), + fold (build1 (NEGATE_EXPR, + TREE_TYPE (TREE_OPERAND (exp, 1)), + TREE_OPERAND (exp, 1)))); /* Process as MINUS. */ #endif case MINUS_EXPR: /* Nonzero iff operands of minus differ. */ - do_compare_and_jump (build (NE_EXPR, TREE_TYPE (exp), - TREE_OPERAND (exp, 0), - TREE_OPERAND (exp, 1)), + do_compare_and_jump (build2 (NE_EXPR, TREE_TYPE (exp), + TREE_OPERAND (exp, 0), + TREE_OPERAND (exp, 1)), NE, NE, if_false_label, if_true_label); break; @@ -251,8 +252,9 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) && prefer_and_bit_test (TYPE_MODE (argtype), TREE_INT_CST_LOW (shift))) { - do_jump (build (BIT_AND_EXPR, argtype, arg, - fold (build (LSHIFT_EXPR, argtype, one, shift))), + do_jump (build2 (BIT_AND_EXPR, argtype, arg, + fold (build2 (LSHIFT_EXPR, argtype, + one, shift))), if_false_label, if_true_label); break; } @@ -381,15 +383,15 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) tree exp1 = save_expr (TREE_OPERAND (exp, 1)); do_jump (fold - (build (TRUTH_ANDIF_EXPR, TREE_TYPE (exp), - fold (build (EQ_EXPR, TREE_TYPE (exp), + (build2 (TRUTH_ANDIF_EXPR, TREE_TYPE (exp), + fold (build2 (EQ_EXPR, TREE_TYPE (exp), fold (build1 (REALPART_EXPR, TREE_TYPE (inner_type), exp0)), fold (build1 (REALPART_EXPR, TREE_TYPE (inner_type), exp1)))), - fold (build (EQ_EXPR, TREE_TYPE (exp), + fold (build2 (EQ_EXPR, TREE_TYPE (exp), fold (build1 (IMAGPART_EXPR, TREE_TYPE (inner_type), exp0)), @@ -421,15 +423,15 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) tree exp1 = save_expr (TREE_OPERAND (exp, 1)); do_jump (fold - (build (TRUTH_ORIF_EXPR, TREE_TYPE (exp), - fold (build (NE_EXPR, TREE_TYPE (exp), + (build2 (TRUTH_ORIF_EXPR, TREE_TYPE (exp), + fold (build2 (NE_EXPR, TREE_TYPE (exp), fold (build1 (REALPART_EXPR, TREE_TYPE (inner_type), exp0)), fold (build1 (REALPART_EXPR, TREE_TYPE (inner_type), exp1)))), - fold (build (NE_EXPR, TREE_TYPE (exp), + fold (build2 (NE_EXPR, TREE_TYPE (exp), fold (build1 (IMAGPART_EXPR, TREE_TYPE (inner_type), exp0)), @@ -563,9 +565,9 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) /* If the target doesn't support combined unordered compares, decompose into two comparisons. */ - cmp0 = fold (build (tcode1, TREE_TYPE (exp), op0, op1)); - cmp1 = fold (build (tcode2, TREE_TYPE (exp), op0, op1)); - exp = build (TRUTH_ORIF_EXPR, TREE_TYPE (exp), cmp0, cmp1); + cmp0 = fold (build2 (tcode1, TREE_TYPE (exp), op0, op1)); + cmp1 = fold (build2 (tcode2, TREE_TYPE (exp), op0, op1)); + exp = build2 (TRUTH_ORIF_EXPR, TREE_TYPE (exp), cmp0, cmp1); do_jump (exp, if_false_label, if_true_label); } } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index df1544a390e..64fa5c96fc7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9195,9 +9195,9 @@ loc_descriptor_from_tree (tree loc, int addressp) const enum tree_code code = TREE_CODE (loc) == MIN_EXPR ? GT_EXPR : LT_EXPR; - loc = build (COND_EXPR, TREE_TYPE (loc), - build (code, integer_type_node, - TREE_OPERAND (loc, 0), TREE_OPERAND (loc, 1)), + loc = build3 (COND_EXPR, TREE_TYPE (loc), + build2 (code, integer_type_node, + TREE_OPERAND (loc, 0), TREE_OPERAND (loc, 1)), TREE_OPERAND (loc, 1), TREE_OPERAND (loc, 0)); } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index da722eea80d..19df2e717a3 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1460,8 +1460,8 @@ component_ref_for_mem_expr (tree ref) if (inner == TREE_OPERAND (ref, 0)) return ref; else - return build (COMPONENT_REF, TREE_TYPE (ref), inner, TREE_OPERAND (ref, 1), - NULL_TREE); + return build3 (COMPONENT_REF, TREE_TYPE (ref), inner, + TREE_OPERAND (ref, 1), NULL_TREE); } /* Returns 1 if both MEM_EXPR can be considered equal @@ -1634,8 +1634,8 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, index, then convert to sizetype and multiply by the size of the array element. */ if (! integer_zerop (low_bound)) - index = fold (build (MINUS_EXPR, TREE_TYPE (index), - index, low_bound)); + index = fold (build2 (MINUS_EXPR, TREE_TYPE (index), + index, low_bound)); off_tree = size_binop (PLUS_EXPR, size_binop (MULT_EXPR, convert (sizetype, diff --git a/gcc/explow.c b/gcc/explow.c index 208d7093b25..515778f5e6b 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -1089,8 +1089,8 @@ update_nonlocal_goto_save_area (void) first one is used for the frame pointer save; the rest are sized by STACK_SAVEAREA_MODE. Create a reference to array index 1, the first of the stack save area slots. */ - t_save = build (ARRAY_REF, ptr_type_node, cfun->nonlocal_goto_save_area, - integer_one_node, NULL_TREE, NULL_TREE); + t_save = build4 (ARRAY_REF, ptr_type_node, cfun->nonlocal_goto_save_area, + integer_one_node, NULL_TREE, NULL_TREE); r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE); emit_stack_save (SAVE_NONLOCAL, &r_save, NULL_RTX); diff --git a/gcc/expmed.c b/gcc/expmed.c index 9ceee9f923a..cdbbd177958 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2075,11 +2075,11 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted, tree type = TREE_TYPE (amount); tree new_amount = make_tree (type, op1); tree other_amount - = fold (build (MINUS_EXPR, type, - convert (type, - build_int_2 (GET_MODE_BITSIZE (mode), - 0)), - amount)); + = fold (build2 (MINUS_EXPR, type, + convert (type, + build_int_2 (GET_MODE_BITSIZE (mode), + 0)), + amount)); shifted = force_reg (mode, shifted); @@ -4386,37 +4386,37 @@ make_tree (tree type, rtx x) } case PLUS: - return fold (build (PLUS_EXPR, type, make_tree (type, XEXP (x, 0)), - make_tree (type, XEXP (x, 1)))); + return fold (build2 (PLUS_EXPR, type, make_tree (type, XEXP (x, 0)), + make_tree (type, XEXP (x, 1)))); case MINUS: - return fold (build (MINUS_EXPR, type, make_tree (type, XEXP (x, 0)), - make_tree (type, XEXP (x, 1)))); + return fold (build2 (MINUS_EXPR, type, make_tree (type, XEXP (x, 0)), + make_tree (type, XEXP (x, 1)))); case NEG: return fold (build1 (NEGATE_EXPR, type, make_tree (type, XEXP (x, 0)))); case MULT: - return fold (build (MULT_EXPR, type, make_tree (type, XEXP (x, 0)), - make_tree (type, XEXP (x, 1)))); + return fold (build2 (MULT_EXPR, type, make_tree (type, XEXP (x, 0)), + make_tree (type, XEXP (x, 1)))); case ASHIFT: - return fold (build (LSHIFT_EXPR, type, make_tree (type, XEXP (x, 0)), - make_tree (type, XEXP (x, 1)))); + return fold (build2 (LSHIFT_EXPR, type, make_tree (type, XEXP (x, 0)), + make_tree (type, XEXP (x, 1)))); case LSHIFTRT: t = lang_hooks.types.unsigned_type (type); return fold (convert (type, - build (RSHIFT_EXPR, t, - make_tree (t, XEXP (x, 0)), - make_tree (type, XEXP (x, 1))))); + build2 (RSHIFT_EXPR, t, + make_tree (t, XEXP (x, 0)), + make_tree (type, XEXP (x, 1))))); case ASHIFTRT: t = lang_hooks.types.signed_type (type); return fold (convert (type, - build (RSHIFT_EXPR, t, - make_tree (t, XEXP (x, 0)), - make_tree (type, XEXP (x, 1))))); + build2 (RSHIFT_EXPR, t, + make_tree (t, XEXP (x, 0)), + make_tree (type, XEXP (x, 1))))); case DIV: if (TREE_CODE (type) != REAL_TYPE) @@ -4425,15 +4425,15 @@ make_tree (tree type, rtx x) t = type; return fold (convert (type, - build (TRUNC_DIV_EXPR, t, - make_tree (t, XEXP (x, 0)), - make_tree (t, XEXP (x, 1))))); + build2 (TRUNC_DIV_EXPR, t, + make_tree (t, XEXP (x, 0)), + make_tree (t, XEXP (x, 1))))); case UDIV: t = lang_hooks.types.unsigned_type (type); return fold (convert (type, - build (TRUNC_DIV_EXPR, t, - make_tree (t, XEXP (x, 0)), - make_tree (t, XEXP (x, 1))))); + build2 (TRUNC_DIV_EXPR, t, + make_tree (t, XEXP (x, 0)), + make_tree (t, XEXP (x, 1))))); case SIGN_EXTEND: case ZERO_EXTEND: @@ -4483,11 +4483,11 @@ const_mult_add_overflow_p (rtx x, rtx mult, rtx add, enum machine_mode mode, int add_type = (GET_MODE (add) == VOIDmode ? mult_type : lang_hooks.types.type_for_mode (GET_MODE (add), unsignedp)); - result = fold (build (PLUS_EXPR, mult_type, - fold (build (MULT_EXPR, mult_type, - make_tree (mult_type, x), - make_tree (mult_type, mult))), - make_tree (add_type, add))); + result = fold (build2 (PLUS_EXPR, mult_type, + fold (build2 (MULT_EXPR, mult_type, + make_tree (mult_type, x), + make_tree (mult_type, mult))), + make_tree (add_type, add))); return TREE_CONSTANT_OVERFLOW (result); } @@ -4508,11 +4508,11 @@ expand_mult_add (rtx x, rtx target, rtx mult, rtx add, enum machine_mode mode, tree add_type = (GET_MODE (add) == VOIDmode ? type: lang_hooks.types.type_for_mode (GET_MODE (add), unsignedp)); - tree result = fold (build (PLUS_EXPR, type, - fold (build (MULT_EXPR, type, - make_tree (type, x), - make_tree (type, mult))), - make_tree (add_type, add))); + tree result = fold (build2 (PLUS_EXPR, type, + fold (build2 (MULT_EXPR, type, + make_tree (type, x), + make_tree (type, mult))), + make_tree (add_type, add))); return expand_expr (result, target, VOIDmode, 0); } diff --git a/gcc/expr.c b/gcc/expr.c index b3ef3ef4274..0cb1fcad097 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1322,8 +1322,8 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx size) /* Now we have to build up the CALL_EXPR itself. */ call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); - call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - call_expr, arg_list, NULL_TREE); + call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), + call_expr, arg_list, NULL_TREE); retval = expand_expr (call_expr, NULL_RTX, VOIDmode, 0); @@ -2390,8 +2390,8 @@ clear_storage_via_libcall (rtx object, rtx size) /* Now we have to build up the CALL_EXPR itself. */ call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); - call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - call_expr, arg_list, NULL_TREE); + call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), + call_expr, arg_list, NULL_TREE); retval = expand_expr (call_expr, NULL_RTX, VOIDmode, 0); @@ -4529,8 +4529,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) if (BYTES_BIG_ENDIAN) value - = fold (build (LSHIFT_EXPR, type, value, - build_int_2 (BITS_PER_WORD - bitsize, 0))); + = fold (build2 (LSHIFT_EXPR, type, value, + build_int_2 (BITS_PER_WORD - bitsize, 0))); bitsize = BITS_PER_WORD; mode = word_mode; } @@ -4729,8 +4729,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) /* Assign value to element index. */ position = convert (ssizetype, - fold (build (MINUS_EXPR, TREE_TYPE (index), - index, TYPE_MIN_VALUE (domain)))); + fold (build2 (MINUS_EXPR, TREE_TYPE (index), + index, TYPE_MIN_VALUE (domain)))); position = size_binop (MULT_EXPR, position, convert (ssizetype, TYPE_SIZE_UNIT (elttype))); @@ -4746,8 +4746,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) store_expr (value, xtarget, 0); /* Generate a conditional jump to exit the loop. */ - exit_cond = build (LT_EXPR, integer_type_node, - index, hi_index); + exit_cond = build2 (LT_EXPR, integer_type_node, + index, hi_index); jumpif (exit_cond, loop_end); /* Update the loop counter, and jump to the head of @@ -4772,8 +4772,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) if (minelt) index = fold_convert (ssizetype, - fold (build (MINUS_EXPR, index, - TYPE_MIN_VALUE (domain)))); + fold (build2 (MINUS_EXPR, + TREE_TYPE (index), + index, + TYPE_MIN_VALUE (domain)))); position = size_binop (MULT_EXPR, index, convert (ssizetype, @@ -5409,8 +5411,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, index, then convert to sizetype and multiply by the size of the array element. */ if (! integer_zerop (low_bound)) - index = fold (build (MINUS_EXPR, TREE_TYPE (index), - index, low_bound)); + index = fold (build2 (MINUS_EXPR, TREE_TYPE (index), + index, low_bound)); offset = size_binop (PLUS_EXPR, offset, size_binop (MULT_EXPR, @@ -7601,10 +7603,10 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (flag_unsafe_math_optimizations && optimize && !optimize_size && TREE_CODE (type) == REAL_TYPE && !real_onep (TREE_OPERAND (exp, 0))) - return expand_expr (build (MULT_EXPR, type, TREE_OPERAND (exp, 0), - build (RDIV_EXPR, type, - build_real (type, dconst1), - TREE_OPERAND (exp, 1))), + return expand_expr (build2 (MULT_EXPR, type, TREE_OPERAND (exp, 0), + build2 (RDIV_EXPR, type, + build_real (type, dconst1), + TREE_OPERAND (exp, 1))), target, tmode, modifier); this_optab = sdiv_optab; goto binop; @@ -7974,9 +7976,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, || (TREE_CODE_CLASS (TREE_CODE (iffalse)) == '1' && operand_equal_p (iftrue, TREE_OPERAND (iffalse, 0), 0))) return expand_expr (build1 (NOP_EXPR, type, - build (COND_EXPR, TREE_TYPE (iftrue), - TREE_OPERAND (exp, 0), - iftrue, iffalse)), + build3 (COND_EXPR, TREE_TYPE (iftrue), + TREE_OPERAND (exp, 0), + iftrue, iffalse)), target, tmode, modifier); } @@ -8152,9 +8154,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, expand_expr (TREE_OPERAND (binary_op, 1), ignore ? const0_rtx : NULL_RTX, VOIDmode, 0); else if (binary_op) - store_expr (build (TREE_CODE (binary_op), type, - make_tree (type, temp), - TREE_OPERAND (binary_op, 1)), + store_expr (build2 (TREE_CODE (binary_op), type, + make_tree (type, temp), + TREE_OPERAND (binary_op, 1)), temp, modifier == EXPAND_STACK_PARM ? 2 : 0); else store_expr (build1 (TREE_CODE (unary_op), type, @@ -9033,8 +9035,8 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range, rtx rangertx = expand_expr (range, NULL_RTX, VOIDmode, 0); /* We must handle the endpoints in the original mode. */ - index_expr = build (MINUS_EXPR, index_type, - index_expr, minval); + index_expr = build2 (MINUS_EXPR, index_type, + index_expr, minval); minval = integer_zero_node; index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0); emit_cmp_and_jump_insns (rangertx, index, LTU, NULL_RTX, @@ -9175,9 +9177,9 @@ try_tablejump (tree index_type, tree index_expr, tree minval, tree range, if (! HAVE_tablejump) return 0; - index_expr = fold (build (MINUS_EXPR, index_type, - convert (index_type, index_expr), - convert (index_type, minval))); + index_expr = fold (build2 (MINUS_EXPR, index_type, + convert (index_type, index_expr), + convert (index_type, minval))); index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0); do_pending_stack_adjust (); diff --git a/gcc/function.c b/gcc/function.c index 956fa76c7dc..a55b023887b 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4154,8 +4154,9 @@ expand_function_start (tree subr) before the frame variable gets declared. Help out... */ expand_var (TREE_OPERAND (cfun->nonlocal_goto_save_area, 0)); - t_save = build (ARRAY_REF, ptr_type_node, cfun->nonlocal_goto_save_area, - integer_zero_node, NULL_TREE, NULL_TREE); + t_save = build4 (ARRAY_REF, ptr_type_node, + cfun->nonlocal_goto_save_area, + integer_zero_node, NULL_TREE, NULL_TREE); r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE); r_save = convert_memory_address (Pmode, r_save); diff --git a/gcc/stmt.c b/gcc/stmt.c index b29b41ca84b..542d843eef1 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2655,10 +2655,10 @@ emit_case_bit_tests (tree index_type, tree index_expr, tree minval, else test[i].bits++; - lo = tree_low_cst (fold (build (MINUS_EXPR, index_type, - n->low, minval)), 1); - hi = tree_low_cst (fold (build (MINUS_EXPR, index_type, - n->high, minval)), 1); + lo = tree_low_cst (fold (build2 (MINUS_EXPR, index_type, + n->low, minval)), 1); + hi = tree_low_cst (fold (build2 (MINUS_EXPR, index_type, + n->high, minval)), 1); for (j = lo; j <= hi; j++) if (j >= HOST_BITS_PER_WIDE_INT) test[i].hi |= (HOST_WIDE_INT) 1 << (j - HOST_BITS_PER_INT); @@ -2668,9 +2668,9 @@ emit_case_bit_tests (tree index_type, tree index_expr, tree minval, qsort (test, count, sizeof(*test), case_bit_test_cmp); - index_expr = fold (build (MINUS_EXPR, index_type, - convert (index_type, index_expr), - convert (index_type, minval))); + index_expr = fold (build2 (MINUS_EXPR, index_type, + convert (index_type, index_expr), + convert (index_type, minval))); index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0); do_pending_stack_adjust (); @@ -2808,7 +2808,7 @@ expand_end_case_type (tree orig_index, tree orig_type) /* Compute span of values. */ if (count != 0) - range = fold (build (MINUS_EXPR, index_type, maxval, minval)); + range = fold (build2 (MINUS_EXPR, index_type, maxval, minval)); if (count == 0) { @@ -2973,11 +2973,11 @@ expand_end_case_type (tree orig_index, tree orig_type) value since that should fit in a HOST_WIDE_INT while the actual values may not. */ HOST_WIDE_INT i_low - = tree_low_cst (fold (build (MINUS_EXPR, index_type, - n->low, minval)), 1); + = tree_low_cst (fold (build2 (MINUS_EXPR, index_type, + n->low, minval)), 1); HOST_WIDE_INT i_high - = tree_low_cst (fold (build (MINUS_EXPR, index_type, - n->high, minval)), 1); + = tree_low_cst (fold (build2 (MINUS_EXPR, index_type, + n->high, minval)), 1); HOST_WIDE_INT i; for (i = i_low; i <= i_high; i ++) @@ -3280,8 +3280,8 @@ node_has_low_bound (case_node_ptr node, tree index_type) if (node->left) return 0; - low_minus_one = fold (build (MINUS_EXPR, TREE_TYPE (node->low), - node->low, integer_one_node)); + low_minus_one = fold (build2 (MINUS_EXPR, TREE_TYPE (node->low), + node->low, integer_one_node)); /* If the subtraction above overflowed, we can't verify anything. Otherwise, look for a parent that tests our value - 1. */ @@ -3330,8 +3330,8 @@ node_has_high_bound (case_node_ptr node, tree index_type) if (node->right) return 0; - high_plus_one = fold (build (PLUS_EXPR, TREE_TYPE (node->high), - node->high, integer_one_node)); + high_plus_one = fold (build2 (PLUS_EXPR, TREE_TYPE (node->high), + node->high, integer_one_node)); /* If the addition above overflowed, we can't verify anything. Otherwise, look for a parent that tests our value + 1. */ @@ -3754,8 +3754,8 @@ emit_case_nodes (rtx index, case_node_ptr node, rtx default_label, new_index = expand_simple_binop (mode, MINUS, index, low_rtx, NULL_RTX, unsignedp, OPTAB_WIDEN); - new_bound = expand_expr (fold (build (MINUS_EXPR, type, - high, low)), + new_bound = expand_expr (fold (build2 (MINUS_EXPR, type, + high, low)), NULL_RTX, mode, 0); emit_cmp_and_jump_insns (new_index, new_bound, GT, NULL_RTX, diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 139ba510435..772177077f2 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -802,9 +802,9 @@ place_union_field (record_layout_info rli, tree field) if (TREE_CODE (rli->t) == UNION_TYPE) rli->offset = size_binop (MAX_EXPR, rli->offset, DECL_SIZE_UNIT (field)); else if (TREE_CODE (rli->t) == QUAL_UNION_TYPE) - rli->offset = fold (build (COND_EXPR, sizetype, - DECL_QUALIFIER (field), - DECL_SIZE_UNIT (field), rli->offset)); + rli->offset = fold (build3 (COND_EXPR, sizetype, + DECL_QUALIFIER (field), + DECL_SIZE_UNIT (field), rli->offset)); } #if defined (PCC_BITFIELD_TYPE_MATTERS) || defined (BITFIELD_NBYTES_LIMITED) @@ -1692,9 +1692,9 @@ layout_type (tree type) that (possible) negative values are handled appropriately. */ length = size_binop (PLUS_EXPR, size_one_node, convert (sizetype, - fold (build (MINUS_EXPR, - TREE_TYPE (lb), - ub, lb)))); + fold (build2 (MINUS_EXPR, + TREE_TYPE (lb), + ub, lb)))); /* Special handling for arrays of bits (for Chill). */ element_size = TYPE_SIZE (element); diff --git a/gcc/tree.c b/gcc/tree.c index 6fa13757bb9..bba53fd5727 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1898,8 +1898,7 @@ substitute_in_expr (tree exp, tree f, tree r) && TREE_OPERAND (exp, 1) == f) return r; - /* If this expression hasn't been completed let, leave it - alone. */ + /* If this expression hasn't been completed let, leave it alone. */ if (TREE_CODE (inner) == PLACEHOLDER_EXPR && TREE_TYPE (inner) == 0) return exp; @@ -1907,8 +1906,8 @@ substitute_in_expr (tree exp, tree f, tree r) if (op0 == TREE_OPERAND (exp, 0)) return exp; - new = fold (build (code, TREE_TYPE (exp), op0, TREE_OPERAND (exp, 1), - NULL_TREE)); + new = fold (build3 (COMPONENT_REF, TREE_TYPE (exp), + op0, TREE_OPERAND (exp, 1), NULL_TREE)); } else switch (TREE_CODE_CLASS (code)) @@ -5761,16 +5760,16 @@ tree_fold_gcd (tree a, tree b) return a; if (tree_int_cst_sgn (a) == -1) - a = fold (build (MULT_EXPR, type, a, - convert (type, integer_minus_one_node))); + a = fold (build2 (MULT_EXPR, type, a, + convert (type, integer_minus_one_node))); if (tree_int_cst_sgn (b) == -1) - b = fold (build (MULT_EXPR, type, b, - convert (type, integer_minus_one_node))); + b = fold (build2 (MULT_EXPR, type, b, + convert (type, integer_minus_one_node))); while (1) { - a_mod_b = fold (build (CEIL_MOD_EXPR, type, a, b)); + a_mod_b = fold (build2 (CEIL_MOD_EXPR, type, a, b)); if (!TREE_INT_CST_LOW (a_mod_b) && !TREE_INT_CST_HIGH (a_mod_b)) diff --git a/gcc/varasm.c b/gcc/varasm.c index 7107c5f9a69..95ac3775136 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2362,9 +2362,9 @@ copy_constant (tree exp) case PLUS_EXPR: case MINUS_EXPR: - return build (TREE_CODE (exp), TREE_TYPE (exp), - copy_constant (TREE_OPERAND (exp, 0)), - copy_constant (TREE_OPERAND (exp, 1))); + return build2 (TREE_CODE (exp), TREE_TYPE (exp), + copy_constant (TREE_OPERAND (exp, 0)), + copy_constant (TREE_OPERAND (exp, 1))); case NOP_EXPR: case CONVERT_EXPR: -- 2.30.2