From f293ce4b0d14fc523cac7df7169726e5dadaa329 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 16 Aug 2004 02:08:06 +0000 Subject: [PATCH] call.c (build_vfield_ref, [...]): Replace calls to build with calls to buildN. * call.c (build_vfield_ref, build_call, build_conditional_expr, convert_arg_to_ellipsis, build_x_va_arg, build_over_call, build_java_interface_fn_ref, build_special_member_call, build_new_method_call, initialize_reference): Replace calls to build with calls to buildN. * class.c (build_base_path, convert_to_base_statically, build_vfn_ref, instantiate_type, dfs_accumulate_vtbl_inits, build_vtbl_initializer): Likewise. * cp-gimplify.c (genericize_try_block, genericize_catch_block, gimplify_if_stmt, cp_genericize_r): Likewise. * cvt.c (convert_to_void): Likewise. * decl.c (check_initializer, finish_constructor_body, finish_destructor_body): Likewise. * error.c (dump_expr): Likewise. * except.c (build_exc_ptr, expand_start_catch_block, build_throw): Likewise. * init.c (perform_member_init, expand_virtual_init, expand_cleanup_for_base, build_init, expand_default_init, build_offset_ref, decl_constant_value, build_new, build_new_1, build_vec_delete_1, build_vec_init, build_delete, push_base_cleanups, build_vec_delete): Likewise. * mangle.c (write_integer_cst): Likewise. * method.c (thunk_adjust, do_build_copy_constructor, do_build_assign_ref): Likewise. * pt.c (lookup_template_function, tsubst, tsubst_copy_and_build, unify, build_non_dependent_expr): Likewise. * rtti.c (build_headof, build_typeid, ifnonnull, build_dyanmic_cast_1, tinfo_base_init): Likewise. * semantics.c (begin_compound_stmt, finish_call_expr, finish_pseudo_destructor_expr, finish_id_expression, simplify_aggr_init_expr, finalize_nrv_r): Likewise. * tree.c (build_target_expr, build_cplus_new, array_type_nelts_top, array_type_nelts_total, stabilize_call): Likewise. * typeck.c (decay_conversion, build_class_member_access_expr, lookup_destructor, build_ptrmemfunc_access_expr, build_array_ref, get_member_function_from_ptrfunc, build_binary_op, pointer_diff, build_x_unary_op, build_unary_op, unary_complex_lvalue, build_compound_expr, build_modify_expr, expand_ptrmemfunc_cst, check_return_expr): Likewise. * typeck2.c (split_nonconstant_1, split_nonconstant_init_1, split_nonconstant_init, store_init_value, build_m_component_ref): Likewise. From-SVN: r86047 --- gcc/cp/ChangeLog | 45 ++++++++++++++ gcc/cp/call.c | 52 ++++++++-------- gcc/cp/class.c | 40 ++++++------ gcc/cp/cp-gimplify.c | 13 ++-- gcc/cp/cvt.c | 8 +-- gcc/cp/decl.c | 16 ++--- gcc/cp/error.c | 6 +- gcc/cp/except.c | 16 ++--- gcc/cp/init.c | 173 ++++++++++++++++++++++++++------------------------- gcc/cp/mangle.c | 8 +-- gcc/cp/method.c | 32 +++++----- gcc/cp/pt.c | 42 ++++++------- gcc/cp/rtti.c | 18 +++--- gcc/cp/semantics.c | 24 +++---- gcc/cp/tree.c | 18 +++--- gcc/cp/typeck.c | 162 ++++++++++++++++++++++++----------------------- gcc/cp/typeck2.c | 30 ++++----- 17 files changed, 378 insertions(+), 325 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5b7739..6e4ec46 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,48 @@ +2004-08-15 Roger Sayle + + * call.c (build_vfield_ref, build_call, build_conditional_expr, + convert_arg_to_ellipsis, build_x_va_arg, build_over_call, + build_java_interface_fn_ref, build_special_member_call, + build_new_method_call, initialize_reference): Replace calls to + build with calls to buildN. + * class.c (build_base_path, convert_to_base_statically, + build_vfn_ref, instantiate_type, dfs_accumulate_vtbl_inits, + build_vtbl_initializer): Likewise. + * cp-gimplify.c (genericize_try_block, genericize_catch_block, + gimplify_if_stmt, cp_genericize_r): Likewise. + * cvt.c (convert_to_void): Likewise. + * decl.c (check_initializer, finish_constructor_body, + finish_destructor_body): Likewise. + * error.c (dump_expr): Likewise. + * except.c (build_exc_ptr, expand_start_catch_block, build_throw): + Likewise. + * init.c (perform_member_init, expand_virtual_init, + expand_cleanup_for_base, build_init, expand_default_init, + build_offset_ref, decl_constant_value, build_new, build_new_1, + build_vec_delete_1, build_vec_init, build_delete, + push_base_cleanups, build_vec_delete): Likewise. + * mangle.c (write_integer_cst): Likewise. + * method.c (thunk_adjust, do_build_copy_constructor, + do_build_assign_ref): Likewise. + * pt.c (lookup_template_function, tsubst, tsubst_copy_and_build, + unify, build_non_dependent_expr): Likewise. + * rtti.c (build_headof, build_typeid, ifnonnull, + build_dyanmic_cast_1, tinfo_base_init): Likewise. + * semantics.c (begin_compound_stmt, finish_call_expr, + finish_pseudo_destructor_expr, finish_id_expression, + simplify_aggr_init_expr, finalize_nrv_r): Likewise. + * tree.c (build_target_expr, build_cplus_new, array_type_nelts_top, + array_type_nelts_total, stabilize_call): Likewise. + * typeck.c (decay_conversion, build_class_member_access_expr, + lookup_destructor, build_ptrmemfunc_access_expr, build_array_ref, + get_member_function_from_ptrfunc, build_binary_op, pointer_diff, + build_x_unary_op, build_unary_op, unary_complex_lvalue, + build_compound_expr, build_modify_expr, expand_ptrmemfunc_cst, + check_return_expr): Likewise. + * typeck2.c (split_nonconstant_1, split_nonconstant_init_1, + split_nonconstant_init, store_init_value, build_m_component_ref): + Likewise. + 2004-08-15 Nathan Sidwell * call.c (convert_class_to_reference, diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ca6b0d8..86f5e6d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -204,8 +204,8 @@ build_vfield_ref (tree datum, tree type) && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (datum), type)) datum = convert_to_base (datum, type, /*check_access=*/false); - return build (COMPONENT_REF, TREE_TYPE (TYPE_VFIELD (type)), - datum, TYPE_VFIELD (type), NULL_TREE); + return build3 (COMPONENT_REF, TREE_TYPE (TYPE_VFIELD (type)), + datum, TYPE_VFIELD (type), NULL_TREE); } /* Returns nonzero iff the destructor name specified in NAME @@ -343,12 +343,12 @@ build_call (tree function, tree parms) if (is_empty_class (TREE_TYPE (TREE_VALUE (tmp))) && ! TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (tmp)))) { - tree t = build (EMPTY_CLASS_EXPR, TREE_TYPE (TREE_VALUE (tmp))); - TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t), - TREE_VALUE (tmp), t); + tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (TREE_VALUE (tmp))); + TREE_VALUE (tmp) = build2 (COMPOUND_EXPR, TREE_TYPE (t), + TREE_VALUE (tmp), t); } - function = build (CALL_EXPR, result_type, function, parms, NULL_TREE); + function = build3 (CALL_EXPR, result_type, function, parms, NULL_TREE); TREE_HAS_CONSTRUCTOR (function) = is_constructor; TREE_NOTHROW (function) = nothrow; @@ -3463,7 +3463,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) } valid_operands: - result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3)); + result = fold (build3 (COND_EXPR, result_type, arg1, arg2, arg3)); /* We can't use result_type below, as fold might have returned a throw_expr. */ @@ -4401,8 +4401,8 @@ convert_arg_to_ellipsis (tree arg) warning ("cannot pass objects of non-POD type `%#T' through `...'; " "call will abort at runtime", TREE_TYPE (arg)); arg = call_builtin_trap (); - arg = build (COMPOUND_EXPR, integer_type_node, arg, - integer_zero_node); + arg = build2 (COMPOUND_EXPR, integer_type_node, arg, + integer_zero_node); } return arg; @@ -4428,8 +4428,8 @@ build_x_va_arg (tree expr, tree type) call will abort at runtime", type); expr = convert (build_pointer_type (type), null_node); - expr = build (COMPOUND_EXPR, TREE_TYPE (expr), - call_builtin_trap (), expr); + expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), + call_builtin_trap (), expr); expr = build_indirect_ref (expr, NULL); return expr; } @@ -4591,7 +4591,7 @@ build_over_call (struct z_candidate *cand, int flags) tree expr; tree return_type; return_type = TREE_TYPE (TREE_TYPE (fn)); - expr = build (CALL_EXPR, return_type, fn, args, NULL_TREE); + expr = build3 (CALL_EXPR, return_type, fn, args, NULL_TREE); if (TREE_THIS_VOLATILE (fn) && cfun) current_function_returns_abnormally = 1; if (!VOID_TYPE_P (return_type)) @@ -4803,7 +4803,7 @@ build_over_call (struct z_candidate *cand, int flags) tree to = stabilize_reference (build_indirect_ref (TREE_VALUE (args), 0)); - val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg); + val = build2 (INIT_EXPR, DECL_CONTEXT (fn), to, arg); return val; } } @@ -4820,7 +4820,7 @@ build_over_call (struct z_candidate *cand, int flags) if (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (as_base))) { arg = build_indirect_ref (arg, 0); - val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); + val = build2 (MODIFY_EXPR, TREE_TYPE (to), to, arg); } else { @@ -4967,7 +4967,7 @@ build_java_interface_fn_ref (tree fn, tree instance) lookup_fn = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (java_iface_lookup_fn)), java_iface_lookup_fn); - return build (CALL_EXPR, ptr_type_node, lookup_fn, lookup_args, NULL_TREE); + return build3 (CALL_EXPR, ptr_type_node, lookup_fn, lookup_args, NULL_TREE); } /* Returns the value to use for the in-charge parameter when making a @@ -5083,14 +5083,14 @@ build_special_member_call (tree instance, tree name, tree args, Otherwise, we look it up using the VTT we were given. */ vtt = TREE_CHAIN (CLASSTYPE_VTABLES (current_class_type)); vtt = decay_conversion (vtt); - vtt = build (COND_EXPR, TREE_TYPE (vtt), - build (EQ_EXPR, boolean_type_node, - current_in_charge_parm, integer_zero_node), - current_vtt_parm, - vtt); + vtt = build3 (COND_EXPR, TREE_TYPE (vtt), + build2 (EQ_EXPR, boolean_type_node, + current_in_charge_parm, integer_zero_node), + current_vtt_parm, + vtt); my_friendly_assert (BINFO_SUBVTT_INDEX (binfo), 20010110); - sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt, - BINFO_SUBVTT_INDEX (binfo)); + sub_vtt = build2 (PLUS_EXPR, TREE_TYPE (vtt), vtt, + BINFO_SUBVTT_INDEX (binfo)); args = tree_cons (NULL_TREE, sub_vtt, args); } @@ -5365,8 +5365,8 @@ build_new_method_call (tree instance, tree fns, tree args, if (TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE && !is_dummy_object (instance_ptr) && TREE_SIDE_EFFECTS (instance)) - call = build (COMPOUND_EXPR, TREE_TYPE (call), - instance, call); + call = build2 (COMPOUND_EXPR, TREE_TYPE (call), + instance, call); } } } @@ -6488,7 +6488,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup) expr = get_target_expr (expr); /* Create the INIT_EXPR that will initialize the temporary variable. */ - init = build (INIT_EXPR, type, var, expr); + init = build2 (INIT_EXPR, type, var, expr); if (at_function_scope_p ()) { add_decl_expr (var); @@ -6522,7 +6522,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup) } /* Use its address to initialize the reference variable. */ expr = build_address (var); - expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr); + expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr); } else /* Take the address of EXPR. */ diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 418659e..7c16791 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -343,16 +343,16 @@ build_base_path (enum tree_code code, t = TREE_TYPE (TYPE_VFIELD (BINFO_TYPE (derived))); t = build_pointer_type (t); v_offset = convert (t, current_vtt_parm); - v_offset = build (PLUS_EXPR, t, v_offset, - BINFO_VPTR_INDEX (derived)); + v_offset = build2 (PLUS_EXPR, t, v_offset, + BINFO_VPTR_INDEX (derived)); v_offset = build_indirect_ref (v_offset, NULL); } else v_offset = build_vfield_ref (build_indirect_ref (expr, NULL), TREE_TYPE (TREE_TYPE (expr))); - v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset), - v_offset, BINFO_VPTR_FIELD (v_binfo)); + v_offset = build2 (PLUS_EXPR, TREE_TYPE (v_offset), + v_offset, BINFO_VPTR_FIELD (v_binfo)); v_offset = build1 (NOP_EXPR, build_pointer_type (ptrdiff_type_node), v_offset); @@ -365,17 +365,17 @@ build_base_path (enum tree_code code, BINFO_OFFSET (v_binfo))); if (!integer_zerop (offset)) - v_offset = build (code, ptrdiff_type_node, v_offset, offset); + v_offset = build2 (code, ptrdiff_type_node, v_offset, offset); if (fixed_type_p < 0) /* Negative fixed_type_p means this is a constructor or destructor; virtual base layout is fixed in in-charge [cd]tors, but not in base [cd]tors. */ - offset = build (COND_EXPR, ptrdiff_type_node, - build (EQ_EXPR, boolean_type_node, - current_in_charge_parm, integer_zero_node), - v_offset, - BINFO_OFFSET (binfo)); + offset = build3 (COND_EXPR, ptrdiff_type_node, + build2 (EQ_EXPR, boolean_type_node, + current_in_charge_parm, integer_zero_node), + v_offset, + BINFO_OFFSET (binfo)); else offset = v_offset; } @@ -391,7 +391,7 @@ build_base_path (enum tree_code code, expr = build1 (NOP_EXPR, ptr_target_type, expr); if (!integer_zerop (offset)) - expr = build (code, ptr_target_type, expr, offset); + expr = build2 (code, ptr_target_type, expr, offset); else null_test = NULL; @@ -484,8 +484,8 @@ convert_to_base_statically (tree expr, tree base) pointer_type = build_pointer_type (expr_type); expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1); if (!integer_zerop (BINFO_OFFSET (base))) - expr = build (PLUS_EXPR, pointer_type, expr, - build_nop (pointer_type, BINFO_OFFSET (base))); + expr = build2 (PLUS_EXPR, pointer_type, expr, + build_nop (pointer_type, BINFO_OFFSET (base))); expr = build_nop (build_pointer_type (BINFO_TYPE (base)), expr); expr = build1 (INDIRECT_REF, BINFO_TYPE (base), expr); } @@ -558,7 +558,7 @@ build_vfn_ref (tree instance_ptr, tree idx) build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1)); /* Remember this as a method reference, for later devirtualization. */ - aref = build (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr, idx); + aref = build3 (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr, idx); return aref; } @@ -6021,8 +6021,8 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) if (addr != error_mark_node && TREE_SIDE_EFFECTS (TREE_OPERAND (rhs, 0))) /* Do not lose object's side effects. */ - addr = build (COMPOUND_EXPR, TREE_TYPE (addr), - TREE_OPERAND (rhs, 0), addr); + addr = build2 (COMPOUND_EXPR, TREE_TYPE (addr), + TREE_OPERAND (rhs, 0), addr); return addr; } @@ -7214,7 +7214,7 @@ dfs_accumulate_vtbl_inits (tree binfo, index = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (vtable_entry_type), index); - vtbl = build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index); + vtbl = build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index); } if (ctor_vtbl_p) @@ -7402,9 +7402,9 @@ build_vtbl_initializer (tree binfo, else for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i) { - tree fdesc = build (FDESC_EXPR, vfunc_ptr_type_node, - TREE_OPERAND (init, 0), - build_int_cst (NULL_TREE, i, 0)); + tree fdesc = build2 (FDESC_EXPR, vfunc_ptr_type_node, + TREE_OPERAND (init, 0), + build_int_cst (NULL_TREE, i, 0)); TREE_CONSTANT (fdesc) = 1; TREE_INVARIANT (fdesc) = 1; diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 5568a95..e066f7b 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -46,7 +46,7 @@ genericize_try_block (tree *stmt_p) else gimplify_stmt (&cleanup); - *stmt_p = build (TRY_CATCH_EXPR, void_type_node, body, cleanup); + *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup); } /* Genericize a HANDLER by converting to a CATCH_EXPR. */ @@ -60,7 +60,7 @@ genericize_catch_block (tree *stmt_p) gimplify_stmt (&body); /* FIXME should the caught type go in TREE_TYPE? */ - *stmt_p = build (CATCH_EXPR, void_type_node, type, body); + *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body); } /* Genericize an EH_SPEC_BLOCK by converting it to a @@ -95,7 +95,7 @@ gimplify_if_stmt (tree *stmt_p) if (!else_) else_ = build_empty_stmt (); - stmt = build (COND_EXPR, void_type_node, IF_COND (stmt), then_, else_); + stmt = build3 (COND_EXPR, void_type_node, IF_COND (stmt), then_, else_); *stmt_p = stmt; } @@ -310,8 +310,11 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) to lower this construct before scanning it, so we need to lower these before doing anything else. */ else if (TREE_CODE (stmt) == CLEANUP_STMT) - *stmt_p = build (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR : TRY_FINALLY_EXPR, - void_type_node, CLEANUP_BODY (stmt), CLEANUP_EXPR (stmt)); + *stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR + : TRY_FINALLY_EXPR, + void_type_node, + CLEANUP_BODY (stmt), + CLEANUP_EXPR (stmt)); *slot = *stmt_p; return NULL; diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 70aba6e..5a6584d 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -804,8 +804,8 @@ convert_to_void (tree expr, const char *implicit) (op2, (implicit && !TREE_SIDE_EFFECTS (op1) ? "third operand of conditional" : NULL)); - expr = build (COND_EXPR, TREE_TYPE (new_op1), - TREE_OPERAND (expr, 0), new_op1, new_op2); + expr = build3 (COND_EXPR, TREE_TYPE (new_op1), + TREE_OPERAND (expr, 0), new_op1, new_op2); break; } @@ -819,8 +819,8 @@ convert_to_void (tree expr, const char *implicit) if (new_op1 != op1) { - tree t = build (COMPOUND_EXPR, TREE_TYPE (new_op1), - TREE_OPERAND (expr, 0), new_op1); + tree t = build2 (COMPOUND_EXPR, TREE_TYPE (new_op1), + TREE_OPERAND (expr, 0), new_op1); expr = t; } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2be55d6..a4856a9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4497,7 +4497,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) check_for_uninitialized_const_var (decl); if (init && init != error_mark_node) - init_code = build (INIT_EXPR, type, decl, init); + init_code = build2 (INIT_EXPR, type, decl, init); return init_code; } @@ -10076,8 +10076,8 @@ finish_constructor_body (void) add_stmt (build_stmt (LABEL_EXPR, cdtor_label)); val = DECL_ARGUMENTS (current_function_decl); - val = build (MODIFY_EXPR, TREE_TYPE (val), - DECL_RESULT (current_function_decl), val); + val = build2 (MODIFY_EXPR, TREE_TYPE (val), + DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ exprstmt = build_stmt (RETURN_EXPR, val); add_stmt (exprstmt); @@ -10160,9 +10160,9 @@ finish_destructor_body (void) /*global_p=*/false, NULL_TREE); if_stmt = begin_if_stmt (); - finish_if_stmt_cond (build (BIT_AND_EXPR, integer_type_node, - current_in_charge_parm, - integer_one_node), + finish_if_stmt_cond (build2 (BIT_AND_EXPR, integer_type_node, + current_in_charge_parm, + integer_one_node), if_stmt); finish_expr_stmt (exprstmt); finish_then_clause (if_stmt); @@ -10174,8 +10174,8 @@ finish_destructor_body (void) tree val; val = DECL_ARGUMENTS (current_function_decl); - val = build (MODIFY_EXPR, TREE_TYPE (val), - DECL_RESULT (current_function_decl), val); + val = build2 (MODIFY_EXPR, TREE_TYPE (val), + DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ exprstmt = build_stmt (RETURN_EXPR, val); add_stmt (exprstmt); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index f9a322e..7814b68 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1402,9 +1402,9 @@ dump_expr (tree t, int flags) if (TREE_CODE (type) == ARRAY_REF) type = build_cplus_array_type (TREE_OPERAND (type, 0), - build_index_type (fold (build (MINUS_EXPR, integer_type_node, - TREE_OPERAND (type, 1), - integer_one_node)))); + build_index_type (fold (build2 (MINUS_EXPR, integer_type_node, + TREE_OPERAND (type, 1), + integer_one_node)))); dump_type (type, flags); if (init) { diff --git a/gcc/cp/except.c b/gcc/cp/except.c index fd8b054..e572aa7 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -150,7 +150,7 @@ build_eh_type_type (tree type) tree build_exc_ptr (void) { - return build (EXC_PTR_EXPR, ptr_type_node); + return build0 (EXC_PTR_EXPR, ptr_type_node); } /* Build up a call to __cxa_begin_catch, to tell the runtime that the @@ -407,8 +407,8 @@ expand_start_catch_block (tree decl) generic exception header. */ init = build_exc_ptr (); init = build1 (NOP_EXPR, build_pointer_type (type), init); - init = build (MINUS_EXPR, TREE_TYPE (init), init, - TYPE_SIZE_UNIT (TREE_TYPE (init))); + init = build2 (MINUS_EXPR, TREE_TYPE (init), init, + TYPE_SIZE_UNIT (TREE_TYPE (init))); init = build_indirect_ref (init, NULL); is_java = true; } @@ -689,13 +689,13 @@ build_throw (tree exp) stabilize_init (exp, &temp_expr); if (elided) - exp = build (TRY_CATCH_EXPR, void_type_node, exp, - do_free_exception (ptr)); + exp = build2 (TRY_CATCH_EXPR, void_type_node, exp, + do_free_exception (ptr)); else exp = build1 (MUST_NOT_THROW_EXPR, void_type_node, exp); /* Prepend the allocation. */ - exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp); + exp = build2 (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp); if (temp_expr) { /* Prepend the calculation of the throw expression. Also, force @@ -704,7 +704,7 @@ build_throw (tree exp) them in MUST_NOT_THROW_EXPR, since they are run after the exception object is initialized. */ walk_tree_without_duplicates (&temp_expr, wrap_cleanups_r, 0); - exp = build (COMPOUND_EXPR, TREE_TYPE (exp), temp_expr, exp); + exp = build2 (COMPOUND_EXPR, TREE_TYPE (exp), temp_expr, exp); exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp); } @@ -730,7 +730,7 @@ build_throw (tree exp) tmp = build_function_call (fn, tmp); /* Tack on the initialization stuff. */ - exp = build (COMPOUND_EXPR, TREE_TYPE (tmp), exp, tmp); + exp = build2 (COMPOUND_EXPR, TREE_TYPE (tmp), exp, tmp); } else { diff --git a/gcc/cp/init.c b/gcc/cp/init.c index b84994c..3263f6e 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -339,7 +339,7 @@ perform_member_init (tree member, tree init) { if (init) { - init = build (INIT_EXPR, type, decl, TREE_VALUE (init)); + init = build2 (INIT_EXPR, type, decl, TREE_VALUE (init)); finish_expr_stmt (init); } } @@ -766,22 +766,22 @@ expand_virtual_init (tree binfo, tree decl) /* Compute the value to use, when there's a VTT. */ vtt_parm = current_vtt_parm; - vtbl2 = build (PLUS_EXPR, - TREE_TYPE (vtt_parm), - vtt_parm, - vtt_index); + vtbl2 = build2 (PLUS_EXPR, + TREE_TYPE (vtt_parm), + vtt_parm, + vtt_index); vtbl2 = build_indirect_ref (vtbl2, NULL); vtbl2 = convert (TREE_TYPE (vtbl), vtbl2); /* The actual initializer is the VTT value only in the subobject constructor. In maybe_clone_body we'll substitute NULL for the vtt_parm in the case of the non-subobject constructor. */ - vtbl = build (COND_EXPR, - TREE_TYPE (vtbl), - build (EQ_EXPR, boolean_type_node, - current_in_charge_parm, integer_zero_node), - vtbl2, - vtbl); + vtbl = build3 (COND_EXPR, + TREE_TYPE (vtbl), + build2 (EQ_EXPR, boolean_type_node, + current_in_charge_parm, integer_zero_node), + vtbl2, + vtbl); } /* Compute the location of the vtpr. */ @@ -815,9 +815,9 @@ expand_cleanup_for_base (tree binfo, tree flag) binfo, LOOKUP_NORMAL | LOOKUP_NONVIRTUAL); if (flag) - expr = fold (build (COND_EXPR, void_type_node, - c_common_truthvalue_conversion (flag), - expr, integer_zero_node)); + expr = fold (build3 (COND_EXPR, void_type_node, + c_common_truthvalue_conversion (flag), + expr, integer_zero_node)); finish_eh_cleanup (expr); } @@ -1144,7 +1144,7 @@ build_init (tree decl, tree init, int flags) TREE_TYPE (decl), LOOKUP_NORMAL|flags); else - expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init); + expr = build2 (INIT_EXPR, TREE_TYPE (decl), decl, init); return expr; } @@ -1192,12 +1192,12 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags) around the TARGET_EXPR for the copy constructor. See initialize_handler_parm. */ { - TREE_OPERAND (init, 0) = build (INIT_EXPR, TREE_TYPE (exp), exp, - TREE_OPERAND (init, 0)); + TREE_OPERAND (init, 0) = build2 (INIT_EXPR, TREE_TYPE (exp), exp, + TREE_OPERAND (init, 0)); TREE_TYPE (init) = void_type_node; } else - init = build (INIT_EXPR, TREE_TYPE (exp), exp, init); + init = build2 (INIT_EXPR, TREE_TYPE (exp), exp, init); TREE_SIDE_EFFECTS (init) = 1; finish_expr_stmt (init); return; @@ -1365,8 +1365,8 @@ build_offset_ref (tree type, tree name, bool address_p) return t; if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR) /* Reconstruct the TEMPLATE_ID_EXPR. */ - t = build (TEMPLATE_ID_EXPR, TREE_TYPE (t), - t, TREE_OPERAND (orig_name, 1)); + t = build2 (TEMPLATE_ID_EXPR, TREE_TYPE (t), + t, TREE_OPERAND (orig_name, 1)); if (! type_unknown_p (t)) { mark_used (t); @@ -1461,9 +1461,9 @@ build_offset_ref (tree type, tree name, bool address_p) expects to encounter OVERLOADs, not raw functions. */ t = ovl_cons (t, NULL_TREE); - t = build (TEMPLATE_ID_EXPR, TREE_TYPE (t), t, - TREE_OPERAND (orig_name, 1)); - t = build (OFFSET_REF, unknown_type_node, decl, t); + t = build2 (TEMPLATE_ID_EXPR, TREE_TYPE (t), t, + TREE_OPERAND (orig_name, 1)); + t = build2 (OFFSET_REF, unknown_type_node, decl, t); PTRMEM_OK_P (t) = 1; @@ -1530,7 +1530,7 @@ build_offset_ref (tree type, tree name, bool address_p) /* Build a representation of a the qualified name suitable for use as the operand to "&" -- even though the "&" is not actually present. */ - member = build (OFFSET_REF, TREE_TYPE (member), decl, member); + member = build2 (OFFSET_REF, TREE_TYPE (member), decl, member); /* In Microsoft mode, treat a non-static member function as if it were a pointer-to-member. */ if (flag_ms_extensions) @@ -1553,7 +1553,7 @@ build_offset_ref (tree type, tree name, bool address_p) /* In member functions, the form `type::name' is no longer equivalent to `this->type::name', at least not until resolve_offset_ref. */ - member = build (OFFSET_REF, TREE_TYPE (member), decl, member); + member = build2 (OFFSET_REF, TREE_TYPE (member), decl, member); PTRMEM_OK_P (member) = 1; return member; } @@ -1577,9 +1577,9 @@ decl_constant_value (tree decl) d2 = decl_constant_value (TREE_OPERAND (decl, 2)); if (d1 != TREE_OPERAND (decl, 1) || d2 != TREE_OPERAND (decl, 2)) - return build (COND_EXPR, - TREE_TYPE (decl), - TREE_OPERAND (decl, 0), d1, d2); + return build3 (COND_EXPR, + TREE_TYPE (decl), + TREE_OPERAND (decl, 0), d1, d2); } if (DECL_P (decl) @@ -1671,8 +1671,8 @@ build_new (tree placement, tree type, tree nelts, tree init, return error_mark_node; } - rval = build (NEW_EXPR, build_pointer_type (type), placement, type, - nelts, init); + rval = build4 (NEW_EXPR, build_pointer_type (type), placement, type, + nelts, init); NEW_EXPR_USE_GLOBAL (rval) = use_global_new; TREE_SIDE_EFFECTS (rval) = 1; rval = build_new_1 (rval); @@ -1976,8 +1976,8 @@ build_new_1 (tree exp) tree inits; stabilize_call (alloc_call, &inits); if (inits) - alloc_expr = build (COMPOUND_EXPR, TREE_TYPE (alloc_expr), inits, - alloc_expr); + alloc_expr = build2 (COMPOUND_EXPR, TREE_TYPE (alloc_expr), inits, + alloc_expr); } /* unless an allocation function is declared with an empty excep- @@ -1999,28 +1999,28 @@ build_new_1 (tree exp) tree cookie_ptr; /* Adjust so we're pointing to the start of the object. */ - data_addr = get_target_expr (build (PLUS_EXPR, full_pointer_type, - alloc_node, cookie_size)); + data_addr = get_target_expr (build2 (PLUS_EXPR, full_pointer_type, + alloc_node, cookie_size)); /* Store the number of bytes allocated so that we can know how many elements to destroy later. We use the last sizeof (size_t) bytes to store the number of elements. */ - cookie_ptr = build (MINUS_EXPR, build_pointer_type (sizetype), - data_addr, size_in_bytes (sizetype)); + cookie_ptr = build2 (MINUS_EXPR, build_pointer_type (sizetype), + data_addr, size_in_bytes (sizetype)); cookie = build_indirect_ref (cookie_ptr, NULL); - cookie_expr = build (MODIFY_EXPR, sizetype, cookie, nelts); + cookie_expr = build2 (MODIFY_EXPR, sizetype, cookie, nelts); if (targetm.cxx.cookie_has_size ()) { /* Also store the element size. */ - cookie_ptr = build (MINUS_EXPR, build_pointer_type (sizetype), - cookie_ptr, size_in_bytes (sizetype)); + cookie_ptr = build2 (MINUS_EXPR, build_pointer_type (sizetype), + cookie_ptr, size_in_bytes (sizetype)); cookie = build_indirect_ref (cookie_ptr, NULL); - cookie = build (MODIFY_EXPR, sizetype, cookie, - size_in_bytes(true_type)); - cookie_expr = build (COMPOUND_EXPR, TREE_TYPE (cookie_expr), - cookie, cookie_expr); + cookie = build2 (MODIFY_EXPR, sizetype, cookie, + size_in_bytes(true_type)); + cookie_expr = build2 (COMPOUND_EXPR, TREE_TYPE (cookie_expr), + cookie, cookie_expr); } data_addr = TARGET_EXPR_SLOT (data_addr); } @@ -2112,8 +2112,8 @@ build_new_1 (tree exp) else if (stable) /* This is much simpler if we were able to preevaluate all of the arguments to the constructor call. */ - init_expr = build (TRY_CATCH_EXPR, void_type_node, - init_expr, cleanup); + init_expr = build2 (TRY_CATCH_EXPR, void_type_node, + init_expr, cleanup); else /* Ack! First we allocate the memory. Then we set our sentry variable to true, and expand a cleanup that deletes the @@ -2134,16 +2134,16 @@ build_new_1 (tree exp) sentry = TARGET_EXPR_SLOT (begin); TARGET_EXPR_CLEANUP (begin) - = build (COND_EXPR, void_type_node, sentry, - cleanup, void_zero_node); + = build3 (COND_EXPR, void_type_node, sentry, + cleanup, void_zero_node); - end = build (MODIFY_EXPR, TREE_TYPE (sentry), - sentry, boolean_false_node); + end = build2 (MODIFY_EXPR, TREE_TYPE (sentry), + sentry, boolean_false_node); init_expr - = build (COMPOUND_EXPR, void_type_node, begin, - build (COMPOUND_EXPR, void_type_node, init_expr, - end)); + = build2 (COMPOUND_EXPR, void_type_node, begin, + build2 (COMPOUND_EXPR, void_type_node, init_expr, + end)); } } @@ -2156,9 +2156,9 @@ build_new_1 (tree exp) rval = data_addr; if (init_expr) - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_expr, rval); + rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), init_expr, rval); if (cookie_expr) - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval); + rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval); if (rval == alloc_node) /* If we don't have an initializer or a cookie, strip the TARGET_EXPR @@ -2175,11 +2175,11 @@ build_new_1 (tree exp) /* Perform the allocation before anything else, so that ALLOC_NODE has been initialized before we start using it. */ - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval); + rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval); } if (init_preeval_expr) - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_preeval_expr, rval); + rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), init_preeval_expr, rval); /* Convert to the final type. */ rval = build_nop (pointer_type, rval); @@ -2231,23 +2231,24 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, tbase = create_temporary_var (ptype); tbase_init = build_modify_expr (tbase, NOP_EXPR, - fold (build (PLUS_EXPR, ptype, - base, - virtual_size))); + fold (build2 (PLUS_EXPR, ptype, + base, + virtual_size))); DECL_REGISTER (tbase) = 1; - controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE); + controller = build3 (BIND_EXPR, void_type_node, tbase, + NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (controller) = 1; - body = build (EXIT_EXPR, void_type_node, - build (EQ_EXPR, boolean_type_node, base, tbase)); + body = build1 (EXIT_EXPR, void_type_node, + build2 (EQ_EXPR, boolean_type_node, base, tbase)); body = build_compound_expr (body, build_modify_expr (tbase, NOP_EXPR, - build (MINUS_EXPR, ptype, tbase, size_exp))); + build2 (MINUS_EXPR, ptype, tbase, size_exp))); body = build_compound_expr (body, build_delete (ptype, tbase, sfk_complete_destructor, LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1)); - loop = build (LOOP_EXPR, void_type_node, body); + loop = build1 (LOOP_EXPR, void_type_node, body); loop = build_compound_expr (tbase_init, loop); no_destructor: @@ -2297,11 +2298,11 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, body = integer_zero_node; /* Outermost wrapper: If pointer is null, punt. */ - body = fold (build (COND_EXPR, void_type_node, - fold (build (NE_EXPR, boolean_type_node, base, - convert (TREE_TYPE (base), - integer_zero_node))), - body, integer_zero_node)); + body = fold (build3 (COND_EXPR, void_type_node, + fold (build2 (NE_EXPR, boolean_type_node, base, + convert (TREE_TYPE (base), + integer_zero_node))), + body, integer_zero_node)); body = build1 (NOP_EXPR, void_type_node, body); if (controller) @@ -2312,7 +2313,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, if (TREE_CODE (base) == SAVE_EXPR) /* Pre-evaluate the SAVE_EXPR outside of the BIND_EXPR. */ - body = build (COMPOUND_EXPR, void_type_node, base, body); + body = build2 (COMPOUND_EXPR, void_type_node, base, body); return convert_to_void (body, /*implicit=*/NULL); } @@ -2412,7 +2413,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array) brace-enclosed initializers. In this case, digest_init and store_constructor will handle the semantics for us. */ - stmt_expr = build (INIT_EXPR, atype, base, init); + stmt_expr = build2 (INIT_EXPR, atype, base, init); return stmt_expr; } @@ -2538,8 +2539,8 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array) for_stmt = begin_for_stmt (); finish_for_init_stmt (for_stmt); - finish_for_cond (build (NE_EXPR, boolean_type_node, - iterator, integer_minus_one_node), + finish_for_cond (build2 (NE_EXPR, boolean_type_node, + iterator, integer_minus_one_node), for_stmt); finish_for_expr (build_unary_op (PREDECREMENT_EXPR, iterator, 0), for_stmt); @@ -2828,7 +2829,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, expr = build_dtor_call (build_indirect_ref (addr, NULL), auto_delete, flags); if (do_delete) - expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete); + expr = build2 (COMPOUND_EXPR, void_type_node, expr, do_delete); if (flags & LOOKUP_DESTRUCTOR) /* Explicit destructor call; don't check for null pointer. */ @@ -2838,8 +2839,8 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, ifexp = fold (cp_build_binary_op (NE_EXPR, addr, integer_zero_node)); if (ifexp != integer_one_node) - expr = build (COND_EXPR, void_type_node, - ifexp, expr, void_zero_node); + expr = build3 (COND_EXPR, void_type_node, + ifexp, expr, void_zero_node); return expr; } @@ -2863,9 +2864,9 @@ push_base_cleanups (void) if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) { tree cond = (condition_conversion - (build (BIT_AND_EXPR, integer_type_node, - current_in_charge_parm, - integer_two_node))); + (build2 (BIT_AND_EXPR, integer_type_node, + current_in_charge_parm, + integer_two_node))); /* The CLASSTYPE_VBASECLASSES vector is in initialization order, which is also the right order for pushing cleanups. */ @@ -2880,8 +2881,8 @@ push_base_cleanups (void) base_binfo, (LOOKUP_NORMAL | LOOKUP_NONVIRTUAL)); - expr = build (COND_EXPR, void_type_node, cond, - expr, void_zero_node); + expr = build3 (COND_EXPR, void_type_node, cond, + expr, void_zero_node); finish_decl_cleanup (NULL_TREE, expr); } } @@ -2988,10 +2989,10 @@ build_vec_delete (tree base, tree maxindex, base = TARGET_EXPR_SLOT (base_init); } type = strip_array_types (TREE_TYPE (type)); - cookie_addr = build (MINUS_EXPR, - build_pointer_type (sizetype), - base, - TYPE_SIZE_UNIT (sizetype)); + cookie_addr = build2 (MINUS_EXPR, + build_pointer_type (sizetype), + base, + TYPE_SIZE_UNIT (sizetype)); maxindex = build_indirect_ref (cookie_addr, NULL); } else if (TREE_CODE (type) == ARRAY_TYPE) @@ -3017,7 +3018,7 @@ build_vec_delete (tree base, tree maxindex, rval = build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete); if (base_init) - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), base_init, rval); + rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), base_init, rval); return rval; } diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 4235e35..b8feaffc 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1194,14 +1194,14 @@ write_integer_cst (const tree cst) } do { - tree d = fold (build (FLOOR_DIV_EXPR, type, n, base)); - tree tmp = fold (build (MULT_EXPR, type, d, base)); + tree d = fold (build2 (FLOOR_DIV_EXPR, type, n, base)); + tree tmp = fold (build2 (MULT_EXPR, type, d, base)); unsigned c; done = integer_zerop (d); - tmp = fold (build (MINUS_EXPR, type, n, tmp)); + tmp = fold (build2 (MINUS_EXPR, type, n, tmp)); c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr, - done ? 1 : chunk_digits); + done ? 1 : chunk_digits); ptr -= c; count += c; n = d; diff --git a/gcc/cp/method.c b/gcc/cp/method.c index eb4b64a..13fe0a4 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -224,8 +224,8 @@ thunk_adjust (tree ptr, bool this_adjusting, { if (this_adjusting) /* Adjust the pointer by the constant. */ - ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr, - ssize_int (fixed_offset))); + ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, + ssize_int (fixed_offset))); /* If there's a virtual offset, look up that value in the vtable and adjust the pointer again. */ @@ -242,17 +242,17 @@ thunk_adjust (tree ptr, bool this_adjusting, /* Form the vtable address. */ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); /* Find the entry with the vcall offset. */ - vtable = build (PLUS_EXPR, TREE_TYPE (vtable), vtable, virtual_offset); + vtable = build2 (PLUS_EXPR, TREE_TYPE (vtable), vtable, virtual_offset); /* Get the offset itself. */ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); /* Adjust the `this' pointer. */ - ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable)); + ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable)); } if (!this_adjusting) /* Adjust the pointer by the constant. */ - ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr, - ssize_int (fixed_offset))); + ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, + ssize_int (fixed_offset))); return ptr; } @@ -511,7 +511,7 @@ do_build_copy_constructor (tree fndecl) if *this is a base subobject. */; else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)) { - t = build (INIT_EXPR, void_type_node, current_class_ref, parm); + t = build2 (INIT_EXPR, void_type_node, current_class_ref, parm); finish_expr_stmt (t); } else @@ -584,7 +584,7 @@ do_build_copy_constructor (tree fndecl) expr_type = TREE_TYPE (field); if (TREE_CODE (expr_type) != REFERENCE_TYPE) expr_type = cp_build_qualified_type (expr_type, cvquals); - init = build (COMPONENT_REF, expr_type, init, field, NULL_TREE); + init = build3 (COMPONENT_REF, expr_type, init, field, NULL_TREE); init = build_tree_list (NULL_TREE, init); member_init_list @@ -609,7 +609,7 @@ do_build_assign_ref (tree fndecl) if *this is a base subobject. */; else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)) { - tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm); + tree t = build2 (MODIFY_EXPR, void_type_node, current_class_ref, parm); finish_expr_stmt (t); } else @@ -676,17 +676,17 @@ do_build_assign_ref (tree fndecl) else continue; - comp = build (COMPONENT_REF, TREE_TYPE (field), comp, field, - NULL_TREE); - init = build (COMPONENT_REF, - cp_build_qualified_type (TREE_TYPE (field), cvquals), - init, field, NULL_TREE); + comp = build3 (COMPONENT_REF, TREE_TYPE (field), comp, field, + NULL_TREE); + init = build3 (COMPONENT_REF, + cp_build_qualified_type (TREE_TYPE (field), cvquals), + init, field, NULL_TREE); if (DECL_NAME (field)) finish_expr_stmt (build_modify_expr (comp, NOP_EXPR, init)); else - finish_expr_stmt (build (MODIFY_EXPR, TREE_TYPE (comp), comp, - init)); + finish_expr_stmt (build2 (MODIFY_EXPR, TREE_TYPE (comp), comp, + init)); } } finish_return_stmt (current_class_ref); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 516488f..4590bd7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4147,10 +4147,10 @@ lookup_template_function (tree fns, tree arglist) if (BASELINK_P (fns)) { - BASELINK_FUNCTIONS (fns) = build (TEMPLATE_ID_EXPR, - unknown_type_node, - BASELINK_FUNCTIONS (fns), - arglist); + BASELINK_FUNCTIONS (fns) = build2 (TEMPLATE_ID_EXPR, + unknown_type_node, + BASELINK_FUNCTIONS (fns), + arglist); return fns; } @@ -4158,7 +4158,7 @@ lookup_template_function (tree fns, tree arglist) if (TREE_CODE (fns) == OVERLOAD || !type) type = unknown_type_node; - return build (TEMPLATE_ID_EXPR, type, fns, arglist); + return build2 (TEMPLATE_ID_EXPR, type, fns, arglist); } /* Within the scope of a template class S, the name S gets bound @@ -7161,7 +7161,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) if (e1 == error_mark_node || e2 == error_mark_node) return error_mark_node; - return fold (build (TREE_CODE (t), TREE_TYPE (t), e1, e2)); + return fold (build2 (TREE_CODE (t), TREE_TYPE (t), e1, e2)); } case NEGATE_EXPR: @@ -7171,7 +7171,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) if (e == error_mark_node) return error_mark_node; - return fold (build (TREE_CODE (t), TREE_TYPE (t), e)); + return fold (build1 (TREE_CODE (t), TREE_TYPE (t), e)); } case TYPENAME_TYPE: @@ -8175,8 +8175,8 @@ tsubst_copy_and_build (tree t, template = lookup_template_function (template, targs); if (object) - return build (COMPONENT_REF, TREE_TYPE (template), - object, template, NULL_TREE); + return build3 (COMPONENT_REF, TREE_TYPE (template), + object, template, NULL_TREE); else return template; } @@ -10093,7 +10093,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) t1 = TREE_OPERAND (parm, 0); t2 = TREE_OPERAND (parm, 1); - t = fold (build (PLUS_EXPR, integer_type_node, arg, t2)); + t = fold (build2 (PLUS_EXPR, integer_type_node, arg, t2)); return unify (tparms, targs, t1, t, strict); } @@ -12173,19 +12173,19 @@ build_non_dependent_expr (tree expr) return expr; if (TREE_CODE (expr) == COND_EXPR) - return build (COND_EXPR, - TREE_TYPE (expr), - TREE_OPERAND (expr, 0), - (TREE_OPERAND (expr, 1) - ? build_non_dependent_expr (TREE_OPERAND (expr, 1)) - : build_non_dependent_expr (TREE_OPERAND (expr, 0))), - build_non_dependent_expr (TREE_OPERAND (expr, 2))); + return build3 (COND_EXPR, + TREE_TYPE (expr), + TREE_OPERAND (expr, 0), + (TREE_OPERAND (expr, 1) + ? build_non_dependent_expr (TREE_OPERAND (expr, 1)) + : build_non_dependent_expr (TREE_OPERAND (expr, 0))), + build_non_dependent_expr (TREE_OPERAND (expr, 2))); if (TREE_CODE (expr) == COMPOUND_EXPR && !COMPOUND_EXPR_OVERLOADED (expr)) - return build (COMPOUND_EXPR, - TREE_TYPE (expr), - TREE_OPERAND (expr, 0), - build_non_dependent_expr (TREE_OPERAND (expr, 1))); + return build2 (COMPOUND_EXPR, + TREE_TYPE (expr), + TREE_OPERAND (expr, 0), + build_non_dependent_expr (TREE_OPERAND (expr, 1))); /* Otherwise, build a NON_DEPENDENT_EXPR. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 38ac418..6e9a6ea 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -157,8 +157,8 @@ build_headof (tree exp) type = build_qualified_type (ptr_type_node, cp_type_quals (TREE_TYPE (exp))); - return build (PLUS_EXPR, type, exp, - convert_to_integer (ptrdiff_type_node, offset)); + return build2 (PLUS_EXPR, type, exp, + convert_to_integer (ptrdiff_type_node, offset)); } /* Get a bad_cast node for the program to throw... @@ -290,7 +290,7 @@ build_typeid (tree exp) { tree bad = throw_bad_typeid (); - exp = build (COND_EXPR, TREE_TYPE (exp), cond, exp, bad); + exp = build3 (COND_EXPR, TREE_TYPE (exp), cond, exp, bad); } return exp; @@ -419,10 +419,10 @@ get_typeid (tree type) static tree ifnonnull (tree test, tree result) { - return build (COND_EXPR, TREE_TYPE (result), - build (EQ_EXPR, boolean_type_node, test, integer_zero_node), - cp_convert (TREE_TYPE (result), integer_zero_node), - result); + return build3 (COND_EXPR, TREE_TYPE (result), + build2 (EQ_EXPR, boolean_type_node, test, integer_zero_node), + cp_convert (TREE_TYPE (result), integer_zero_node), + result); } /* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working @@ -655,7 +655,7 @@ build_dynamic_cast_1 (tree type, tree expr) tree bad = throw_bad_cast (); result = save_expr (result); - return build (COND_EXPR, type, result, result, bad); + return build3 (COND_EXPR, type, result, result, bad); } /* Now back to the type we want from a void*. */ @@ -827,7 +827,7 @@ tinfo_base_init (tree desc, tree target) vtable_ptr = build_unary_op (ADDR_EXPR, vtable_ptr, 0); /* We need to point into the middle of the vtable. */ - vtable_ptr = build + vtable_ptr = build2 (PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr, size_binop (MULT_EXPR, size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE), diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index cf61c22..393020f 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1069,7 +1069,7 @@ begin_compound_stmt (unsigned int flags) processing templates. */ if (processing_template_decl) { - r = build (BIND_EXPR, NULL, NULL, r, NULL); + r = build3 (BIND_EXPR, NULL, NULL, r, NULL); BIND_EXPR_TRY_BLOCK (r) = (flags & BCS_TRY_BLOCK) != 0; BIND_EXPR_BODY_BLOCK (r) = (flags & BCS_FN_BODY) != 0; TREE_SIDE_EFFECTS (r) = 1; @@ -1799,8 +1799,8 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) if (processing_template_decl) { - result = build (CALL_EXPR, TREE_TYPE (result), orig_fn, - orig_args, NULL_TREE); + result = build3 (CALL_EXPR, TREE_TYPE (result), orig_fn, + orig_args, NULL_TREE); KOENIG_LOOKUP_P (result) = koenig_p; } return result; @@ -1887,7 +1887,7 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor) } } - return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope, destructor); + return build3 (PSEUDO_DTOR_EXPR, void_type_node, object, scope, destructor); } /* Finish an expression of the form CODE EXPR. */ @@ -2540,8 +2540,8 @@ finish_id_expression (tree id_expression, if (TYPE_P (scope) && dependent_type_p (scope)) return build_nt (SCOPE_REF, scope, id_expression); else if (TYPE_P (scope) && DECL_P (decl)) - return build (SCOPE_REF, TREE_TYPE (decl), scope, - id_expression); + return build2 (SCOPE_REF, TREE_TYPE (decl), scope, + id_expression); else return decl; } @@ -2617,7 +2617,7 @@ finish_id_expression (tree id_expression, else if (!processing_template_decl) decl = convert_from_reference (decl); else if (TYPE_P (scope)) - decl = build (SCOPE_REF, TREE_TYPE (decl), scope, decl); + decl = build2 (SCOPE_REF, TREE_TYPE (decl), scope, decl); } else if (TREE_CODE (decl) == FIELD_DECL) decl = finish_non_static_data_member (decl, current_class_ref, @@ -2797,9 +2797,9 @@ simplify_aggr_init_expr (tree *tp) args = tree_cons (NULL_TREE, addr, args); } - call_expr = build (CALL_EXPR, - TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), - fn, args, NULL_TREE); + call_expr = build3 (CALL_EXPR, + TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), + fn, args, NULL_TREE); if (style == arg) /* Tell the backend that we've added our return slot to the argument @@ -3017,8 +3017,8 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) if (DECL_INITIAL (dp->var) && DECL_INITIAL (dp->var) != error_mark_node) { - init = build (INIT_EXPR, void_type_node, dp->result, - DECL_INITIAL (dp->var)); + init = build2 (INIT_EXPR, void_type_node, dp->result, + DECL_INITIAL (dp->var)); DECL_INITIAL (dp->var) = error_mark_node; } else diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 39f6557..aede4a6 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -234,8 +234,8 @@ build_target_expr (tree decl, tree value) { tree t; - t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value, - cxx_maybe_build_cleanup (decl), NULL_TREE); + t = build4 (TARGET_EXPR, TREE_TYPE (decl), decl, value, + cxx_maybe_build_cleanup (decl), NULL_TREE); /* We always set TREE_SIDE_EFFECTS so that expand_expr does not ignore the TARGET_EXPR. If there really turn out to be no side-effects, then the optimizer should be able to get rid of @@ -300,8 +300,8 @@ build_cplus_new (tree type, tree init) type, don't mess with AGGR_INIT_EXPR. */ if (is_ctor || TREE_ADDRESSABLE (type)) { - rval = build (AGGR_INIT_EXPR, void_type_node, fn, - TREE_OPERAND (init, 1), slot); + rval = build3 (AGGR_INIT_EXPR, void_type_node, fn, + TREE_OPERAND (init, 1), slot); TREE_SIDE_EFFECTS (rval) = 1; AGGR_INIT_VIA_CTOR_P (rval) = is_ctor; } @@ -1154,9 +1154,9 @@ cxx_print_statistics (void) tree array_type_nelts_top (tree type) { - return fold (build (PLUS_EXPR, sizetype, - array_type_nelts (type), - integer_one_node)); + return fold (build2 (PLUS_EXPR, sizetype, + array_type_nelts (type), + integer_one_node)); } /* Return, as an INTEGER_CST node, the number of elements for TYPE @@ -1171,7 +1171,7 @@ array_type_nelts_total (tree type) while (TREE_CODE (type) == ARRAY_TYPE) { tree n = array_type_nelts_top (type); - sz = fold (build (MULT_EXPR, sizetype, sz, n)); + sz = fold (build2 (MULT_EXPR, sizetype, sz, n)); type = TREE_TYPE (type); } return sz; @@ -2403,7 +2403,7 @@ stabilize_call (tree call, tree *initp) if (!init) /* Nothing. */; else if (inits) - inits = build (COMPOUND_EXPR, void_type_node, inits, init); + inits = build2 (COMPOUND_EXPR, void_type_node, inits, init); else inits = init; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index bc458ca..01b969e 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1385,8 +1385,8 @@ decay_conversion (tree exp) if (TREE_CODE (exp) == COMPOUND_EXPR) { tree op1 = decay_conversion (TREE_OPERAND (exp, 1)); - return build (COMPOUND_EXPR, TREE_TYPE (op1), - TREE_OPERAND (exp, 0), op1); + return build2 (COMPOUND_EXPR, TREE_TYPE (op1), + TREE_OPERAND (exp, 0), op1); } if (!lvalue_p (exp) @@ -1658,7 +1658,7 @@ build_class_member_access_expr (tree object, tree member, result = member; /* If OBJECT has side-effects, they are supposed to occur. */ if (TREE_SIDE_EFFECTS (object)) - result = build (COMPOUND_EXPR, TREE_TYPE (result), object, result); + result = build2 (COMPOUND_EXPR, TREE_TYPE (result), object, result); } else if (TREE_CODE (member) == FIELD_DECL) { @@ -1755,8 +1755,8 @@ build_class_member_access_expr (tree object, tree member, member_type = cp_build_qualified_type (member_type, type_quals); } - result = fold (build (COMPONENT_REF, member_type, object, member, - NULL_TREE)); + result = fold (build3 (COMPONENT_REF, member_type, object, member, + NULL_TREE)); /* Mark the expression const or volatile, as appropriate. Even though we've dealt with the type above, we still have to mark the @@ -1783,7 +1783,7 @@ build_class_member_access_expr (tree object, tree member, type = unknown_type_node; /* Note that we do not convert OBJECT to the BASELINK_BINFO base. That will happen when the function is called. */ - result = build (COMPONENT_REF, type, object, member, NULL_TREE); + result = build3 (COMPONENT_REF, type, object, member, NULL_TREE); } else if (TREE_CODE (member) == CONST_DECL) { @@ -1791,8 +1791,8 @@ build_class_member_access_expr (tree object, tree member, result = member; /* If OBJECT has side-effects, they are supposed to occur. */ if (TREE_SIDE_EFFECTS (object)) - result = build (COMPOUND_EXPR, TREE_TYPE (result), - object, result); + result = build2 (COMPOUND_EXPR, TREE_TYPE (result), + object, result); } else { @@ -1833,8 +1833,8 @@ lookup_destructor (tree object, tree scope, tree dtor_name) return error_mark_node; } if (!TYPE_HAS_DESTRUCTOR (dtor_type)) - return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope, - dtor_type); + return build3 (PSEUDO_DTOR_EXPR, void_type_node, object, scope, + dtor_type); expr = lookup_member (dtor_type, complete_dtor_identifier, /*protect=*/1, /*want_type=*/false); expr = (adjust_result_of_qualified_name_lookup @@ -2037,7 +2037,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name) /*want_type=*/false); member_type = cp_build_qualified_type (TREE_TYPE (member), cp_type_quals (ptrmem_type)); - return fold (build (COMPONENT_REF, member_type, ptrmem, member, NULL_TREE)); + return fold (build3 (COMPONENT_REF, member_type, + ptrmem, member, NULL_TREE)); } /* Given an expression PTR for a pointer, return an expression @@ -2171,8 +2172,8 @@ build_array_ref (tree array, tree idx) case COMPOUND_EXPR: { tree value = build_array_ref (TREE_OPERAND (array, 1), idx); - return build (COMPOUND_EXPR, TREE_TYPE (value), - TREE_OPERAND (array, 0), value); + return build2 (COMPOUND_EXPR, TREE_TYPE (value), + TREE_OPERAND (array, 0), value); } case COND_EXPR: @@ -2253,7 +2254,7 @@ build_array_ref (tree array, tree idx) } type = TREE_TYPE (TREE_TYPE (array)); - rval = build (ARRAY_REF, type, array, idx, NULL_TREE, NULL_TREE); + rval = build4 (ARRAY_REF, type, array, idx, NULL_TREE, NULL_TREE); /* Array ref is const/volatile if the array elements are or if the array is.. */ TREE_READONLY (rval) @@ -2372,8 +2373,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) if (instance_ptr == error_mark_node) return error_mark_node; /* ...and then the delta in the PMF. */ - instance_ptr = build (PLUS_EXPR, TREE_TYPE (instance_ptr), - instance_ptr, delta); + instance_ptr = build2 (PLUS_EXPR, TREE_TYPE (instance_ptr), + instance_ptr, delta); /* Hand back the adjusted 'this' argument to our caller. */ *instance_ptrptr = instance_ptr; @@ -2384,7 +2385,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) vtbl = build_indirect_ref (vtbl, NULL); /* Finally, extract the function pointer from the vtable. */ - e2 = fold (build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx)); + e2 = fold (build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx)); e2 = build_indirect_ref (e2, NULL); TREE_CONSTANT (e2) = 1; TREE_INVARIANT (e2) = 1; @@ -2401,8 +2402,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) /* Make sure this doesn't get evaluated first inside one of the branches of the COND_EXPR. */ if (instance_save_expr) - e1 = build (COMPOUND_EXPR, TREE_TYPE (e1), - instance_save_expr, e1); + e1 = build2 (COMPOUND_EXPR, TREE_TYPE (e1), + instance_save_expr, e1); function = e1; } @@ -3082,7 +3083,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, cp_convert (TREE_TYPE (pfn0), integer_zero_node)); e1 = cp_build_binary_op (TRUTH_ORIF_EXPR, e1, e2); - e2 = build (EQ_EXPR, boolean_type_node, pfn0, pfn1); + e2 = build2 (EQ_EXPR, boolean_type_node, pfn0, pfn1); e = cp_build_binary_op (TRUTH_ANDIF_EXPR, e2, e1); if (code == EQ_EXPR) return e; @@ -3451,7 +3452,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, build_type = result_type; { - tree result = fold (build (resultcode, build_type, op0, op1)); + tree result = fold (build2 (resultcode, build_type, op0, op1)); if (final_type != 0) result = cp_convert (final_type, result); return result; @@ -3516,7 +3517,7 @@ pointer_diff (tree op0, tree op1, tree ptrtype) /* Do the division. */ - result = build (EXACT_DIV_EXPR, restype, op0, cp_convert (restype, op1)); + result = build2 (EXACT_DIV_EXPR, restype, op0, cp_convert (restype, op1)); return fold (result); } @@ -3605,9 +3606,9 @@ build_x_unary_op (enum tree_code code, tree xarg) { /* A single non-static member, make sure we don't allow a pointer-to-member. */ - xarg = build (OFFSET_REF, TREE_TYPE (xarg), - TREE_OPERAND (xarg, 0), - ovl_cons (TREE_OPERAND (xarg, 1), NULL_TREE)); + xarg = build2 (OFFSET_REF, TREE_TYPE (xarg), + TREE_OPERAND (xarg, 0), + ovl_cons (TREE_OPERAND (xarg, 1), NULL_TREE)); PTRMEM_OK_P (xarg) = ptrmem; } } @@ -3799,8 +3800,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) arg = stabilize_reference (arg); real = build_unary_op (REALPART_EXPR, arg, 1); imag = build_unary_op (IMAGPART_EXPR, arg, 1); - return build (COMPLEX_EXPR, TREE_TYPE (arg), - build_unary_op (code, real, 1), imag); + return build2 (COMPLEX_EXPR, TREE_TYPE (arg), + build_unary_op (code, real, 1), imag); } /* Report invalid types. */ @@ -3885,13 +3886,14 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) value = arg; else value = save_expr (arg); - incremented = build (((code == PREINCREMENT_EXPR - || code == POSTINCREMENT_EXPR) - ? PLUS_EXPR : MINUS_EXPR), - argtype, value, inc); + incremented = build2 (((code == PREINCREMENT_EXPR + || code == POSTINCREMENT_EXPR) + ? PLUS_EXPR : MINUS_EXPR), + argtype, value, inc); modify = build_modify_expr (arg, NOP_EXPR, incremented); - compound = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value); + compound = build2 (COMPOUND_EXPR, TREE_TYPE (arg), + modify, value); /* Eliminate warning about unused result of + or -. */ TREE_NO_WARNING (compound) = 1; @@ -3919,7 +3921,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) val = boolean_increment (code, arg); } else - val = build (code, TREE_TYPE (arg), arg, inc); + val = build2 (code, TREE_TYPE (arg), arg, inc); TREE_SIDE_EFFECTS (val) = 1; return cp_convert (result_type, val); @@ -4096,8 +4098,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) addr = build_address (fn); if (TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0))) /* Do not lose object's side effects. */ - addr = build (COMPOUND_EXPR, TREE_TYPE (addr), - TREE_OPERAND (arg, 0), addr); + addr = build2 (COMPOUND_EXPR, TREE_TYPE (addr), + TREE_OPERAND (arg, 0), addr); } else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1))) { @@ -4118,8 +4120,9 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) rval = build_base_path (PLUS_EXPR, rval, binfo, 1); rval = build_nop (argtype, rval); - addr = fold (build (PLUS_EXPR, argtype, rval, - cp_convert (argtype, byte_position (field)))); + addr = fold (build2 (PLUS_EXPR, argtype, rval, + cp_convert (argtype, + byte_position (field)))); } if (TREE_CODE (argtype) == POINTER_TYPE @@ -4160,8 +4163,8 @@ unary_complex_lvalue (enum tree_code code, tree arg) if (TREE_CODE (arg) == COMPOUND_EXPR) { tree real_result = build_unary_op (code, TREE_OPERAND (arg, 1), 0); - return build (COMPOUND_EXPR, TREE_TYPE (real_result), - TREE_OPERAND (arg, 0), real_result); + return build2 (COMPOUND_EXPR, TREE_TYPE (real_result), + TREE_OPERAND (arg, 0), real_result); } /* Handle (a ? b : c) used as an "lvalue". */ @@ -4178,11 +4181,11 @@ unary_complex_lvalue (enum tree_code code, tree arg) if (TREE_SIDE_EFFECTS (lvalue)) { lvalue = stabilize_reference (lvalue); - arg = build (TREE_CODE (arg), TREE_TYPE (arg), - lvalue, TREE_OPERAND (arg, 1)); + arg = build2 (TREE_CODE (arg), TREE_TYPE (arg), + lvalue, TREE_OPERAND (arg, 1)); } return unary_complex_lvalue - (code, build (COMPOUND_EXPR, TREE_TYPE (lvalue), arg, lvalue)); + (code, build2 (COMPOUND_EXPR, TREE_TYPE (lvalue), arg, lvalue)); } if (code != ADDR_EXPR) @@ -4193,7 +4196,8 @@ unary_complex_lvalue (enum tree_code code, tree arg) || TREE_CODE (arg) == INIT_EXPR) { tree real_result = build_unary_op (code, TREE_OPERAND (arg, 0), 0); - arg = build (COMPOUND_EXPR, TREE_TYPE (real_result), arg, real_result); + arg = build2 (COMPOUND_EXPR, TREE_TYPE (real_result), + arg, real_result); TREE_NO_WARNING (arg) = 1; return arg; } @@ -4266,7 +4270,7 @@ unary_complex_lvalue (enum tree_code code, tree arg) } if (TREE_CODE (arg) == SAVE_EXPR && TREE_CODE (targ) == INDIRECT_REF) - return build (SAVE_EXPR, build_pointer_type (TREE_TYPE (arg)), + return build3 (SAVE_EXPR, build_pointer_type (TREE_TYPE (arg)), TREE_OPERAND (targ, 0), current_function_decl, NULL); } @@ -4440,13 +4444,13 @@ build_compound_expr (tree lhs, tree rhs) helps the compiler to eliminate unnecessary temporaries. */ tree init = TREE_OPERAND (rhs, 1); - init = build (COMPOUND_EXPR, TREE_TYPE (init), lhs, init); + init = build2 (COMPOUND_EXPR, TREE_TYPE (init), lhs, init); TREE_OPERAND (rhs, 1) = init; return rhs; } - return build (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs); + return build2 (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs); } /* Issue an error message if casting from SRC_TYPE to DEST_TYPE casts @@ -5013,13 +5017,13 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) case PREDECREMENT_EXPR: case PREINCREMENT_EXPR: if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) - lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs), - stabilize_reference (TREE_OPERAND (lhs, 0)), - TREE_OPERAND (lhs, 1)); - return build (COMPOUND_EXPR, lhstype, - lhs, - build_modify_expr (TREE_OPERAND (lhs, 0), - modifycode, rhs)); + lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), + stabilize_reference (TREE_OPERAND (lhs, 0)), + TREE_OPERAND (lhs, 1)); + return build2 (COMPOUND_EXPR, lhstype, + lhs, + build_modify_expr (TREE_OPERAND (lhs, 0), + modifycode, rhs)); /* Handle (a, b) used as an "lvalue". */ case COMPOUND_EXPR: @@ -5027,18 +5031,18 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) modifycode, rhs); if (newrhs == error_mark_node) return error_mark_node; - return build (COMPOUND_EXPR, lhstype, - TREE_OPERAND (lhs, 0), newrhs); + return build2 (COMPOUND_EXPR, lhstype, + TREE_OPERAND (lhs, 0), newrhs); case MODIFY_EXPR: if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) - lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs), - stabilize_reference (TREE_OPERAND (lhs, 0)), - TREE_OPERAND (lhs, 1)); + lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), + stabilize_reference (TREE_OPERAND (lhs, 0)), + TREE_OPERAND (lhs, 1)); newrhs = build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs); if (newrhs == error_mark_node) return error_mark_node; - return build (COMPOUND_EXPR, lhstype, lhs, newrhs); + return build2 (COMPOUND_EXPR, lhstype, lhs, newrhs); /* Handle (a ? b : c) used as an "lvalue". */ case COND_EXPR: @@ -5070,7 +5074,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) /* Make sure the code to compute the rhs comes out before the split. */ if (preeval) - cond = build (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond); + cond = build2 (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond); return cond; } @@ -5085,7 +5089,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) if (! same_type_p (TREE_TYPE (rhs), lhstype)) /* Call convert to generate an error; see PR 11063. */ rhs = convert (lhstype, rhs); - result = build (INIT_EXPR, lhstype, lhs, rhs); + result = build2 (INIT_EXPR, lhstype, lhs, rhs); TREE_SIDE_EFFECTS (result) = 1; return result; } @@ -5249,15 +5253,15 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) accidental self-initialization. So we force the TARGET_EXPR to be expanded without a target. */ if (TREE_CODE (newrhs) == TARGET_EXPR) - newrhs = build (COMPOUND_EXPR, TREE_TYPE (newrhs), newrhs, - TREE_OPERAND (newrhs, 0)); + newrhs = build2 (COMPOUND_EXPR, TREE_TYPE (newrhs), newrhs, + TREE_OPERAND (newrhs, 0)); } if (newrhs == error_mark_node) return error_mark_node; - result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR, - lhstype, lhs, newrhs); + result = build2 (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR, + lhstype, lhs, newrhs); TREE_SIDE_EFFECTS (result) = 1; if (!plain_assign) @@ -5272,7 +5276,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) return result; if (olhs) { - result = build (COMPOUND_EXPR, olhstype, result, olhs); + result = build2 (COMPOUND_EXPR, olhstype, result, olhs); TREE_NO_WARNING (result) = 1; return result; } @@ -5524,28 +5528,28 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn) fn; the call will do the opposite adjustment. */ tree orig_class = DECL_CONTEXT (fn); tree binfo = binfo_or_else (orig_class, fn_class); - *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta), - *delta, BINFO_OFFSET (binfo))); + *delta = fold (build2 (PLUS_EXPR, TREE_TYPE (*delta), + *delta, BINFO_OFFSET (binfo))); /* We set PFN to the vtable offset at which the function can be found, plus one (unless ptrmemfunc_vbit_in_delta, in which case delta is shifted left, and then incremented). */ *pfn = DECL_VINDEX (fn); - *pfn = fold (build (MULT_EXPR, integer_type_node, *pfn, - TYPE_SIZE_UNIT (vtable_entry_type))); + *pfn = fold (build2 (MULT_EXPR, integer_type_node, *pfn, + TYPE_SIZE_UNIT (vtable_entry_type))); switch (TARGET_PTRMEMFUNC_VBIT_LOCATION) { case ptrmemfunc_vbit_in_pfn: - *pfn = fold (build (PLUS_EXPR, integer_type_node, *pfn, - integer_one_node)); + *pfn = fold (build2 (PLUS_EXPR, integer_type_node, *pfn, + integer_one_node)); break; case ptrmemfunc_vbit_in_delta: - *delta = fold (build (LSHIFT_EXPR, TREE_TYPE (*delta), - *delta, integer_one_node)); - *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta), - *delta, integer_one_node)); + *delta = fold (build2 (LSHIFT_EXPR, TREE_TYPE (*delta), + *delta, integer_one_node)); + *delta = fold (build2 (PLUS_EXPR, TREE_TYPE (*delta), + *delta, integer_one_node)); break; default: @@ -6055,15 +6059,15 @@ check_return_expr (tree retval) else if (! current_function_returns_struct && TREE_CODE (retval) == TARGET_EXPR && TREE_CODE (TREE_OPERAND (retval, 1)) == AGGR_INIT_EXPR) - retval = build (COMPOUND_EXPR, TREE_TYPE (retval), retval, - TREE_OPERAND (retval, 0)); + retval = build2 (COMPOUND_EXPR, TREE_TYPE (retval), retval, + TREE_OPERAND (retval, 0)); else maybe_warn_about_returning_address_of_local (retval); } /* Actually copy the value returned into the appropriate location. */ if (retval && retval != result) - retval = build (INIT_EXPR, TREE_TYPE (result), result, retval); + retval = build2 (INIT_EXPR, TREE_TYPE (result), result, retval); return retval; } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 87e05ef..f44474d 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -470,11 +470,11 @@ split_nonconstant_init_1 (tree dest, tree init) if (TREE_CODE (value) == CONSTRUCTOR) { if (array_type_p) - sub = build (ARRAY_REF, inner_type, dest, field_index, - NULL_TREE, NULL_TREE); + sub = build4 (ARRAY_REF, inner_type, dest, field_index, + NULL_TREE, NULL_TREE); else - sub = build (COMPONENT_REF, inner_type, dest, field_index, - NULL_TREE); + sub = build3 (COMPONENT_REF, inner_type, dest, field_index, + NULL_TREE); split_nonconstant_init_1 (sub, value); } @@ -483,13 +483,13 @@ split_nonconstant_init_1 (tree dest, tree init) *pelt = TREE_CHAIN (elt); if (array_type_p) - sub = build (ARRAY_REF, inner_type, dest, field_index, - NULL_TREE, NULL_TREE); + sub = build4 (ARRAY_REF, inner_type, dest, field_index, + NULL_TREE, NULL_TREE); else - sub = build (COMPONENT_REF, inner_type, dest, field_index, - NULL_TREE); + sub = build3 (COMPONENT_REF, inner_type, dest, field_index, + NULL_TREE); - code = build (MODIFY_EXPR, inner_type, sub, value); + code = build2 (MODIFY_EXPR, inner_type, sub, value); code = build_stmt (EXPR_STMT, code); add_stmt (code); continue; @@ -503,7 +503,7 @@ split_nonconstant_init_1 (tree dest, tree init) if (!initializer_constant_valid_p (init, type)) { CONSTRUCTOR_ELTS (init) = NULL; - code = build (MODIFY_EXPR, type, dest, init); + code = build2 (MODIFY_EXPR, type, dest, init); code = build_stmt (EXPR_STMT, code); add_stmt (code); } @@ -533,7 +533,7 @@ split_nonconstant_init (tree dest, tree init) TREE_READONLY (dest) = 0; } else - code = build (INIT_EXPR, TREE_TYPE (dest), dest, init); + code = build2 (INIT_EXPR, TREE_TYPE (dest), dest, init); return code; } @@ -609,7 +609,7 @@ store_init_value (tree decl, tree init) constructing never make it into DECL_INITIAL, and passes 'init' to build_aggr_init without checking DECL_INITIAL. So just return. */ else if (TYPE_NEEDS_CONSTRUCTING (type)) - return build (INIT_EXPR, type, decl, value); + return build2 (INIT_EXPR, type, decl, value); else if (TREE_STATIC (decl) && (! TREE_CONSTANT (value) || ! initializer_constant_valid_p (value, TREE_TYPE (value)))) @@ -1369,12 +1369,12 @@ build_m_component_ref (tree datum, tree component) /* Build an expression for "object + offset" where offset is the value stored in the pointer-to-data-member. */ - datum = build (PLUS_EXPR, build_pointer_type (type), - datum, build_nop (ptrdiff_type_node, component)); + datum = build2 (PLUS_EXPR, build_pointer_type (type), + datum, build_nop (ptrdiff_type_node, component)); return build_indirect_ref (datum, 0); } else - return build (OFFSET_REF, type, datum, component); + return build2 (OFFSET_REF, type, datum, component); } /* Return a tree node for the expression TYPENAME '(' PARMS ')'. */ -- 2.7.4