From: Roger Sayle Date: Sun, 18 Jul 2004 13:17:03 +0000 (+0000) Subject: builtins.c (max_builtin, [...]): Replace calls to build with buildN. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=94cdeb1ad33b77f10f4cbc56bbce5d5f9c6b703c;p=gcc.git builtins.c (max_builtin, [...]): Replace calls to build with buildN. * builtins.c (max_builtin, min_builtin, java_build_function_call_expr): Replace calls to build with buildN. * class.c (build_class_ref, build_static_field_ref, get_dispatch_table, make_class_data, layout_class_method): Likewise. * constants.c (build_ref_from_constant_pool): Likewise. * decl.c (update_aliases, push_jvm_slot, poplevel, finish_method, add_stmt_to_compound): Likewise. * except.c (build_exception_object_ref, expand_end_java_handler): Likewise. * java-gimplify.c (java_gimplify_case_expr, java_gimplify_default_expr, java_gimplify_block, java_gimplify_new_array_init, java_gimplify_try_expr): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * typeck.c (convert_ieee_real_to_integer): Likewise. From-SVN: r84894 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index f06412333cb..308aaa36935 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,20 @@ +2004-07-18 Roger Sayle + + * builtins.c (max_builtin, min_builtin, + java_build_function_call_expr): Replace calls to build with buildN. + * class.c (build_class_ref, build_static_field_ref, + get_dispatch_table, make_class_data, layout_class_method): Likewise. + * constants.c (build_ref_from_constant_pool): Likewise. + * decl.c (update_aliases, push_jvm_slot, poplevel, finish_method, + add_stmt_to_compound): Likewise. + * except.c (build_exception_object_ref, expand_end_java_handler): + Likewise. + * java-gimplify.c (java_gimplify_case_expr, + java_gimplify_default_expr, java_gimplify_block, + java_gimplify_new_array_init, java_gimplify_try_expr): Likewise. + * jcf-write.c (generate_bytecode_insns): Likewise. + * typeck.c (convert_ieee_real_to_integer): Likewise. + 2004-07-17 Joseph S. Myers * java-tree.h (builtin_function): Declare. diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 77f0c582105..8068c0415a1 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -96,17 +96,17 @@ static GTY(()) struct builtin_record java_builtins[] = static tree max_builtin (tree method_return_type, tree method_arguments) { - return fold (build (MAX_EXPR, method_return_type, - TREE_VALUE (method_arguments), - TREE_VALUE (TREE_CHAIN (method_arguments)))); + return fold (build2 (MAX_EXPR, method_return_type, + TREE_VALUE (method_arguments), + TREE_VALUE (TREE_CHAIN (method_arguments)))); } static tree min_builtin (tree method_return_type, tree method_arguments) { - return fold (build (MIN_EXPR, method_return_type, - TREE_VALUE (method_arguments), - TREE_VALUE (TREE_CHAIN (method_arguments)))); + return fold (build2 (MIN_EXPR, method_return_type, + TREE_VALUE (method_arguments), + TREE_VALUE (TREE_CHAIN (method_arguments)))); } static tree @@ -123,8 +123,8 @@ java_build_function_call_expr (tree fn, tree arglist) tree call_expr; call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); - call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - call_expr, arglist, NULL_TREE); + call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), + call_expr, arglist, NULL_TREE); TREE_SIDE_EFFECTS (call_expr) = 1; return fold (call_expr); } diff --git a/gcc/java/class.c b/gcc/java/class.c index abadbd1c504..64e44090f40 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1050,8 +1050,8 @@ build_class_ref (tree type) abort (); prim_class = lookup_class (get_identifier (prim_class_name)); - return build (COMPONENT_REF, NULL_TREE, - prim_class, TYPE_identifier_node, NULL_TREE); + return build3 (COMPONENT_REF, NULL_TREE, + prim_class, TYPE_identifier_node, NULL_TREE); } decl_name = TYPE_NAME (type); if (TREE_CODE (decl_name) == TYPE_DECL) @@ -1115,9 +1115,9 @@ build_static_field_ref (tree fdecl) = build_int_2 (get_symbol_table_index (fdecl, &TYPE_ATABLE_METHODS (output_class)), 0); tree field_address - = build (ARRAY_REF, build_pointer_type (TREE_TYPE (fdecl)), - TYPE_ATABLE_DECL (output_class), table_index, - NULL_TREE, NULL_TREE); + = build4 (ARRAY_REF, build_pointer_type (TREE_TYPE (fdecl)), + TYPE_ATABLE_DECL (output_class), table_index, + NULL_TREE, NULL_TREE); return fold (build1 (INDIRECT_REF, TREE_TYPE (fdecl), field_address)); } @@ -1129,9 +1129,9 @@ build_static_field_ref (tree fdecl) tree fld; int field_index = 0; ref = build1 (INDIRECT_REF, class_type_node, ref); - ref = build (COMPONENT_REF, field_ptr_type_node, ref, - lookup_field (&class_type_node, fields_ident), - NULL_TREE); + ref = build3 (COMPONENT_REF, field_ptr_type_node, ref, + lookup_field (&class_type_node, fields_ident), + NULL_TREE); for (fld = TYPE_FIELDS (fclass); ; fld = TREE_CHAIN (fld)) { @@ -1144,15 +1144,15 @@ build_static_field_ref (tree fdecl) field_index++; } field_index *= int_size_in_bytes (field_type_node); - ref = fold (build (PLUS_EXPR, field_ptr_type_node, - ref, build_int_2 (field_index, 0))); + ref = fold (build2 (PLUS_EXPR, field_ptr_type_node, + ref, build_int_2 (field_index, 0))); ref = build1 (INDIRECT_REF, field_type_node, ref); - ref = build (COMPONENT_REF, field_info_union_node, - ref, lookup_field (&field_type_node, info_ident), - NULL_TREE); - ref = build (COMPONENT_REF, ptr_type_node, - ref, TREE_CHAIN (TYPE_FIELDS (field_info_union_node)), - NULL_TREE); + ref = build3 (COMPONENT_REF, field_info_union_node, + ref, lookup_field (&field_type_node, info_ident), + NULL_TREE); + ref = build3 (COMPONENT_REF, ptr_type_node, + ref, TREE_CHAIN (TYPE_FIELDS (field_info_union_node)), + NULL_TREE); ref = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (fdecl)), ref); return fold (build1 (INDIRECT_REF, TREE_TYPE(fdecl), ref)); } @@ -1421,8 +1421,8 @@ get_dispatch_table (tree type, tree this_class_addr) if (TARGET_VTABLE_USES_DESCRIPTORS) for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j) { - tree fdesc = build (FDESC_EXPR, nativecode_ptr_type_node, - method, build_int_2 (j, 0)); + tree fdesc = build2 (FDESC_EXPR, nativecode_ptr_type_node, + method, build_int_2 (j, 0)); TREE_CONSTANT (fdesc) = 1; TREE_INVARIANT (fdesc) = 1; list = tree_cons (NULL_TREE, fdesc, list); @@ -1712,9 +1712,10 @@ make_class_data (tree type) START_RECORD_CONSTRUCTOR (temp, object_type_node); PUSH_FIELD_VALUE (temp, "vtable", - build (PLUS_EXPR, dtable_ptr_type, - build1 (ADDR_EXPR, dtable_ptr_type, class_dtable_decl), - dtable_start_offset)); + build2 (PLUS_EXPR, dtable_ptr_type, + build1 (ADDR_EXPR, dtable_ptr_type, + class_dtable_decl), + dtable_start_offset)); if (! flag_hash_synchronization) PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node); FINISH_RECORD_CONSTRUCTOR (temp); @@ -1750,9 +1751,10 @@ make_class_data (tree type) else PUSH_FIELD_VALUE (cons, "vtable", dtable_decl == NULL_TREE ? null_pointer_node - : build (PLUS_EXPR, dtable_ptr_type, - build1 (ADDR_EXPR, dtable_ptr_type, dtable_decl), - dtable_start_offset)); + : build2 (PLUS_EXPR, dtable_ptr_type, + build1 (ADDR_EXPR, dtable_ptr_type, + dtable_decl), + dtable_start_offset)); if (TYPE_OTABLE_METHODS (type) == NULL_TREE) { PUSH_FIELD_VALUE (cons, "otable", null_pointer_node); @@ -2274,8 +2276,8 @@ layout_class_method (tree this_class, tree super_class, && dtable_count) { set_method_index (method_decl, dtable_count); - dtable_count = fold (build (PLUS_EXPR, integer_type_node, - dtable_count, integer_one_node)); + dtable_count = fold (build2 (PLUS_EXPR, integer_type_node, + dtable_count, integer_one_node)); } } diff --git a/gcc/java/constants.c b/gcc/java/constants.c index fc4a7a30335..d84477297ca 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -425,8 +425,8 @@ build_ref_from_constant_pool (int index) { tree d = build_constant_data_ref (); tree i = build_int_2 (index, 0); - return build (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i, - NULL_TREE, NULL_TREE); + return build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i, + NULL_TREE, NULL_TREE); } /* Build an initializer for the constants field of the current constant pool. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index b0289671992..761ebb2b70c 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -113,8 +113,7 @@ update_aliases (tree decl, int index) && TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp))) { tree src = build1 (NOP_EXPR, TREE_TYPE (tmp), decl); - java_add_stmt - (build (MODIFY_EXPR, TREE_TYPE (tmp), tmp, src)); + java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, src)); } tmp = DECL_LOCAL_SLOT_CHAIN (tmp); } @@ -139,8 +138,7 @@ push_jvm_slot (int index, tree decl) /* At the point of its creation this decl inherits whatever is in the slot. */ tree src = build1 (NOP_EXPR, TREE_TYPE (decl), tmp); - java_add_stmt - (build (MODIFY_EXPR, TREE_TYPE (decl), decl, src)); + java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (decl), decl, src)); break; } tmp = DECL_LOCAL_SLOT_CHAIN (tmp); @@ -1345,7 +1343,7 @@ poplevel (int keep, int reverse, int functionbody) } *var = NULL; - bind = build (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block), + bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block), BLOCK_EXPR_BODY (block), block); BIND_EXPR_BODY (bind) = current_binding_level->stmts; @@ -1800,9 +1798,8 @@ finish_method (tree fndecl) lock = DECL_ARGUMENTS (fndecl); BUILD_MONITOR_ENTER (enter, lock); BUILD_MONITOR_EXIT (exit, lock); - *tp = build (COMPOUND_EXPR, void_type_node, - enter, - build (TRY_FINALLY_EXPR, void_type_node, *tp, exit)); + *tp = build2 (COMPOUND_EXPR, void_type_node, enter, + build2 (TRY_FINALLY_EXPR, void_type_node, *tp, exit)); } /* Prepend class initialization for static methods reachable from @@ -1812,11 +1809,11 @@ finish_method (tree fndecl) && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl)))) { tree clas = DECL_CONTEXT (fndecl); - tree init = build (CALL_EXPR, void_type_node, - build_address_of (soft_initclass_node), - build_tree_list (NULL_TREE, build_class_ref (clas)), - NULL_TREE); - *tp = build (COMPOUND_EXPR, TREE_TYPE (*tp), init, *tp); + tree init = build3 (CALL_EXPR, void_type_node, + build_address_of (soft_initclass_node), + build_tree_list (NULL_TREE, build_class_ref (clas)), + NULL_TREE); + *tp = build2 (COMPOUND_EXPR, TREE_TYPE (*tp), init, *tp); } /* Convert function tree to GENERIC prior to inlining. */ @@ -1881,9 +1878,9 @@ add_stmt_to_compound (tree existing, tree type, tree stmt) return existing; else if (existing) { - tree expr = build (COMPOUND_EXPR, type, existing, stmt); - TREE_SIDE_EFFECTS (expr) - = TREE_SIDE_EFFECTS (existing) | TREE_SIDE_EFFECTS (stmt); + tree expr = build2 (COMPOUND_EXPR, type, existing, stmt); + TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (existing) + | TREE_SIDE_EFFECTS (stmt); return expr; } else diff --git a/gcc/java/except.c b/gcc/java/except.c index 91f741f63d0..b45f79a4aa3 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -412,9 +412,9 @@ build_exception_object_ref (tree type) /* Java only passes object via pointer and doesn't require adjusting. The java object is immediately before the generic exception header. */ - obj = build (EXC_PTR_EXPR, build_pointer_type (type)); - obj = build (MINUS_EXPR, TREE_TYPE (obj), obj, - TYPE_SIZE_UNIT (TREE_TYPE (obj))); + obj = build0 (EXC_PTR_EXPR, build_pointer_type (type)); + obj = build2 (MINUS_EXPR, TREE_TYPE (obj), obj, + TYPE_SIZE_UNIT (TREE_TYPE (obj))); obj = build1 (INDIRECT_REF, type, obj); return obj; @@ -441,11 +441,11 @@ expand_end_java_handler (struct eh_range *range) type = prepare_eh_table_type (type); { - tree catch_expr - = build (CATCH_EXPR, void_type_node, type, - build (GOTO_EXPR, void_type_node, TREE_VALUE (handler))); - tree try_catch_expr = build (TRY_CATCH_EXPR, void_type_node, - *get_stmts (), catch_expr); + tree catch_expr = build2 (CATCH_EXPR, void_type_node, type, + build1 (GOTO_EXPR, void_type_node, + TREE_VALUE (handler))); + tree try_catch_expr = build2 (TRY_CATCH_EXPR, void_type_node, + *get_stmts (), catch_expr); *get_stmts () = try_catch_expr; } } diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c index 766995e8254..64cb7ceb88e 100644 --- a/gcc/java/java-gimplify.c +++ b/gcc/java/java-gimplify.c @@ -144,15 +144,15 @@ static tree java_gimplify_case_expr (tree expr) { tree label = create_artificial_label (); - return build (CASE_LABEL_EXPR, void_type_node, - TREE_OPERAND (expr, 0), NULL_TREE, label); + return build3 (CASE_LABEL_EXPR, void_type_node, + TREE_OPERAND (expr, 0), NULL_TREE, label); } static tree java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED) { tree label = create_artificial_label (); - return build (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label); + return build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label); } /* Gimplify BLOCK into a BIND_EXPR. */ @@ -187,7 +187,7 @@ java_gimplify_block (tree java_block) BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block); } - return build (BIND_EXPR, TREE_TYPE (java_block), decls, body, block); + return build3 (BIND_EXPR, TREE_TYPE (java_block), decls, body, block); } /* Gimplify a NEW_ARRAY_INIT node into array/element assignments. */ @@ -204,11 +204,12 @@ java_gimplify_new_array_init (tree exp) tree values = CONSTRUCTOR_ELTS (init); tree array_ptr_type = build_pointer_type (array_type); - tree block = build (BLOCK, array_ptr_type); + tree block = build0 (BLOCK, array_ptr_type); tree tmp = build_decl (VAR_DECL, get_identifier (""), array_ptr_type); - tree array = build_decl (VAR_DECL, get_identifier (""), array_ptr_type); - tree body = build (MODIFY_EXPR, array_ptr_type, tmp, - build_new_array (element_type, length)); + tree array = build_decl (VAR_DECL, get_identifier (""), + array_ptr_type); + tree body = build2 (MODIFY_EXPR, array_ptr_type, tmp, + build_new_array (element_type, length)); int index = 0; @@ -220,20 +221,20 @@ java_gimplify_new_array_init (tree exp) { /* FIXME: Should use build_java_arrayaccess here, but avoid bounds checking. */ - tree lhs = build (COMPONENT_REF, TREE_TYPE (data_field), - build_java_indirect_ref (array_type, tmp, 0), - data_field, NULL_TREE); - tree assignment = build (MODIFY_EXPR, element_type, - build (ARRAY_REF, element_type, lhs, - build_int_2 (index++, 0), - NULL_TREE, NULL_TREE), - TREE_VALUE (values)); - body = build (COMPOUND_EXPR, element_type, body, assignment); + tree lhs = build3 (COMPONENT_REF, TREE_TYPE (data_field), + build_java_indirect_ref (array_type, tmp, 0), + data_field, NULL_TREE); + tree assignment = build2 (MODIFY_EXPR, element_type, + build4 (ARRAY_REF, element_type, lhs, + build_int_2 (index++, 0), + NULL_TREE, NULL_TREE), + TREE_VALUE (values)); + body = build2 (COMPOUND_EXPR, element_type, body, assignment); values = TREE_CHAIN (values); } - body = build (COMPOUND_EXPR, array_ptr_type, body, - build (MODIFY_EXPR, array_ptr_type, array, tmp)); + body = build2 (COMPOUND_EXPR, array_ptr_type, body, + build2 (MODIFY_EXPR, array_ptr_type, array, tmp)); TREE_CHAIN (tmp) = array; BLOCK_VARS (block) = tmp; BLOCK_EXPR_BODY (block) = body; @@ -252,16 +253,16 @@ java_gimplify_try_expr (tree try_expr) { tree java_catch = TREE_OPERAND (handler, 0); tree catch_type = TREE_TYPE (TREE_TYPE (BLOCK_EXPR_DECLS (java_catch))); - tree expr = build (CATCH_EXPR, void_type_node, - prepare_eh_table_type (catch_type), - handler); + tree expr = build2 (CATCH_EXPR, void_type_node, + prepare_eh_table_type (catch_type), + handler); if (catch) - catch = build (COMPOUND_EXPR, void_type_node, catch, expr); + catch = build2 (COMPOUND_EXPR, void_type_node, catch, expr); else catch = expr; handler = TREE_CHAIN (handler); } - return build (TRY_CATCH_EXPR, void_type_node, body, catch); + return build2 (TRY_CATCH_EXPR, void_type_node, body, catch); } /* Dump a tree of some kind. This is a convenience wrapper for the diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index e34543c44c7..a41c3554441 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2067,8 +2067,8 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) /* This function correctly handles the case where the LHS of a binary expression is NULL_TREE. */ - rhs = build (TREE_CODE (rhs), TREE_TYPE (rhs), - NULL_TREE, TREE_OPERAND (rhs, 1)); + rhs = build2 (TREE_CODE (rhs), TREE_TYPE (rhs), + NULL_TREE, TREE_OPERAND (rhs, 1)); } generate_bytecode_insns (rhs, STACK_TARGET, state); @@ -2490,9 +2490,9 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) tree x; if (TREE_SIDE_EFFECTS (op0) || TREE_SIDE_EFFECTS (op1)) abort (); - x = build (COND_EXPR, TREE_TYPE (exp), - build (code, boolean_type_node, op0, op1), - op0, op1); + x = build3 (COND_EXPR, TREE_TYPE (exp), + build2 (code, boolean_type_node, op0, op1), + op0, op1); generate_bytecode_insns (x, target, state); break; } diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 8cfe5e4d3be..8a174395530 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -83,22 +83,22 @@ convert_ieee_real_to_integer (tree type, tree expr) tree result; expr = save_expr (expr); - result = build (COND_EXPR, type, - build (NE_EXPR, boolean_type_node, expr, expr), - convert (type, integer_zero_node), - convert_to_integer (type, expr)); + result = build3 (COND_EXPR, type, + build2 (NE_EXPR, boolean_type_node, expr, expr), + convert (type, integer_zero_node), + convert_to_integer (type, expr)); - result = build (COND_EXPR, type, - build (LE_EXPR, boolean_type_node, expr, - convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))), - TYPE_MIN_VALUE (type), - result); - - result = build (COND_EXPR, type, - build (GE_EXPR, boolean_type_node, expr, - convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))), - TYPE_MAX_VALUE (type), - result); + result = build3 (COND_EXPR, type, + build2 (LE_EXPR, boolean_type_node, expr, + convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))), + TYPE_MIN_VALUE (type), + result); + + result = build3 (COND_EXPR, type, + build2 (GE_EXPR, boolean_type_node, expr, + convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))), + TYPE_MAX_VALUE (type), + result); return result; }