+2004-08-15 Roger Sayle <roger@eyesopen.com>
+
+ * 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 <nathan@codesourcery.com>
* call.c (convert_class_to_reference,
&& !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
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;
}
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. */
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;
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;
}
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))
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;
}
}
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
{
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
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);
}
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);
}
}
}
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);
}
/* 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. */
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);
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;
}
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;
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);
}
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;
}
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;
}
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)
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;
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. */
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
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;
}
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;
(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;
}
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;
}
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;
}
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);
/*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);
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);
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)
{
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
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;
}
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
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);
}
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
{
{
if (init)
{
- init = build (INIT_EXPR, type, decl, TREE_VALUE (init));
+ init = build2 (INIT_EXPR, type, decl, TREE_VALUE (init));
finish_expr_stmt (init);
}
}
/* 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. */
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);
}
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;
}
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;
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);
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;
/* 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)
/* 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;
}
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)
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);
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-
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);
}
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
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));
}
}
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
/* 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);
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:
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)
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);
}
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;
}
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);
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. */
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;
}
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. */
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);
}
}
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)
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;
}
}
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;
{
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. */
/* 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;
}
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
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
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
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);
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;
}
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<T>, the name S gets bound
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:
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:
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;
}
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);
}
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.
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...
{
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;
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
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*. */
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),
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;
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;
}
}
- 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. */
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;
}
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,
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
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
{
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
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;
}
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
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;
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;
}
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)
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)
{
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
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)
{
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
{
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
/*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
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:
}
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)
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;
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;
/* 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;
}
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;
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;
/* 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);
}
\f
{
/* 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;
}
}
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. */
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;
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);
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)))
{
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
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". */
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)
|| 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;
}
}
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);
}
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
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:
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:
/* 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;
}
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;
}
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)
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;
}
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:
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;
}
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);
}
*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;
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);
}
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;
}
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))))
/* 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 ')'. */