From b4257cfc1fd2e8cacb30978e5da3d6af3b1e2db8 Mon Sep 17 00:00:00 2001
From: Richard Guenther <rguenther@suse.de>
Date: Fri, 2 Dec 2005 17:09:40 +0000
Subject: [PATCH] tree-ssa-loop-im.c (schedule_sm): Use buildN instead of
 build.

2005-12-02  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build.
	* tree-complex.c (update_complex_assignment, expand_complex_div_wide):
	Likewise.
	* tree-ssa-ccp.c (maybe_fold_offset_to_array_ref,
	maybe_fold_offset_to_component_ref): Likewise.
	* tree-ssa-dom.c (thread_across_edge,
	simplify_rhs_and_lookup_avail_expr,
	find_equivalent_equality_comparison, record_equivalences_from_stmt):
	Likewise.
	* gimple-low.c (lower_function_body, lower_return_expr): Likewise.
	* tree-eh.c (do_return_redirection, honor_protect_cleanup_actions,
	lower_try_finally_switch): Likewise.
	* tree-if-conv.c (add_to_dst_predicate_list,
	replace_phi_with_cond_modify_expr, ifc_temp_var): Likewise.
	* gimplify.c (internal_get_tmp_var, gimple_build_eh_filter,
	voidify_wrapper_expr, build_stack_save_restore, gimplify_bind_expr,
	gimplify_return_expr, gimplify_decl_expr, gimplify_switch_expr,
	gimplify_case_label_expr, gimplify_exit_expr, gimplify_self_mod_expr,
	shortcut_cond_r, shortcut_cond_expr, gimplify_cond_expr,
	gimplify_init_ctor_eval, gimplify_init_constructor,
	gimplify_variable_sized_compare, gimplify_boolean_expr,
	gimplify_cleanup_point_expr, gimple_push_cleanup, gimplify_target_expr,
	gimplify_expr, gimplify_body, gimplify_function_tree,
	force_gimple_operand): Likewise.
	* tree-ssa-pre.c (create_expression_by_pieces): Likewise.
	* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for,
	mx_register_decls): Likewise.
	* tree-nested.c (init_tmp_var, save_tmp_var, get_static_chain,
	get_frame_field, finalize_nesting_tree_1): Likewise.
	* tree-inline.c (setup_one_parameter): Likewise.
	* tree-vect-transform.c (vectorizable_condition): Likewise.
	* tree-outof-ssa.c (insert_copy_on_edge, insert_backedge_copies):
	Likewise.
	* tree-profile.c (tree_gen_edge_profiler): Likewise.
	* tree-cfg.c (factor_computed_gotos, gimplify_val): Likewise.
	* c-parser.c (c_parser_if_body, c_parser_switch_statement): Likewise.
	* tree-chrec.h (build_polynomial_chrec): Likewise.

From-SVN: r107907
---
 gcc/ChangeLog             |  40 +++++++++++++
 gcc/c-parser.c            |   4 +-
 gcc/gimple-low.c          |   6 +-
 gcc/gimplify.c            | 114 +++++++++++++++++++-------------------
 gcc/tree-cfg.c            |   6 +-
 gcc/tree-chrec.h          |   4 +-
 gcc/tree-complex.c        |  16 +++---
 gcc/tree-eh.c             |  80 +++++++++++++-------------
 gcc/tree-if-conv.c        |  16 +++---
 gcc/tree-inline.c         |   2 +-
 gcc/tree-mudflap.c        |  70 +++++++++++------------
 gcc/tree-nested.c         |  26 ++++-----
 gcc/tree-outof-ssa.c      |   6 +-
 gcc/tree-profile.c        |  10 ++--
 gcc/tree-ssa-ccp.c        |  10 ++--
 gcc/tree-ssa-dom.c        |  22 ++++----
 gcc/tree-ssa-loop-im.c    |   6 +-
 gcc/tree-ssa-pre.c        |   2 +-
 gcc/tree-vect-transform.c |   4 +-
 19 files changed, 242 insertions(+), 202 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0185109a9ce1..aa94752abc12 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,43 @@
+2005-12-02  Richard Guenther  <rguenther@suse.de>
+
+	* tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build.
+	* tree-complex.c (update_complex_assignment, expand_complex_div_wide):
+	Likewise.
+	* tree-ssa-ccp.c (maybe_fold_offset_to_array_ref,
+	maybe_fold_offset_to_component_ref): Likewise.
+	* tree-ssa-dom.c (thread_across_edge,
+	simplify_rhs_and_lookup_avail_expr,
+	find_equivalent_equality_comparison, record_equivalences_from_stmt):
+	Likewise.
+	* gimple-low.c (lower_function_body, lower_return_expr): Likewise.
+	* tree-eh.c (do_return_redirection, honor_protect_cleanup_actions,
+	lower_try_finally_switch): Likewise.
+	* tree-if-conv.c (add_to_dst_predicate_list,
+	replace_phi_with_cond_modify_expr, ifc_temp_var): Likewise.
+	* gimplify.c (internal_get_tmp_var, gimple_build_eh_filter,
+	voidify_wrapper_expr, build_stack_save_restore, gimplify_bind_expr,
+	gimplify_return_expr, gimplify_decl_expr, gimplify_switch_expr,
+	gimplify_case_label_expr, gimplify_exit_expr, gimplify_self_mod_expr,
+	shortcut_cond_r, shortcut_cond_expr, gimplify_cond_expr,
+	gimplify_init_ctor_eval, gimplify_init_constructor,
+	gimplify_variable_sized_compare, gimplify_boolean_expr,
+	gimplify_cleanup_point_expr, gimple_push_cleanup, gimplify_target_expr,
+	gimplify_expr, gimplify_body, gimplify_function_tree,
+	force_gimple_operand): Likewise.
+	* tree-ssa-pre.c (create_expression_by_pieces): Likewise.
+	* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for,
+	mx_register_decls): Likewise.
+	* tree-nested.c (init_tmp_var, save_tmp_var, get_static_chain,
+	get_frame_field, finalize_nesting_tree_1): Likewise.
+	* tree-inline.c (setup_one_parameter): Likewise.
+	* tree-vect-transform.c (vectorizable_condition): Likewise.
+	* tree-outof-ssa.c (insert_copy_on_edge, insert_backedge_copies):
+	Likewise.
+	* tree-profile.c (tree_gen_edge_profiler): Likewise.
+	* tree-cfg.c (factor_computed_gotos, gimplify_val): Likewise.
+	* c-parser.c (c_parser_if_body, c_parser_switch_statement): Likewise.
+	* tree-chrec.h (build_polynomial_chrec): Likewise.
+
 2005-12-02  Richard Guenther  <rguenther@suse.de>
 
 	* config/alpha/alpha.c (alpha_va_start, alpha_gimplify_va_arg_1i,
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 518a92ce9f58..6ddbe51c01ec 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3629,7 +3629,7 @@ c_parser_if_body (c_parser *parser, bool *if_p)
     c_parser_label (parser);
   *if_p = c_parser_next_token_is_keyword (parser, RID_IF);
   if (extra_warnings && c_parser_next_token_is (parser, CPP_SEMICOLON))
-    add_stmt (build (NOP_EXPR, NULL_TREE, NULL_TREE));
+    add_stmt (build1 (NOP_EXPR, NULL_TREE, NULL_TREE));
   c_parser_statement_after_labels (parser);
   return c_end_compound_stmt (block, flag_isoc99);
 }
@@ -3692,7 +3692,7 @@ c_parser_switch_statement (c_parser *parser)
   body = c_parser_c99_block_statement (parser);
   c_finish_case (body);
   if (c_break_label)
-    add_stmt (build (LABEL_EXPR, void_type_node, c_break_label));
+    add_stmt (build1 (LABEL_EXPR, void_type_node, c_break_label));
   c_break_label = save_break;
   add_stmt (c_end_compound_stmt (block, flag_isoc99));
 }
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 5c7c27f7e13f..44171341d31f 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -91,7 +91,7 @@ lower_function_body (void)
       && (data.return_statements == NULL
           || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
     {
-      x = build (RETURN_EXPR, void_type_node, NULL);
+      x = build1 (RETURN_EXPR, void_type_node, NULL);
       SET_EXPR_LOCATION (x, cfun->function_end_locus);
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     }
@@ -100,7 +100,7 @@ lower_function_body (void)
      at the end of the function.  */
   for (t = data.return_statements ; t ; t = TREE_CHAIN (t))
     {
-      x = build (LABEL_EXPR, void_type_node, TREE_PURPOSE (t));
+      x = build1 (LABEL_EXPR, void_type_node, TREE_PURPOSE (t));
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
 
       /* Remove the line number from the representative return statement.
@@ -503,7 +503,7 @@ lower_return_expr (tree_stmt_iterator *tsi, struct lower_data *data)
 
   /* Generate a goto statement and remove the return statement.  */
  found:
-  t = build (GOTO_EXPR, void_type_node, label);
+  t = build1 (GOTO_EXPR, void_type_node, label);
   SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
   tsi_link_before (tsi, t, TSI_SAME_STMT);
   tsi_delink (tsi);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b232112bea3f..1bd73da4be81 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -533,7 +533,7 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal)
   if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE)
     DECL_COMPLEX_GIMPLE_REG_P (t) = 1;
 
-  mod = build (MODIFY_EXPR, TREE_TYPE (t), t, val);
+  mod = build2 (MODIFY_EXPR, TREE_TYPE (t), t, val);
 
   if (EXPR_HAS_LOCATION (val))
     SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
@@ -796,10 +796,10 @@ gimple_build_eh_filter (tree body, tree allowed, tree failure)
   tree t;
 
   /* FIXME should the allowed types go in TREE_TYPE?  */
-  t = build (EH_FILTER_EXPR, void_type_node, allowed, NULL_TREE);
+  t = build2 (EH_FILTER_EXPR, void_type_node, allowed, NULL_TREE);
   append_to_statement_list (failure, &EH_FILTER_FAILURE (t));
 
-  t = build (TRY_CATCH_EXPR, void_type_node, NULL_TREE, t);
+  t = build2 (TRY_CATCH_EXPR, void_type_node, NULL_TREE, t);
   append_to_statement_list (body, &TREE_OPERAND (t, 0));
 
   return t;
@@ -866,7 +866,7 @@ voidify_wrapper_expr (tree wrapper, tree temp)
 	{
 	  tree ptr = TREE_OPERAND (*p, 0);
 	  temp = create_tmp_var (TREE_TYPE (ptr), "retval");
-	  *p = build (MODIFY_EXPR, TREE_TYPE (ptr), temp, ptr);
+	  *p = build2 (MODIFY_EXPR, TREE_TYPE (ptr), temp, ptr);
 	  temp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (temp)), temp);
 	  /* If this is a BIND_EXPR for a const inline function, it might not
 	     have TREE_SIDE_EFFECTS set.  That is no longer accurate.  */
@@ -876,7 +876,7 @@ voidify_wrapper_expr (tree wrapper, tree temp)
 	{
 	  if (!temp)
 	    temp = create_tmp_var (TREE_TYPE (wrapper), "retval");
-	  *p = build (MODIFY_EXPR, TREE_TYPE (temp), temp, *p);
+	  *p = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, *p);
 	  TREE_SIDE_EFFECTS (wrapper) = 1;
 	}
 
@@ -900,7 +900,7 @@ build_stack_save_restore (tree *save, tree *restore)
 				NULL_TREE);
   tmp_var = create_tmp_var (ptr_type_node, "saved_stack");
 
-  *save = build (MODIFY_EXPR, ptr_type_node, tmp_var, save_call);
+  *save = build2 (MODIFY_EXPR, ptr_type_node, tmp_var, save_call);
   *restore =
     build_function_call_expr (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
 			      tree_cons (NULL_TREE, tmp_var, NULL_TREE));
@@ -947,8 +947,8 @@ gimplify_bind_expr (tree *expr_p, tree temp, tree *pre_p)
 	 format of the emitted code: see mx_register_decls().  */
       build_stack_save_restore (&stack_save, &stack_restore);
 
-      t = build (TRY_FINALLY_EXPR, void_type_node,
-		 BIND_EXPR_BODY (bind_expr), NULL_TREE);
+      t = build2 (TRY_FINALLY_EXPR, void_type_node,
+		  BIND_EXPR_BODY (bind_expr), NULL_TREE);
       append_to_statement_list (stack_restore, &TREE_OPERAND (t, 1));
 
       BIND_EXPR_BODY (bind_expr) = NULL_TREE;
@@ -1038,7 +1038,7 @@ gimplify_return_expr (tree stmt, tree *pre_p)
   if (result == result_decl)
     ret_expr = result;
   else
-    ret_expr = build (MODIFY_EXPR, TREE_TYPE (result), result_decl, result);
+    ret_expr = build2 (MODIFY_EXPR, TREE_TYPE (result), result_decl, result);
   TREE_OPERAND (stmt, 0) = ret_expr;
 
   return GS_ALL_DONE;
@@ -1107,7 +1107,7 @@ gimplify_decl_expr (tree *stmt_p)
 	  if (!TREE_STATIC (decl))
 	    {
 	      DECL_INITIAL (decl) = NULL_TREE;
-	      init = build (MODIFY_EXPR, void_type_node, decl, init);
+	      init = build2 (MODIFY_EXPR, void_type_node, decl, init);
 	      gimplify_and_add (init, stmt_p);
 	    }
 	  else
@@ -1253,11 +1253,11 @@ gimplify_switch_expr (tree *expr_p, tree *pre_p)
 	{
 	  /* If the switch has no default label, add one, so that we jump
 	     around the switch body.  */
-	  default_case = build (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
-				NULL_TREE, create_artificial_label ());
+	  default_case = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
+				 NULL_TREE, create_artificial_label ());
 	  append_to_statement_list (SWITCH_BODY (switch_expr), pre_p);
-	  *expr_p = build (LABEL_EXPR, void_type_node,
-			   CASE_LABEL (default_case));
+	  *expr_p = build1 (LABEL_EXPR, void_type_node,
+			    CASE_LABEL (default_case));
 	}
       else
 	*expr_p = SWITCH_BODY (switch_expr);
@@ -1285,7 +1285,7 @@ gimplify_case_label_expr (tree *expr_p)
 
   gcc_assert (gimplify_ctxp->case_labels);
   VEC_safe_push (tree, heap, gimplify_ctxp->case_labels, expr);
-  *expr_p = build (LABEL_EXPR, void_type_node, CASE_LABEL (expr));
+  *expr_p = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (expr));
   return GS_ALL_DONE;
 }
 
@@ -1319,7 +1319,7 @@ gimplify_exit_expr (tree *expr_p)
   tree expr;
 
   expr = build_and_jump (&gimplify_ctxp->exit_label);
-  expr = build (COND_EXPR, void_type_node, cond, expr, NULL_TREE);
+  expr = build3 (COND_EXPR, void_type_node, cond, expr, NULL_TREE);
   *expr_p = expr;
 
   return GS_OK;
@@ -1759,8 +1759,8 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p,
 	return ret;
     }
 
-  t1 = build (arith_code, TREE_TYPE (*expr_p), lhs, rhs);
-  t1 = build (MODIFY_EXPR, TREE_TYPE (lvalue), lvalue, t1);
+  t1 = build2 (arith_code, TREE_TYPE (*expr_p), lhs, rhs);
+  t1 = build2 (MODIFY_EXPR, TREE_TYPE (lvalue), lvalue, t1);
 
   if (postfix)
     {
@@ -2007,17 +2007,17 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p)
 	   if (b) goto yes; else goto no;
 	 else
 	   if (c) goto yes; else goto no;  */
-      expr = build (COND_EXPR, void_type_node, TREE_OPERAND (pred, 0),
-		    shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
-				     false_label_p),
-		    shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p,
-				     false_label_p));
+      expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (pred, 0),
+		     shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
+				      false_label_p),
+		     shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p,
+				      false_label_p));
     }
   else
     {
-      expr = build (COND_EXPR, void_type_node, pred,
-		    build_and_jump (true_label_p),
-		    build_and_jump (false_label_p));
+      expr = build3 (COND_EXPR, void_type_node, pred,
+		     build_and_jump (true_label_p),
+		     build_and_jump (false_label_p));
     }
 
   if (local_label)
@@ -2052,7 +2052,7 @@ shortcut_cond_expr (tree expr)
 	  then_ = shortcut_cond_expr (expr);
 	  then_se = then_ && TREE_SIDE_EFFECTS (then_);
 	  pred = TREE_OPERAND (pred, 0);
-	  expr = build (COND_EXPR, void_type_node, pred, then_, NULL_TREE);
+	  expr = build3 (COND_EXPR, void_type_node, pred, then_, NULL_TREE);
 	}
     }
   if (!then_se)
@@ -2067,7 +2067,7 @@ shortcut_cond_expr (tree expr)
 	  else_ = shortcut_cond_expr (expr);
 	  else_se = else_ && TREE_SIDE_EFFECTS (else_);
 	  pred = TREE_OPERAND (pred, 0);
-	  expr = build (COND_EXPR, void_type_node, pred, NULL_TREE, else_);
+	  expr = build3 (COND_EXPR, void_type_node, pred, NULL_TREE, else_);
 	}
     }
 
@@ -2282,8 +2282,8 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, tree *post_p, tree target,
 	  
 	  tmp2 = tmp = create_tmp_var (type, "iftmp");
 
-	  expr = build (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
-			TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
+	  expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
+			 TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
 
 	  result = build_fold_indirect_ref (tmp);
 	  ret = GS_ALL_DONE;
@@ -2293,12 +2293,12 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, tree *post_p, tree target,
 	 if this branch is void; in C++ it can be, if it's a throw.  */
       if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
 	TREE_OPERAND (expr, 1)
-	  = build (MODIFY_EXPR, void_type_node, tmp, TREE_OPERAND (expr, 1));
+	  = build2 (MODIFY_EXPR, void_type_node, tmp, TREE_OPERAND (expr, 1));
 
       /* Build the else clause, 't1 = b;'.  */
       if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
 	TREE_OPERAND (expr, 2)
-	  = build (MODIFY_EXPR, void_type_node, tmp2, TREE_OPERAND (expr, 2));
+	  = build2 (MODIFY_EXPR, void_type_node, tmp2, TREE_OPERAND (expr, 2));
 
       TREE_TYPE (expr) = void_type_node;
       recalculate_side_effects (expr);
@@ -2712,14 +2712,14 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
 
       if (array_elt_type)
 	{
-	  cref = build (ARRAY_REF, array_elt_type, unshare_expr (object),
-			purpose, NULL_TREE, NULL_TREE);
+	  cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
+			 purpose, NULL_TREE, NULL_TREE);
 	}
       else
 	{
 	  gcc_assert (TREE_CODE (purpose) == FIELD_DECL);
-	  cref = build (COMPONENT_REF, TREE_TYPE (purpose),
-			unshare_expr (object), purpose, NULL_TREE);
+	  cref = build3 (COMPONENT_REF, TREE_TYPE (purpose),
+			 unshare_expr (object), purpose, NULL_TREE);
 	}
 
       if (TREE_CODE (value) == CONSTRUCTOR
@@ -2728,7 +2728,7 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
 				 pre_p, cleared);
       else
 	{
-	  init = build (MODIFY_EXPR, TREE_TYPE (cref), cref, value);
+	  init = build2 (MODIFY_EXPR, TREE_TYPE (cref), cref, value);
 	  gimplify_and_add (init, pre_p);
 	}
     }
@@ -2946,7 +2946,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
 	  }
 	else
 	  {
-	    ctor = build (COMPLEX_EXPR, type, r, i);
+	    ctor = build2 (COMPLEX_EXPR, type, r, i);
 	    TREE_OPERAND (*expr_p, 1) = ctor;
 	    ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
 				 rhs_predicate_for (TREE_OPERAND (*expr_p, 0)),
@@ -3377,7 +3377,7 @@ gimplify_variable_sized_compare (tree *expr_p)
   t = implicit_built_in_decls[BUILT_IN_MEMCMP];
   t = build_function_call_expr (t, args);
   *expr_p
-    = build (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
+    = build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
 
   return GS_OK;
 }
@@ -3400,9 +3400,9 @@ gimplify_boolean_expr (tree *expr_p)
   /* Preserve the original type of the expression.  */
   tree type = TREE_TYPE (*expr_p);
 
-  *expr_p = build (COND_EXPR, type, *expr_p,
-		   convert (type, boolean_true_node),
-		   convert (type, boolean_false_node));
+  *expr_p = build3 (COND_EXPR, type, *expr_p,
+		    convert (type, boolean_true_node),
+		    convert (type, boolean_false_node));
 
   return GS_OK;
 }
@@ -3847,7 +3847,7 @@ gimplify_cleanup_point_expr (tree *expr_p, tree *pre_p)
 		code = TRY_FINALLY_EXPR;
 
 	      sl = tsi_split_statement_list_after (&iter);
-	      tfe = build (code, void_type_node, sl, NULL_TREE);
+	      tfe = build2 (code, void_type_node, sl, NULL_TREE);
 	      append_to_statement_list (TREE_OPERAND (wce, 0),
 				        &TREE_OPERAND (tfe, 1));
 	      *wce_p = tfe;
@@ -3908,12 +3908,12 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, tree *pre_p)
       */
 
       tree flag = create_tmp_var (boolean_type_node, "cleanup");
-      tree ffalse = build (MODIFY_EXPR, void_type_node, flag,
-			   boolean_false_node);
-      tree ftrue = build (MODIFY_EXPR, void_type_node, flag,
-			  boolean_true_node);
-      cleanup = build (COND_EXPR, void_type_node, flag, cleanup, NULL);
-      wce = build (WITH_CLEANUP_EXPR, void_type_node, cleanup);
+      tree ffalse = build2 (MODIFY_EXPR, void_type_node, flag,
+			    boolean_false_node);
+      tree ftrue = build2 (MODIFY_EXPR, void_type_node, flag,
+			   boolean_true_node);
+      cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL);
+      wce = build1 (WITH_CLEANUP_EXPR, void_type_node, cleanup);
       append_to_statement_list (ffalse, &gimplify_ctxp->conditional_cleanups);
       append_to_statement_list (wce, &gimplify_ctxp->conditional_cleanups);
       append_to_statement_list (ftrue, pre_p);
@@ -3925,7 +3925,7 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, tree *pre_p)
     }
   else
     {
-      wce = build (WITH_CLEANUP_EXPR, void_type_node, cleanup);
+      wce = build1 (WITH_CLEANUP_EXPR, void_type_node, cleanup);
       CLEANUP_EH_ONLY (wce) = eh_only;
       append_to_statement_list (wce, pre_p);
     }
@@ -3961,7 +3961,7 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
 	    gimplify_bind_expr (&init, temp, pre_p);
 	  if (init != temp)
 	    {
-	      init = build (MODIFY_EXPR, void_type_node, temp, init);
+	      init = build2 (MODIFY_EXPR, void_type_node, temp, init);
 	      ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt,
 				   fb_none);
 	    }
@@ -4562,7 +4562,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
 	     given a TREE_ADDRESSABLE type.  */
 	  tree tmp = create_tmp_var_raw (type, "vol");
 	  gimple_add_tmp_var (tmp);
-	  *expr_p = build (MODIFY_EXPR, type, tmp, *expr_p);
+	  *expr_p = build2 (MODIFY_EXPR, type, tmp, *expr_p);
 	}
       else
 	/* We can't do anything useful with a volatile reference to
@@ -4912,8 +4912,8 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms)
   /* If there isn't an outer BIND_EXPR, add one.  */
   if (TREE_CODE (body) != BIND_EXPR)
     {
-      tree b = build (BIND_EXPR, void_type_node, NULL_TREE,
-		      NULL_TREE, NULL_TREE);
+      tree b = build3 (BIND_EXPR, void_type_node, NULL_TREE,
+		       NULL_TREE, NULL_TREE);
       TREE_SIDE_EFFECTS (b) = 1;
       append_to_statement_list_force (body, &BIND_EXPR_BODY (b));
       body = b;
@@ -4983,7 +4983,7 @@ gimplify_function_tree (tree fndecl)
     {
       tree tf, x, bind;
 
-      tf = build (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
+      tf = build2 (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
       TREE_SIDE_EFFECTS (tf) = 1;
       x = DECL_SAVED_TREE (fndecl);
       append_to_statement_list (x, &TREE_OPERAND (tf, 0));
@@ -4991,7 +4991,7 @@ gimplify_function_tree (tree fndecl)
       x = build_function_call_expr (x, NULL);
       append_to_statement_list (x, &TREE_OPERAND (tf, 1));
 
-      bind = build (BIND_EXPR, void_type_node, NULL, NULL, NULL);
+      bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
       TREE_SIDE_EFFECTS (bind) = 1;
       x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
       x = build_function_call_expr (x, NULL);
@@ -5029,7 +5029,7 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
   gimplify_ctxp->into_ssa = in_ssa_p;
 
   if (var)
-    expr = build (MODIFY_EXPR, TREE_TYPE (var), var, expr);
+    expr = build2 (MODIFY_EXPR, TREE_TYPE (var), var, expr);
 
   ret = gimplify_expr (&expr, stmts, NULL,
 		       gimple_test_f, fb_rvalue);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 497715abac00..c468b64b1e5e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -298,8 +298,8 @@ factor_computed_gotos (void)
 	    }
 
 	  /* Copy the original computed goto's destination into VAR.  */
-	  assignment = build (MODIFY_EXPR, ptr_type_node,
-			      var, GOTO_DESTINATION (last));
+	  assignment = build2 (MODIFY_EXPR, ptr_type_node,
+			       var, GOTO_DESTINATION (last));
 	  bsi_insert_before (&bsi, assignment, BSI_SAME_STMT);
 
 	  /* And re-vector the computed goto to the new destination.  */
@@ -5074,7 +5074,7 @@ gimplify_val (block_stmt_iterator *bsi, tree type, tree exp)
     return exp;
 
   t = make_rename_temp (type, NULL);
-  new_stmt = build (MODIFY_EXPR, type, t, exp);
+  new_stmt = build2 (MODIFY_EXPR, type, t, exp);
 
   orig_stmt = bsi_stmt (*bsi);
   SET_EXPR_LOCUS (new_stmt, EXPR_LOCUS (orig_stmt));
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index 19719a65be83..683eade7fec0 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -105,8 +105,8 @@ build_polynomial_chrec (unsigned loop_num,
       || right == chrec_dont_know)
     return chrec_dont_know;
 
-  return build (POLYNOMIAL_CHREC, TREE_TYPE (left), 
-		build_int_cst (NULL_TREE, loop_num), left, right);
+  return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left), 
+		 build_int_cst (NULL_TREE, loop_num), left, right);
 }
 
 
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 7fc7879384e3..d85674257f45 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -629,7 +629,7 @@ update_complex_assignment (block_stmt_iterator *bsi, tree r, tree i)
     update_complex_components (bsi, stmt, r, i);
   
   type = TREE_TYPE (TREE_OPERAND (mod, 1));
-  TREE_OPERAND (mod, 1) = build (COMPLEX_EXPR, type, r, i);
+  TREE_OPERAND (mod, 1) = build2 (COMPLEX_EXPR, type, r, i);
   update_stmt (stmt);
 }
 
@@ -1055,7 +1055,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
     {
       edge e;
 
-      cond = build (COND_EXPR, void_type_node, cond, NULL, NULL);
+      cond = build3 (COND_EXPR, void_type_node, cond, NULL_TREE, NULL_TREE);
       bsi_insert_before (bsi, cond, BSI_SAME_STMT);
 
       /* Split the original block, and create the TRUE and FALSE blocks.  */
@@ -1065,8 +1065,8 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
       bb_true = create_empty_bb (bb_cond);
       bb_false = create_empty_bb (bb_true);
 
-      t1 = build (GOTO_EXPR, void_type_node, tree_block_label (bb_true));
-      t2 = build (GOTO_EXPR, void_type_node, tree_block_label (bb_false));
+      t1 = build1 (GOTO_EXPR, void_type_node, tree_block_label (bb_true));
+      t2 = build1 (GOTO_EXPR, void_type_node, tree_block_label (bb_false));
       COND_EXPR_THEN (cond) = t1;
       COND_EXPR_ELSE (cond) = t2;
 
@@ -1120,9 +1120,9 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
 
      if (bb_true)
        {
-	 t1 = build (MODIFY_EXPR, inner_type, rr, tr);
+	 t1 = build2 (MODIFY_EXPR, inner_type, rr, tr);
 	 bsi_insert_before (bsi, t1, BSI_SAME_STMT);
-	 t1 = build (MODIFY_EXPR, inner_type, ri, ti);
+	 t1 = build2 (MODIFY_EXPR, inner_type, ri, ti);
 	 bsi_insert_before (bsi, t1, BSI_SAME_STMT);
 	 bsi_remove (bsi);
        }
@@ -1159,9 +1159,9 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
 
      if (bb_false)
        {
-	 t1 = build (MODIFY_EXPR, inner_type, rr, tr);
+	 t1 = build2 (MODIFY_EXPR, inner_type, rr, tr);
 	 bsi_insert_before (bsi, t1, BSI_SAME_STMT);
-	 t1 = build (MODIFY_EXPR, inner_type, ri, ti);
+	 t1 = build2 (MODIFY_EXPR, inner_type, ri, ti);
 	 bsi_insert_before (bsi, t1, BSI_SAME_STMT);
 	 bsi_remove (bsi);
        }
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 76c7ef7a298f..859d68743da7 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -644,13 +644,13 @@ do_return_redirection (struct goto_queue_node *q, tree finlab, tree mod,
 	    else
 	      new = *return_value_p;
 
-	    x = build (MODIFY_EXPR, TREE_TYPE (new), new, old);
+	    x = build2 (MODIFY_EXPR, TREE_TYPE (new), new, old);
 	    append_to_statement_list (x, &q->repl_stmt);
 
 	    if (new == result)
 	      x = result;
 	    else
-	      x = build (MODIFY_EXPR, TREE_TYPE (result), result, new);
+	      x = build2 (MODIFY_EXPR, TREE_TYPE (result), result, new);
 	    q->cont_stmt = build1 (RETURN_EXPR, void_type_node, x);
 	  }
 
@@ -839,21 +839,21 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
       save_filt = create_tmp_var (integer_type_node, "save_filt");
 
       i = tsi_start (finally);
-      x = build (EXC_PTR_EXPR, ptr_type_node);
-      x = build (MODIFY_EXPR, void_type_node, save_eptr, x);
+      x = build0 (EXC_PTR_EXPR, ptr_type_node);
+      x = build2 (MODIFY_EXPR, void_type_node, save_eptr, x);
       tsi_link_before (&i, x, TSI_CONTINUE_LINKING);
 
-      x = build (FILTER_EXPR, integer_type_node);
-      x = build (MODIFY_EXPR, void_type_node, save_filt, x);
+      x = build0 (FILTER_EXPR, integer_type_node);
+      x = build2 (MODIFY_EXPR, void_type_node, save_filt, x);
       tsi_link_before (&i, x, TSI_CONTINUE_LINKING);
 
       i = tsi_last (finally);
-      x = build (EXC_PTR_EXPR, ptr_type_node);
-      x = build (MODIFY_EXPR, void_type_node, x, save_eptr);
+      x = build0 (EXC_PTR_EXPR, ptr_type_node);
+      x = build2 (MODIFY_EXPR, void_type_node, x, save_eptr);
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
 
-      x = build (FILTER_EXPR, integer_type_node);
-      x = build (MODIFY_EXPR, void_type_node, x, save_filt);
+      x = build0 (FILTER_EXPR, integer_type_node);
+      x = build2 (MODIFY_EXPR, void_type_node, x, save_filt);
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
 
       x = build_resx (get_eh_region_number (tf->region));
@@ -863,10 +863,10 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
   /* Wrap the block with protect_cleanup_actions as the action.  */
   if (protect_cleanup_actions)
     {
-      x = build (EH_FILTER_EXPR, void_type_node, NULL, NULL);
+      x = build2 (EH_FILTER_EXPR, void_type_node, NULL, NULL);
       append_to_statement_list (protect_cleanup_actions, &EH_FILTER_FAILURE (x));
       EH_FILTER_MUST_NOT_THROW (x) = 1;
-      finally = build (TRY_CATCH_EXPR, void_type_node, finally, x);
+      finally = build2 (TRY_CATCH_EXPR, void_type_node, finally, x);
       lower_eh_filter (outer_state, &finally);
     }
   else
@@ -1163,8 +1163,8 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
   finally_label = create_artificial_label ();
 
   case_label_vec = make_tree_vec (ndests);
-  switch_stmt = build (SWITCH_EXPR, integer_type_node, finally_tmp,
-		       NULL_TREE, case_label_vec);
+  switch_stmt = build3 (SWITCH_EXPR, integer_type_node, finally_tmp,
+		        NULL_TREE, case_label_vec);
   switch_body = NULL;
   last_case = NULL;
   last_case_index = 0;
@@ -1175,8 +1175,8 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 
   if (tf->may_fallthru)
     {
-      x = build (MODIFY_EXPR, void_type_node, finally_tmp,
-		 build_int_cst (NULL_TREE, fallthru_index));
+      x = build2 (MODIFY_EXPR, void_type_node, finally_tmp,
+		  build_int_cst (NULL_TREE, fallthru_index));
       append_to_statement_list (x, tf->top_p);
 
       if (tf->may_throw)
@@ -1186,13 +1186,13 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 	}
 
 
-      last_case = build (CASE_LABEL_EXPR, void_type_node,
-			 build_int_cst (NULL_TREE, fallthru_index), NULL,
-			 create_artificial_label ());
+      last_case = build3 (CASE_LABEL_EXPR, void_type_node,
+			  build_int_cst (NULL_TREE, fallthru_index), NULL,
+			  create_artificial_label ());
       TREE_VEC_ELT (case_label_vec, last_case_index) = last_case;
       last_case_index++;
 
-      x = build (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
+      x = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
       append_to_statement_list (x, &switch_body);
 
       x = lower_try_finally_fallthru_label (tf);
@@ -1205,17 +1205,17 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
       x = build1 (LABEL_EXPR, void_type_node, tf->eh_label);
       append_to_statement_list (x, tf->top_p);
 
-      x = build (MODIFY_EXPR, void_type_node, finally_tmp,
-		 build_int_cst (NULL_TREE, eh_index));
+      x = build2 (MODIFY_EXPR, void_type_node, finally_tmp,
+		  build_int_cst (NULL_TREE, eh_index));
       append_to_statement_list (x, tf->top_p);
 
-      last_case = build (CASE_LABEL_EXPR, void_type_node,
-			 build_int_cst (NULL_TREE, eh_index), NULL,
-			 create_artificial_label ());
+      last_case = build3 (CASE_LABEL_EXPR, void_type_node,
+			  build_int_cst (NULL_TREE, eh_index), NULL,
+			  create_artificial_label ());
       TREE_VEC_ELT (case_label_vec, last_case_index) = last_case;
       last_case_index++;
 
-      x = build (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
+      x = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
       append_to_statement_list (x, &switch_body);
       x = build_resx (get_eh_region_number (tf->region));
       append_to_statement_list (x, &switch_body);
@@ -1237,15 +1237,15 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 
       if (q->index < 0)
 	{
-	  mod = build (MODIFY_EXPR, void_type_node, finally_tmp,
-		       build_int_cst (NULL_TREE, return_index));
+	  mod = build2 (MODIFY_EXPR, void_type_node, finally_tmp,
+		        build_int_cst (NULL_TREE, return_index));
 	  do_return_redirection (q, finally_label, mod, &return_val);
 	  switch_id = return_index;
 	}
       else
 	{
-	  mod = build (MODIFY_EXPR, void_type_node, finally_tmp,
-		       build_int_cst (NULL_TREE, q->index));
+	  mod = build2 (MODIFY_EXPR, void_type_node, finally_tmp,
+		        build_int_cst (NULL_TREE, q->index));
 	  do_goto_redirection (q, finally_label, mod);
 	  switch_id = q->index;
 	}
@@ -1253,15 +1253,15 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
       case_index = j + q->index;
       if (!TREE_VEC_ELT (case_label_vec, case_index))
 	TREE_VEC_ELT (case_label_vec, case_index)
-	  = build (CASE_LABEL_EXPR, void_type_node,
-		   build_int_cst (NULL_TREE, switch_id), NULL,
-		   /* We store the cont_stmt in the
-		      CASE_LABEL, so that we can recover it
-		      in the loop below.  We don't create
-		      the new label while walking the
-		      goto_queue because pointers don't
-		      offer a stable order.  */
-		   q->cont_stmt);
+	  = build3 (CASE_LABEL_EXPR, void_type_node,
+		    build_int_cst (NULL_TREE, switch_id), NULL,
+		    /* We store the cont_stmt in the
+		       CASE_LABEL, so that we can recover it
+		       in the loop below.  We don't create
+		       the new label while walking the
+		       goto_queue because pointers don't
+		       offer a stable order.  */
+		    q->cont_stmt);
     }
   for (j = last_case_index; j < last_case_index + nlabels; j++)
     {
@@ -1277,7 +1277,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
       label = create_artificial_label ();
       CASE_LABEL (last_case) = label;
 
-      x = build (LABEL_EXPR, void_type_node, label);
+      x = build1 (LABEL_EXPR, void_type_node, label);
       append_to_statement_list (x, &switch_body);
       append_to_statement_list (cont_stmt, &switch_body);
       maybe_record_in_goto_queue (state, cont_stmt);
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 5d8375d412ed..f87d64d680db 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -630,8 +630,8 @@ add_to_dst_predicate_list (struct loop * loop, basic_block bb,
         bsi_insert_before (bsi, tmp_stmts2, BSI_SAME_STMT);
 
       /* new_cond == prev_cond AND cond */
-      tmp = build (TRUTH_AND_EXPR, boolean_type_node,
-		   unshare_expr (prev_cond), cond);
+      tmp = build2 (TRUTH_AND_EXPR, boolean_type_node,
+		    unshare_expr (prev_cond), cond);
       tmp_stmt = ifc_temp_var (boolean_type_node, tmp);
       bsi_insert_before (bsi, tmp_stmt, BSI_SAME_STMT);
       new_cond = TREE_OPERAND (tmp_stmt, 0);
@@ -792,13 +792,13 @@ replace_phi_with_cond_modify_expr (tree phi, tree cond, basic_block true_bb,
     }
 
   /* Build new RHS using selected condition and arguments.  */
-  rhs = build (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)),
-	       unshare_expr (cond), unshare_expr (arg_0),
-	       unshare_expr (arg_1));
+  rhs = build3 (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)),
+	        unshare_expr (cond), unshare_expr (arg_0),
+	        unshare_expr (arg_1));
 
   /* Create new MODIFY expression using RHS.  */
-  new_stmt = build (MODIFY_EXPR, TREE_TYPE (PHI_RESULT (phi)),
-		    unshare_expr (PHI_RESULT (phi)), rhs);
+  new_stmt = build2 (MODIFY_EXPR, TREE_TYPE (PHI_RESULT (phi)),
+		     unshare_expr (PHI_RESULT (phi)), rhs);
 
   /* Make new statement definition of the original phi result.  */
   SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = new_stmt;
@@ -993,7 +993,7 @@ ifc_temp_var (tree type, tree exp)
   add_referenced_tmp_var (var);
 
   /* Build new statement to assign EXP to new variable.  */
-  stmt = build (MODIFY_EXPR, type, var, exp);
+  stmt = build2 (MODIFY_EXPR, type, var, exp);
 
   /* Get SSA name for the new variable and set make new statement
      its definition statement.  */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 270389bc2656..e26bab63b934 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1148,7 +1148,7 @@ setup_one_parameter (inline_data *id, tree p, tree value, tree fn,
 
       /* We want to use MODIFY_EXPR, not INIT_EXPR here so that we
 	 keep our trees in gimple form.  */
-      init_stmt = build (MODIFY_EXPR, TREE_TYPE (var), var, rhs);
+      init_stmt = build2 (MODIFY_EXPR, TREE_TYPE (var), var, rhs);
 
       /* If we did not create a gimple value and we did not create a gimple
 	 cast of a gimple value, then we will need to gimplify INIT_STMTS
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index aa7c8fd2bc71..7384be0a6b79 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -453,14 +453,14 @@ mf_decl_cache_locals (void)
 
   /* Build initialization nodes for the cache vars.  We just load the
      globals into the cache variables.  */
-  t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l),
-             mf_cache_shift_decl_l, mf_cache_shift_decl);
+  t = build2 (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l),
+              mf_cache_shift_decl_l, mf_cache_shift_decl);
   SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   shift_init_stmts = t;
 
-  t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
-             mf_cache_mask_decl_l, mf_cache_mask_decl);
+  t = build2 (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
+              mf_cache_mask_decl_l, mf_cache_mask_decl);
   SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   mask_init_stmts = t;
@@ -548,31 +548,31 @@ mf_build_check_statement_for (tree base, tree limit,
   mf_limit = create_tmp_var (mf_uintptr_type, "__mf_limit");
 
   /* Build: __mf_base = (uintptr_t) <base address expression>.  */
-  t = build (MODIFY_EXPR, void_type_node, mf_base,
-             convert (mf_uintptr_type, unshare_expr (base)));
+  t = build2 (MODIFY_EXPR, void_type_node, mf_base,
+              convert (mf_uintptr_type, unshare_expr (base)));
   SET_EXPR_LOCUS (t, locus);
   gimplify_to_stmt_list (&t);
   head = tsi_start (t);
   tsi = tsi_last (t);
 
   /* Build: __mf_limit = (uintptr_t) <limit address expression>.  */
-  t = build (MODIFY_EXPR, void_type_node, mf_limit,
-             convert (mf_uintptr_type, unshare_expr (limit)));
+  t = build2 (MODIFY_EXPR, void_type_node, mf_limit,
+              convert (mf_uintptr_type, unshare_expr (limit)));
   SET_EXPR_LOCUS (t, locus);
   gimplify_to_stmt_list (&t);
   tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
 
   /* Build: __mf_elem = &__mf_lookup_cache [(__mf_base >> __mf_shift)
                                             & __mf_mask].  */
-  t = build (RSHIFT_EXPR, mf_uintptr_type, mf_base,
-             (flag_mudflap_threads ? mf_cache_shift_decl : mf_cache_shift_decl_l));
-  t = build (BIT_AND_EXPR, mf_uintptr_type, t,
-             (flag_mudflap_threads ? mf_cache_mask_decl : mf_cache_mask_decl_l));
-  t = build (ARRAY_REF,
-             TREE_TYPE (TREE_TYPE (mf_cache_array_decl)),
-             mf_cache_array_decl, t, NULL_TREE, NULL_TREE);
+  t = build2 (RSHIFT_EXPR, mf_uintptr_type, mf_base,
+              (flag_mudflap_threads ? mf_cache_shift_decl : mf_cache_shift_decl_l));
+  t = build2 (BIT_AND_EXPR, mf_uintptr_type, t,
+              (flag_mudflap_threads ? mf_cache_mask_decl : mf_cache_mask_decl_l));
+  t = build4 (ARRAY_REF,
+              TREE_TYPE (TREE_TYPE (mf_cache_array_decl)),
+              mf_cache_array_decl, t, NULL_TREE, NULL_TREE);
   t = build1 (ADDR_EXPR, mf_cache_structptr_type, t);
-  t = build (MODIFY_EXPR, void_type_node, mf_elem, t);
+  t = build2 (MODIFY_EXPR, void_type_node, mf_elem, t);
   SET_EXPR_LOCUS (t, locus);
   gimplify_to_stmt_list (&t);
   tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
@@ -592,10 +592,10 @@ mf_build_check_statement_for (tree base, tree limit,
      the edge to the THEN clause of the conditional jump as unlikely.  */
 
   /* Construct t <-- '__mf_elem->low  > __mf_base'.  */
-  t = build (COMPONENT_REF, mf_uintptr_type,
-             build1 (INDIRECT_REF, mf_cache_struct_type, mf_elem),
-             TYPE_FIELDS (mf_cache_struct_type), NULL_TREE);
-  t = build (GT_EXPR, boolean_type_node, t, mf_base);
+  t = build3 (COMPONENT_REF, mf_uintptr_type,
+              build1 (INDIRECT_REF, mf_cache_struct_type, mf_elem),
+              TYPE_FIELDS (mf_cache_struct_type), NULL_TREE);
+  t = build2 (GT_EXPR, boolean_type_node, t, mf_base);
 
   /* Construct '__mf_elem->high < __mf_limit'.
 
@@ -605,28 +605,28 @@ mf_build_check_statement_for (tree base, tree limit,
 
      Then build 'u <-- (u < v).  */
 
-  u = build (COMPONENT_REF, mf_uintptr_type,
-             build1 (INDIRECT_REF, mf_cache_struct_type, mf_elem),
-             TREE_CHAIN (TYPE_FIELDS (mf_cache_struct_type)), NULL_TREE);
+  u = build3 (COMPONENT_REF, mf_uintptr_type,
+              build1 (INDIRECT_REF, mf_cache_struct_type, mf_elem),
+              TREE_CHAIN (TYPE_FIELDS (mf_cache_struct_type)), NULL_TREE);
 
   v = mf_limit;
 
-  u = build (LT_EXPR, boolean_type_node, u, v);
+  u = build2 (LT_EXPR, boolean_type_node, u, v);
 
   /* Build the composed conditional: t <-- 't || u'.  Then store the
      result of the evaluation of 't' in a temporary variable which we
      can use as the condition for the conditional jump.  */
-  t = build (TRUTH_OR_EXPR, boolean_type_node, t, u);
+  t = build2 (TRUTH_OR_EXPR, boolean_type_node, t, u);
   cond = create_tmp_var (boolean_type_node, "__mf_unlikely_cond");
-  t = build (MODIFY_EXPR, boolean_type_node, cond, t);
+  t = build2 (MODIFY_EXPR, boolean_type_node, cond, t);
   gimplify_to_stmt_list (&t);
   tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
 
   /* Build the conditional jump.  'cond' is just a temporary so we can
      simply build a void COND_EXPR.  We do need labels in both arms though.  */
-  t = build (COND_EXPR, void_type_node, cond,
-             build (GOTO_EXPR, void_type_node, tree_block_label (then_bb)),
-             build (GOTO_EXPR, void_type_node, tree_block_label (join_bb)));
+  t = build3 (COND_EXPR, void_type_node, cond,
+              build1 (GOTO_EXPR, void_type_node, tree_block_label (then_bb)),
+              build1 (GOTO_EXPR, void_type_node, tree_block_label (join_bb)));
   SET_EXPR_LOCUS (t, locus);
   tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
 
@@ -671,12 +671,12 @@ mf_build_check_statement_for (tree base, tree limit,
 
   if (! flag_mudflap_threads)
     {
-      t = build (MODIFY_EXPR, void_type_node,
-                 mf_cache_shift_decl_l, mf_cache_shift_decl);
+      t = build2 (MODIFY_EXPR, void_type_node,
+                  mf_cache_shift_decl_l, mf_cache_shift_decl);
       tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
 
-      t = build (MODIFY_EXPR, void_type_node,
-                 mf_cache_mask_decl_l, mf_cache_mask_decl);
+      t = build2 (MODIFY_EXPR, void_type_node,
+                  mf_cache_mask_decl_l, mf_cache_mask_decl);
       tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
     }
 
@@ -1053,8 +1053,8 @@ mx_register_decls (tree decl, tree *stmt_list)
   /* Actually, (initially_stmts!=NULL) <=> (finally_stmts!=NULL) */
   if (finally_stmts != NULL_TREE)
     {
-      tree t = build (TRY_FINALLY_EXPR, void_type_node,
-                      *stmt_list, finally_stmts);
+      tree t = build2 (TRY_FINALLY_EXPR, void_type_node,
+                       *stmt_list, finally_stmts);
       *stmt_list = NULL;
       append_to_statement_list (t, stmt_list);
     }
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 27819db3e445..7f60faa646b0 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -380,7 +380,7 @@ init_tmp_var (struct nesting_info *info, tree exp, tree_stmt_iterator *tsi)
   tree t, stmt;
 
   t = create_tmp_var_for (info, TREE_TYPE (exp), NULL);
-  stmt = build (MODIFY_EXPR, TREE_TYPE (t), t, exp);
+  stmt = build2 (MODIFY_EXPR, TREE_TYPE (t), t, exp);
   SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi)));
   tsi_link_before (tsi, stmt, TSI_SAME_STMT);
 
@@ -408,7 +408,7 @@ save_tmp_var (struct nesting_info *info, tree exp,
   tree t, stmt;
 
   t = create_tmp_var_for (info, TREE_TYPE (exp), NULL);
-  stmt = build (MODIFY_EXPR, TREE_TYPE (t), exp, t);
+  stmt = build2 (MODIFY_EXPR, TREE_TYPE (t), exp, t);
   SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi)));
   tsi_link_after (tsi, stmt, TSI_SAME_STMT);
 
@@ -749,7 +749,7 @@ get_static_chain (struct nesting_info *info, tree target_context,
 	  tree field = get_chain_field (i);
 
 	  x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
-	  x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+	  x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
 	  x = init_tmp_var (info, x, tsi);
 	}
     }
@@ -783,14 +783,14 @@ get_frame_field (struct nesting_info *info, tree target_context,
 	  tree field = get_chain_field (i);
 
 	  x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
-	  x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+	  x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
 	  x = init_tmp_var (info, x, tsi);
 	}
 
       x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
     }
 
-  x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+  x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
   return x;
 }
 
@@ -1370,9 +1370,9 @@ finalize_nesting_tree_1 (struct nesting_info *root)
 	  else
 	    x = p;
 
-	  y = build (COMPONENT_REF, TREE_TYPE (field),
-		     root->frame_decl, field, NULL_TREE);
-	  x = build (MODIFY_EXPR, TREE_TYPE (field), y, x);
+	  y = build3 (COMPONENT_REF, TREE_TYPE (field),
+		      root->frame_decl, field, NULL_TREE);
+	  x = build2 (MODIFY_EXPR, TREE_TYPE (field), y, x);
 	  append_to_statement_list (x, &stmt_list);
 	}
     }
@@ -1381,9 +1381,9 @@ finalize_nesting_tree_1 (struct nesting_info *root)
      from chain_decl.  */
   if (root->chain_field)
     {
-      tree x = build (COMPONENT_REF, TREE_TYPE (root->chain_field),
-		      root->frame_decl, root->chain_field, NULL_TREE);
-      x = build (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
+      tree x = build3 (COMPONENT_REF, TREE_TYPE (root->chain_field),
+		       root->frame_decl, root->chain_field, NULL_TREE);
+      x = build2 (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
       append_to_statement_list (x, &stmt_list);
     }
 
@@ -1408,8 +1408,8 @@ finalize_nesting_tree_1 (struct nesting_info *root)
 	  x = build_addr (i->context, context);
 	  arg = tree_cons (NULL, x, arg);
 
-	  x = build (COMPONENT_REF, TREE_TYPE (field),
-		     root->frame_decl, field, NULL_TREE);
+	  x = build3 (COMPONENT_REF, TREE_TYPE (field),
+		      root->frame_decl, field, NULL_TREE);
 	  x = build_addr (x, context);
 	  arg = tree_cons (NULL, x, arg);
 
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 5a2150694b97..5f829881e8a2 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -191,7 +191,7 @@ insert_copy_on_edge (edge e, tree dest, tree src)
 {
   tree copy;
 
-  copy = build (MODIFY_EXPR, TREE_TYPE (dest), dest, src);
+  copy = build2 (MODIFY_EXPR, TREE_TYPE (dest), dest, src);
   set_is_used (dest);
 
   if (TREE_CODE (src) == ADDR_EXPR)
@@ -2471,8 +2471,8 @@ insert_backedge_copies (void)
 
 		  /* Create a new instance of the underlying
 		     variable of the PHI result.  */
-		  stmt = build (MODIFY_EXPR, TREE_TYPE (result_var),
-				NULL, PHI_ARG_DEF (phi, i));
+		  stmt = build2 (MODIFY_EXPR, TREE_TYPE (result_var),
+				 NULL_TREE, PHI_ARG_DEF (phi, i));
 		  name = make_ssa_name (result_var, stmt);
 		  TREE_OPERAND (stmt, 0) = name;
 
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 578104f4557a..0fdb3a23b66c 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -106,11 +106,11 @@ tree_gen_edge_profiler (int edgeno, edge e)
   tree tmp1 = create_tmp_var (gcov_type_node, "PROF");
   tree tmp2 = create_tmp_var (gcov_type_node, "PROF");
   tree ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
-  tree stmt1 = build (MODIFY_EXPR, gcov_type_node, tmp1, ref);
-  tree stmt2 = build (MODIFY_EXPR, gcov_type_node, tmp2,
-		      build (PLUS_EXPR, gcov_type_node, 
-			     tmp1, integer_one_node));
-  tree stmt3 = build (MODIFY_EXPR, gcov_type_node, ref, tmp2);
+  tree stmt1 = build2 (MODIFY_EXPR, gcov_type_node, tmp1, ref);
+  tree stmt2 = build2 (MODIFY_EXPR, gcov_type_node, tmp2,
+		       build2 (PLUS_EXPR, gcov_type_node, 
+			      tmp1, integer_one_node));
+  tree stmt3 = build2 (MODIFY_EXPR, gcov_type_node, ref, tmp2);
   bsi_insert_on_edge (e, stmt1);
   bsi_insert_on_edge (e, stmt2);
   bsi_insert_on_edge (e, stmt3);
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index a838ce925cd9..133d00a70903 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1589,9 +1589,9 @@ maybe_fold_offset_to_array_ref (tree base, tree offset, tree orig_type)
   if (!integer_zerop (elt_offset))
     idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0);
 
-  return build (ARRAY_REF, orig_type, base, idx, min_idx,
-		size_int (tree_low_cst (elt_size, 1)
-			  / (TYPE_ALIGN_UNIT (elt_type))));
+  return build4 (ARRAY_REF, orig_type, base, idx, min_idx,
+		 size_int (tree_low_cst (elt_size, 1)
+			   / (TYPE_ALIGN_UNIT (elt_type))));
 }
 
 
@@ -1652,7 +1652,7 @@ maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
 	{
 	  if (base_is_ptr)
 	    base = build1 (INDIRECT_REF, record_type, base);
-	  t = build (COMPONENT_REF, field_type, base, f, NULL_TREE);
+	  t = build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
 	  return t;
 	}
       
@@ -1692,7 +1692,7 @@ maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
      nonzero offset into them.  Recurse and hope for a valid match.  */
   if (base_is_ptr)
     base = build1 (INDIRECT_REF, record_type, base);
-  base = build (COMPONENT_REF, field_type, base, f, NULL_TREE);
+  base = build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
 
   t = maybe_fold_offset_to_array_ref (base, offset, orig_type);
   if (t)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index a0d2f2829073..1c7bcbe5c612 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -834,9 +834,9 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
 	  dummy_cond = walk_data->global_data;
 	  if (! dummy_cond)
 	    {
-	      dummy_cond = build (cond_code, boolean_type_node, op0, op1);
-	      dummy_cond = build (COND_EXPR, void_type_node,
-				  dummy_cond, NULL, NULL);
+	      dummy_cond = build2 (cond_code, boolean_type_node, op0, op1);
+	      dummy_cond = build3 (COND_EXPR, void_type_node,
+				   dummy_cond, NULL_TREE, NULL_TREE);
 	      walk_data->global_data = dummy_cond;
 	    }
 	  else
@@ -1851,17 +1851,17 @@ simplify_rhs_and_lookup_avail_expr (tree stmt, int insert)
 		  if (rhs_def_code != rhs_code)
 		    {
 		      if (rhs_def_code == MINUS_EXPR)
-		        t = build (MINUS_EXPR, type, outer_const, def_stmt_op1);
+		        t = build2 (MINUS_EXPR, type, outer_const, def_stmt_op1);
 		      else
-		        t = build (MINUS_EXPR, type, def_stmt_op1, outer_const);
+		        t = build2 (MINUS_EXPR, type, def_stmt_op1, outer_const);
 		      rhs_code = PLUS_EXPR;
 		    }
 		  else if (rhs_def_code == MINUS_EXPR)
-		    t = build (PLUS_EXPR, type, def_stmt_op1, outer_const);
+		    t = build2 (PLUS_EXPR, type, def_stmt_op1, outer_const);
 		  else
-		    t = build (rhs_def_code, type, def_stmt_op1, outer_const);
+		    t = build2 (rhs_def_code, type, def_stmt_op1, outer_const);
 		  t = local_fold (t);
-		  t = build (rhs_code, type, def_stmt_op0, t);
+		  t = build2 (rhs_code, type, def_stmt_op0, t);
 		  t = local_fold (t);
 
 		  /* If the result is a suitable looking gimple expression,
@@ -1969,8 +1969,8 @@ find_equivalent_equality_comparison (tree cond)
 	  new = build1 (TREE_CODE (def_rhs), def_rhs_inner_type, op1);
 	  new = local_fold (new);
 	  if (is_gimple_val (new) && tree_int_cst_equal (new, op1))
-	    return build (TREE_CODE (cond), TREE_TYPE (cond),
-			  def_rhs_inner, new);
+	    return build2 (TREE_CODE (cond), TREE_TYPE (cond),
+			   def_rhs_inner, new);
 	}
     }
   return NULL;
@@ -2752,7 +2752,7 @@ record_equivalences_from_stmt (tree stmt,
       if (rhs)
 	{
 	  /* Build a new statement with the RHS and LHS exchanged.  */
-	  new = build (MODIFY_EXPR, TREE_TYPE (stmt), rhs, lhs);
+	  new = build2 (MODIFY_EXPR, TREE_TYPE (stmt), rhs, lhs);
 
 	  create_ssa_artficial_load_stmt (new, stmt);
 
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 23bc6168c58b..8da06ef85773 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1070,7 +1070,7 @@ schedule_sm (struct loop *loop, edge *exits, unsigned n_exits, tree ref,
       LIM_DATA (aref->stmt)->sm_done = true;
 
   /* Emit the load & stores.  */
-  load = build (MODIFY_EXPR, void_type_node, tmp_var, ref);
+  load = build2 (MODIFY_EXPR, void_type_node, tmp_var, ref);
   get_stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
   LIM_DATA (load)->max_loop = loop;
   LIM_DATA (load)->tgt_loop = loop;
@@ -1081,8 +1081,8 @@ schedule_sm (struct loop *loop, edge *exits, unsigned n_exits, tree ref,
 
   for (i = 0; i < n_exits; i++)
     {
-      store = build (MODIFY_EXPR, void_type_node,
-		     unshare_expr (ref), tmp_var);
+      store = build2 (MODIFY_EXPR, void_type_node,
+		      unshare_expr (ref), tmp_var);
       bsi_insert_on_edge (exits[i], store);
     }
 }
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 425d2204a3c2..806b9af495ee 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1595,7 +1595,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
   add_referenced_tmp_var (temp);
   if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
     DECL_COMPLEX_GIMPLE_REG_P (temp) = 1;
-  newexpr = build (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr);
+  newexpr = build2 (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr);
   name = make_ssa_name (temp, newexpr);
   TREE_OPERAND (newexpr, 0) = name;
   NECESSARY (newexpr) = 0;
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 8a09f1a7f68d..bdf26173288a 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -2019,8 +2019,8 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
   /* Arguments are ready. create the new vector stmt.  */
   vec_compare = build2 (TREE_CODE (cond_expr), vectype, 
 			vec_cond_lhs, vec_cond_rhs);
-  vec_cond_expr = build (VEC_COND_EXPR, vectype, 
-			 vec_compare, vec_then_clause, vec_else_clause);
+  vec_cond_expr = build3 (VEC_COND_EXPR, vectype, 
+			  vec_compare, vec_then_clause, vec_else_clause);
 
   *vec_stmt = build2 (MODIFY_EXPR, vectype, vec_dest, vec_cond_expr);
   new_temp = make_ssa_name (vec_dest, *vec_stmt);
-- 
GitLab