Commit 247fec6e by Roger Sayle Committed by Roger Sayle

expr.c (java_truthvalue_conversion, [...]): Convert calls to "build" into calls…

expr.c (java_truthvalue_conversion, [...]): Convert calls to "build" into calls to the prefered "buildN" functions.


	* expr.c (java_truthvalue_conversion, flush_quick_stack,
	java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr,
	build_java_ret, build_java_throw_out_of_bounds_exception,
	build_java_array_length_access, java_check_reference,
	build_java_arrayaccess, build_java_arraystore_check, build_newarray,
	build_anewarray, expand_java_multianewarray, expand_java_arraystore,
	expand_java_arrayload, build_java_monitor, expand_java_return,
	expand_load_internal, expand_java_NEW, build_get_class,
	build_instanceof, expand_java_CHECKCAST, expand_iinc,
	build_java_soft_divmod, build_java_binop, build_field_ref,
	expand_compare, expand_java_goto, expand_java_switch,
	expand_java_add_case, build_class_init, build_known_method_ref,
	invoke_build_dtable, build_invokevirtual, build_invokeinterface,
	expand_invoke, build_jni_stub, expand_java_field_op,
	java_expand_expr, expand_byte_code, STORE_INTERNAL,
	force_evaluation_order, emit_init_test_initialization): Convert
	calls to "build" into calls to the prefered "buildN" functions.

From-SVN: r84541
parent 186af37b
2004-07-11 Roger Sayle <roger@eyesopen.com>
* expr.c (java_truthvalue_conversion, flush_quick_stack,
java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr,
build_java_ret, build_java_throw_out_of_bounds_exception,
build_java_array_length_access, java_check_reference,
build_java_arrayaccess, build_java_arraystore_check, build_newarray,
build_anewarray, expand_java_multianewarray, expand_java_arraystore,
expand_java_arrayload, build_java_monitor, expand_java_return,
expand_load_internal, expand_java_NEW, build_get_class,
build_instanceof, expand_java_CHECKCAST, expand_iinc,
build_java_soft_divmod, build_java_binop, build_field_ref,
expand_compare, expand_java_goto, expand_java_switch,
expand_java_add_case, build_class_init, build_known_method_ref,
invoke_build_dtable, build_invokevirtual, build_invokeinterface,
expand_invoke, build_jni_stub, expand_java_field_op,
java_expand_expr, expand_byte_code, STORE_INTERNAL,
force_evaluation_order, emit_init_test_initialization): Convert
calls to "build" into calls to the prefered "buildN" functions.
2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk> 2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
* java-tree.h (set_block): Remove. * java-tree.h (set_block): Remove.
......
...@@ -186,7 +186,8 @@ java_truthvalue_conversion (tree expr) ...@@ -186,7 +186,8 @@ java_truthvalue_conversion (tree expr)
case COND_EXPR: case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */ /* Distribute the conversion into the arms of a COND_EXPR. */
return fold (build (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0), return fold
(build3 (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0),
java_truthvalue_conversion (TREE_OPERAND (expr, 1)), java_truthvalue_conversion (TREE_OPERAND (expr, 1)),
java_truthvalue_conversion (TREE_OPERAND (expr, 2)))); java_truthvalue_conversion (TREE_OPERAND (expr, 2))));
...@@ -198,7 +199,8 @@ java_truthvalue_conversion (tree expr) ...@@ -198,7 +199,8 @@ java_truthvalue_conversion (tree expr)
/* fall through to default */ /* fall through to default */
default: default:
return fold (build (NE_EXPR, boolean_type_node, expr, boolean_false_node)); return fold (build2 (NE_EXPR, boolean_type_node,
expr, boolean_false_node));
} }
} }
...@@ -237,7 +239,7 @@ flush_quick_stack (void) ...@@ -237,7 +239,7 @@ flush_quick_stack (void)
decl = find_stack_slot (stack_index, type); decl = find_stack_slot (stack_index, type);
if (decl != node) if (decl != node)
java_add_stmt (build (MODIFY_EXPR, TREE_TYPE (node), decl, node)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (node), decl, node));
stack_index += 1 + TYPE_IS_WIDE (type); stack_index += 1 + TYPE_IS_WIDE (type);
} }
} }
...@@ -512,11 +514,11 @@ java_stack_swap (void) ...@@ -512,11 +514,11 @@ java_stack_swap (void)
decl2 = find_stack_slot (stack_pointer - 2, type2); decl2 = find_stack_slot (stack_pointer - 2, type2);
temp = build_decl (VAR_DECL, NULL_TREE, type1); temp = build_decl (VAR_DECL, NULL_TREE, type1);
java_add_local_var (temp); java_add_local_var (temp);
java_add_stmt (build (MODIFY_EXPR, type1, temp, decl1)); java_add_stmt (build2 (MODIFY_EXPR, type1, temp, decl1));
java_add_stmt (build (MODIFY_EXPR, type2, java_add_stmt (build2 (MODIFY_EXPR, type2,
find_stack_slot (stack_pointer - 1, type2), find_stack_slot (stack_pointer - 1, type2),
decl2)); decl2));
java_add_stmt (build (MODIFY_EXPR, type1, java_add_stmt (build2 (MODIFY_EXPR, type1,
find_stack_slot (stack_pointer - 2, type1), find_stack_slot (stack_pointer - 2, type1),
temp)); temp));
stack_type_map[stack_pointer - 1] = type2; stack_type_map[stack_pointer - 1] = type2;
...@@ -564,7 +566,7 @@ java_stack_dup (int size, int offset) ...@@ -564,7 +566,7 @@ java_stack_dup (int size, int offset)
tree dst_decl = find_stack_slot (dst_index, type); tree dst_decl = find_stack_slot (dst_index, type);
java_add_stmt java_add_stmt
(build (MODIFY_EXPR, TREE_TYPE (dst_decl), dst_decl, src_decl)); (build2 (MODIFY_EXPR, TREE_TYPE (dst_decl), dst_decl, src_decl));
stack_type_map[dst_index] = type; stack_type_map[dst_index] = type;
} }
} }
...@@ -578,7 +580,7 @@ build_java_athrow (tree node) ...@@ -578,7 +580,7 @@ build_java_athrow (tree node)
{ {
tree call; tree call;
call = build (CALL_EXPR, call = build3 (CALL_EXPR,
void_type_node, void_type_node,
build_address_of (throw_node), build_address_of (throw_node),
build_tree_list (NULL_TREE, node), build_tree_list (NULL_TREE, node),
...@@ -598,7 +600,7 @@ build_java_jsr (int target_pc, int return_pc) ...@@ -598,7 +600,7 @@ build_java_jsr (int target_pc, int return_pc)
tree ret_label = fold (build1 (ADDR_EXPR, return_address_type_node, ret)); tree ret_label = fold (build1 (ADDR_EXPR, return_address_type_node, ret));
push_value (ret_label); push_value (ret_label);
flush_quick_stack (); flush_quick_stack ();
java_add_stmt (build (GOTO_EXPR, void_type_node, where)); java_add_stmt (build1 (GOTO_EXPR, void_type_node, where));
/* Do not need to emit the label here. We noted the existance of the /* Do not need to emit the label here. We noted the existance of the
label as a jump target in note_instructions; we'll emit the label label as a jump target in note_instructions; we'll emit the label
...@@ -608,7 +610,7 @@ build_java_jsr (int target_pc, int return_pc) ...@@ -608,7 +610,7 @@ build_java_jsr (int target_pc, int return_pc)
static void static void
build_java_ret (tree location) build_java_ret (tree location)
{ {
java_add_stmt (build (GOTO_EXPR, void_type_node, location)); java_add_stmt (build1 (GOTO_EXPR, void_type_node, location));
} }
/* Implementation of operations on array: new, load, store, length */ /* Implementation of operations on array: new, load, store, length */
...@@ -661,7 +663,7 @@ encode_newarray_type (tree type) ...@@ -661,7 +663,7 @@ encode_newarray_type (tree type)
static tree static tree
build_java_throw_out_of_bounds_exception (tree index) build_java_throw_out_of_bounds_exception (tree index)
{ {
tree node = build (CALL_EXPR, int_type_node, tree node = build3 (CALL_EXPR, int_type_node,
build_address_of (soft_badarrayindex_node), build_address_of (soft_badarrayindex_node),
build_tree_list (NULL_TREE, index), NULL_TREE); build_tree_list (NULL_TREE, index), NULL_TREE);
TREE_SIDE_EFFECTS (node) = 1; /* Allows expansion within ANDIF */ TREE_SIDE_EFFECTS (node) = 1; /* Allows expansion within ANDIF */
...@@ -683,7 +685,7 @@ build_java_array_length_access (tree node) ...@@ -683,7 +685,7 @@ build_java_array_length_access (tree node)
of type ptr_type_node at this point is `aconst_null; arraylength' of type ptr_type_node at this point is `aconst_null; arraylength'
or something equivalent. */ or something equivalent. */
if (type == ptr_type_node) if (type == ptr_type_node)
return build (CALL_EXPR, int_type_node, return build3 (CALL_EXPR, int_type_node,
build_address_of (soft_nullpointer_node), build_address_of (soft_nullpointer_node),
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
...@@ -694,7 +696,7 @@ build_java_array_length_access (tree node) ...@@ -694,7 +696,7 @@ build_java_array_length_access (tree node)
if (length >= 0) if (length >= 0)
return build_int_2 (length, 0); return build_int_2 (length, 0);
node = build (COMPONENT_REF, int_type_node, node = build3 (COMPONENT_REF, int_type_node,
build_java_indirect_ref (array_type, node, build_java_indirect_ref (array_type, node,
flag_check_references), flag_check_references),
lookup_field (&array_type, get_identifier ("length")), lookup_field (&array_type, get_identifier ("length")),
...@@ -713,9 +715,10 @@ java_check_reference (tree expr, int check) ...@@ -713,9 +715,10 @@ java_check_reference (tree expr, int check)
if (!flag_syntax_only && check) if (!flag_syntax_only && check)
{ {
expr = save_expr (expr); expr = save_expr (expr);
expr = build (COND_EXPR, TREE_TYPE (expr), expr = build3 (COND_EXPR, TREE_TYPE (expr),
build (EQ_EXPR, boolean_type_node, expr, null_pointer_node), build2 (EQ_EXPR, boolean_type_node,
build (CALL_EXPR, void_type_node, expr, null_pointer_node),
build3 (CALL_EXPR, void_type_node,
build_address_of (soft_nullpointer_node), build_address_of (soft_nullpointer_node),
NULL_TREE, NULL_TREE), NULL_TREE, NULL_TREE),
expr); expr);
...@@ -758,12 +761,12 @@ build_java_arrayaccess (tree array, tree type, tree index) ...@@ -758,12 +761,12 @@ build_java_arrayaccess (tree array, tree type, tree index)
tree test; tree test;
tree len = build_java_array_length_access (array); tree len = build_java_array_length_access (array);
TREE_TYPE (len) = unsigned_int_type_node; TREE_TYPE (len) = unsigned_int_type_node;
test = fold (build (GE_EXPR, boolean_type_node, test = fold (build2 (GE_EXPR, boolean_type_node,
convert (unsigned_int_type_node, index), convert (unsigned_int_type_node, index),
len)); len));
if (! integer_zerop (test)) if (! integer_zerop (test))
{ {
throw = build (TRUTH_ANDIF_EXPR, int_type_node, test, throw = build2 (TRUTH_ANDIF_EXPR, int_type_node, test,
build_java_throw_out_of_bounds_exception (index)); build_java_throw_out_of_bounds_exception (index));
/* allows expansion within COMPOUND */ /* allows expansion within COMPOUND */
TREE_SIDE_EFFECTS( throw ) = 1; TREE_SIDE_EFFECTS( throw ) = 1;
...@@ -773,16 +776,16 @@ build_java_arrayaccess (tree array, tree type, tree index) ...@@ -773,16 +776,16 @@ build_java_arrayaccess (tree array, tree type, tree index)
/* If checking bounds, wrap the index expr with a COMPOUND_EXPR in order /* If checking bounds, wrap the index expr with a COMPOUND_EXPR in order
to have the bounds check evaluated first. */ to have the bounds check evaluated first. */
if (throw != NULL_TREE) if (throw != NULL_TREE)
index = build (COMPOUND_EXPR, int_type_node, throw, index); index = build2 (COMPOUND_EXPR, int_type_node, throw, index);
data_field = lookup_field (&array_type, get_identifier ("data")); data_field = lookup_field (&array_type, get_identifier ("data"));
ref = build (COMPONENT_REF, TREE_TYPE (data_field), ref = build3 (COMPONENT_REF, TREE_TYPE (data_field),
build_java_indirect_ref (array_type, array, build_java_indirect_ref (array_type, array,
flag_check_references), flag_check_references),
data_field, NULL_TREE); data_field, NULL_TREE);
node = build (ARRAY_REF, type, ref, index, NULL_TREE, NULL_TREE); node = build4 (ARRAY_REF, type, ref, index, NULL_TREE, NULL_TREE);
return node; return node;
} }
...@@ -844,7 +847,7 @@ build_java_arraystore_check (tree array, tree object) ...@@ -844,7 +847,7 @@ build_java_arraystore_check (tree array, tree object)
} }
/* Build an invocation of _Jv_CheckArrayStore */ /* Build an invocation of _Jv_CheckArrayStore */
check = build (CALL_EXPR, void_type_node, check = build3 (CALL_EXPR, void_type_node,
build_address_of (soft_checkarraystore_node), build_address_of (soft_checkarraystore_node),
tree_cons (NULL_TREE, array, tree_cons (NULL_TREE, array,
build_tree_list (NULL_TREE, object)), build_tree_list (NULL_TREE, object)),
...@@ -907,7 +910,7 @@ build_newarray (int atype_value, tree length) ...@@ -907,7 +910,7 @@ build_newarray (int atype_value, tree length)
else else
type_arg = build_class_ref (prim_type); type_arg = build_class_ref (prim_type);
return build (CALL_EXPR, promote_type (type), return build3 (CALL_EXPR, promote_type (type),
build_address_of (soft_newarray_node), build_address_of (soft_newarray_node),
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
type_arg, type_arg,
...@@ -926,7 +929,7 @@ build_anewarray (tree class_type, tree length) ...@@ -926,7 +929,7 @@ build_anewarray (tree class_type, tree length)
host_integerp (length, 0) host_integerp (length, 0)
? tree_low_cst (length, 0) : -1); ? tree_low_cst (length, 0) : -1);
return build (CALL_EXPR, promote_type (type), return build3 (CALL_EXPR, promote_type (type),
build_address_of (soft_anewarray_node), build_address_of (soft_anewarray_node),
tree_cons (NULL_TREE, length, tree_cons (NULL_TREE, length,
tree_cons (NULL_TREE, build_class_ref (class_type), tree_cons (NULL_TREE, build_class_ref (class_type),
...@@ -959,12 +962,12 @@ expand_java_multianewarray (tree class_type, int ndim) ...@@ -959,12 +962,12 @@ expand_java_multianewarray (tree class_type, int ndim)
for( i = 0; i < ndim; i++ ) for( i = 0; i < ndim; i++ )
args = tree_cons (NULL_TREE, pop_value (int_type_node), args); args = tree_cons (NULL_TREE, pop_value (int_type_node), args);
push_value (build (CALL_EXPR, push_value (build3 (CALL_EXPR,
promote_type (class_type), promote_type (class_type),
build_address_of (soft_multianewarray_node), build_address_of (soft_multianewarray_node),
tree_cons (NULL_TREE, build_class_ref (class_type), tree_cons (NULL_TREE, build_class_ref (class_type),
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
build_int_2 (ndim, 0), args )), build_int_2 (ndim, 0), args)),
NULL_TREE)); NULL_TREE));
} }
...@@ -1001,7 +1004,7 @@ expand_java_arraystore (tree rhs_type_node) ...@@ -1001,7 +1004,7 @@ expand_java_arraystore (tree rhs_type_node)
} }
array = build_java_arrayaccess (array, rhs_type_node, index); array = build_java_arrayaccess (array, rhs_type_node, index);
java_add_stmt (build (MODIFY_EXPR, TREE_TYPE (array), array, rhs_node)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (array), array, rhs_node));
} }
/* Expand the evaluation of ARRAY[INDEX]. build_java_check_indexed_type makes /* Expand the evaluation of ARRAY[INDEX]. build_java_check_indexed_type makes
...@@ -1025,7 +1028,7 @@ expand_java_arrayload (tree lhs_type_node ) ...@@ -1025,7 +1028,7 @@ expand_java_arrayload (tree lhs_type_node )
/* The only way we could get a node of type ptr_type_node at this /* The only way we could get a node of type ptr_type_node at this
point is `aconst_null; arraylength' or something equivalent, so point is `aconst_null; arraylength' or something equivalent, so
unconditionally throw NullPointerException. */ unconditionally throw NullPointerException. */
load_node = build (CALL_EXPR, lhs_type_node, load_node = build3 (CALL_EXPR, lhs_type_node,
build_address_of (soft_nullpointer_node), build_address_of (soft_nullpointer_node),
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
else else
...@@ -1058,11 +1061,11 @@ expand_java_array_length (void) ...@@ -1058,11 +1061,11 @@ expand_java_array_length (void)
static tree static tree
build_java_monitor (tree call, tree object) build_java_monitor (tree call, tree object)
{ {
return (build (CALL_EXPR, return build3 (CALL_EXPR,
void_type_node, void_type_node,
build_address_of (call), build_address_of (call),
build_tree_list (NULL_TREE, object), build_tree_list (NULL_TREE, object),
NULL_TREE)); NULL_TREE);
} }
/* Emit code for one of the PUSHC instructions. */ /* Emit code for one of the PUSHC instructions. */
...@@ -1094,12 +1097,12 @@ static void ...@@ -1094,12 +1097,12 @@ static void
expand_java_return (tree type) expand_java_return (tree type)
{ {
if (type == void_type_node) if (type == void_type_node)
java_add_stmt (build (RETURN_EXPR, void_type_node, NULL)); java_add_stmt (build1 (RETURN_EXPR, void_type_node, NULL));
else else
{ {
tree retval = pop_value (type); tree retval = pop_value (type);
tree res = DECL_RESULT (current_function_decl); tree res = DECL_RESULT (current_function_decl);
retval = build (MODIFY_EXPR, TREE_TYPE (res), res, retval); retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, retval);
/* Handle the situation where the native integer type is smaller /* Handle the situation where the native integer type is smaller
than the JVM integer. It can happen for many cross compilers. than the JVM integer. It can happen for many cross compilers.
...@@ -1111,7 +1114,7 @@ expand_java_return (tree type) ...@@ -1111,7 +1114,7 @@ expand_java_return (tree type)
retval = build1(NOP_EXPR, TREE_TYPE(res), retval); retval = build1(NOP_EXPR, TREE_TYPE(res), retval);
TREE_SIDE_EFFECTS (retval) = 1; TREE_SIDE_EFFECTS (retval) = 1;
java_add_stmt (build (RETURN_EXPR, TREE_TYPE (retval), retval)); java_add_stmt (build1 (RETURN_EXPR, TREE_TYPE (retval), retval));
} }
} }
...@@ -1129,7 +1132,7 @@ expand_load_internal (int index, tree type, int pc) ...@@ -1129,7 +1132,7 @@ expand_load_internal (int index, tree type, int pc)
Hopefully this all gets optimized out. */ Hopefully this all gets optimized out. */
copy = build_decl (VAR_DECL, NULL_TREE, type); copy = build_decl (VAR_DECL, NULL_TREE, type);
java_add_local_var (copy); java_add_local_var (copy);
java_add_stmt (build (MODIFY_EXPR, TREE_TYPE (var), copy, var)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (var), copy, var));
push_value (copy); push_value (copy);
} }
...@@ -1162,7 +1165,7 @@ expand_java_NEW (tree type) ...@@ -1162,7 +1165,7 @@ expand_java_NEW (tree type)
if (! CLASS_LOADED_P (type)) if (! CLASS_LOADED_P (type))
load_class (type, 1); load_class (type, 1);
safe_layout_class (type); safe_layout_class (type);
push_value (build (CALL_EXPR, promote_type (type), push_value (build3 (CALL_EXPR, promote_type (type),
build_address_of (alloc_node), build_address_of (alloc_node),
build_tree_list (NULL_TREE, build_class_ref (type)), build_tree_list (NULL_TREE, build_class_ref (type)),
NULL_TREE)); NULL_TREE));
...@@ -1177,12 +1180,12 @@ build_get_class (tree value) ...@@ -1177,12 +1180,12 @@ build_get_class (tree value)
tree class_field = lookup_field (&dtable_type, get_identifier ("class")); tree class_field = lookup_field (&dtable_type, get_identifier ("class"));
tree vtable_field = lookup_field (&object_type_node, tree vtable_field = lookup_field (&object_type_node,
get_identifier ("vtable")); get_identifier ("vtable"));
return build (COMPONENT_REF, class_ptr_type, tree tmp = build3 (COMPONENT_REF, dtable_ptr_type,
build1 (INDIRECT_REF, dtable_type,
build (COMPONENT_REF, dtable_ptr_type,
build_java_indirect_ref (object_type_node, value, build_java_indirect_ref (object_type_node, value,
flag_check_references), flag_check_references),
vtable_field, NULL_TREE)), vtable_field, NULL_TREE);
return build3 (COMPONENT_REF, class_ptr_type,
build1 (INDIRECT_REF, dtable_type, tmp),
class_field, NULL_TREE); class_field, NULL_TREE);
} }
...@@ -1215,7 +1218,7 @@ build_instanceof (tree value, tree type) ...@@ -1215,7 +1218,7 @@ build_instanceof (tree value, tree type)
/* Anything except `null' is an instance of Object. Likewise, /* Anything except `null' is an instance of Object. Likewise,
if the object is known to be an instance of the class, then if the object is known to be an instance of the class, then
we only need to check for `null'. */ we only need to check for `null'. */
expr = build (NE_EXPR, itype, value, null_pointer_node); expr = build2 (NE_EXPR, itype, value, null_pointer_node);
} }
else if (! TYPE_ARRAY_P (type) else if (! TYPE_ARRAY_P (type)
&& ! TYPE_ARRAY_P (valtype) && ! TYPE_ARRAY_P (valtype)
...@@ -1233,17 +1236,17 @@ build_instanceof (tree value, tree type) ...@@ -1233,17 +1236,17 @@ build_instanceof (tree value, tree type)
else if (DECL_P (klass) && CLASS_FINAL (klass)) else if (DECL_P (klass) && CLASS_FINAL (klass))
{ {
tree save = save_expr (value); tree save = save_expr (value);
expr = build (COND_EXPR, itype, expr = build3 (COND_EXPR, itype,
build (NE_EXPR, boolean_type_node, build2 (NE_EXPR, boolean_type_node,
save, null_pointer_node), save, null_pointer_node),
build (EQ_EXPR, itype, build2 (EQ_EXPR, itype,
build_get_class (save), build_get_class (save),
build_class_ref (type)), build_class_ref (type)),
boolean_false_node); boolean_false_node);
} }
else else
{ {
expr = build (CALL_EXPR, itype, expr = build3 (CALL_EXPR, itype,
build_address_of (soft_instanceof_node), build_address_of (soft_instanceof_node),
tree_cons (NULL_TREE, value, tree_cons (NULL_TREE, value,
build_tree_list (NULL_TREE, build_tree_list (NULL_TREE,
...@@ -1266,7 +1269,7 @@ static void ...@@ -1266,7 +1269,7 @@ static void
expand_java_CHECKCAST (tree type) expand_java_CHECKCAST (tree type)
{ {
tree value = pop_value (ptr_type_node); tree value = pop_value (ptr_type_node);
value = build (CALL_EXPR, promote_type (type), value = build3 (CALL_EXPR, promote_type (type),
build_address_of (soft_checkcast_node), build_address_of (soft_checkcast_node),
tree_cons (NULL_TREE, build_class_ref (type), tree_cons (NULL_TREE, build_class_ref (type),
build_tree_list (NULL_TREE, value)), build_tree_list (NULL_TREE, value)),
...@@ -1283,8 +1286,8 @@ expand_iinc (unsigned int local_var_index, int ival, int pc) ...@@ -1283,8 +1286,8 @@ expand_iinc (unsigned int local_var_index, int ival, int pc)
flush_quick_stack (); flush_quick_stack ();
local_var = find_local_variable (local_var_index, int_type_node, pc); local_var = find_local_variable (local_var_index, int_type_node, pc);
constant_value = build_int_2 (ival, ival < 0 ? -1 : 0); constant_value = build_int_2 (ival, ival < 0 ? -1 : 0);
res = fold (build (PLUS_EXPR, int_type_node, local_var, constant_value)); res = fold (build2 (PLUS_EXPR, int_type_node, local_var, constant_value));
java_add_stmt (build (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res));
update_aliases (local_var, local_var_index); update_aliases (local_var, local_var_index);
} }
...@@ -1328,7 +1331,7 @@ build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2) ...@@ -1328,7 +1331,7 @@ build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2)
if (! call) if (! call)
abort (); abort ();
call = build (CALL_EXPR, type, call = build3 (CALL_EXPR, type,
build_address_of (call), build_address_of (call),
tree_cons (NULL_TREE, arg1, tree_cons (NULL_TREE, arg1,
build_tree_list (NULL_TREE, arg2)), build_tree_list (NULL_TREE, arg2)),
...@@ -1353,22 +1356,22 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) ...@@ -1353,22 +1356,22 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
case LSHIFT_EXPR: case LSHIFT_EXPR:
case RSHIFT_EXPR: case RSHIFT_EXPR:
mask = build_int_2 (TYPE_PRECISION (TREE_TYPE (arg1)) - 1, 0); mask = build_int_2 (TYPE_PRECISION (TREE_TYPE (arg1)) - 1, 0);
arg2 = fold (build (BIT_AND_EXPR, int_type_node, arg2, mask)); arg2 = fold (build2 (BIT_AND_EXPR, int_type_node, arg2, mask));
break; break;
case COMPARE_L_EXPR: /* arg1 > arg2 ? 1 : arg1 == arg2 ? 0 : -1 */ case COMPARE_L_EXPR: /* arg1 > arg2 ? 1 : arg1 == arg2 ? 0 : -1 */
case COMPARE_G_EXPR: /* arg1 < arg2 ? -1 : arg1 == arg2 ? 0 : 1 */ case COMPARE_G_EXPR: /* arg1 < arg2 ? -1 : arg1 == arg2 ? 0 : 1 */
arg1 = save_expr (arg1); arg2 = save_expr (arg2); arg1 = save_expr (arg1); arg2 = save_expr (arg2);
{ {
tree ifexp1 = fold ( build (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR, tree ifexp1 = fold (build2 (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR,
boolean_type_node, arg1, arg2)); boolean_type_node, arg1, arg2));
tree ifexp2 = fold ( build (EQ_EXPR, boolean_type_node, arg1, arg2)); tree ifexp2 = fold (build2 (EQ_EXPR, boolean_type_node, arg1, arg2));
tree second_compare = fold (build (COND_EXPR, int_type_node, tree second_compare = fold (build3 (COND_EXPR, int_type_node,
ifexp2, integer_zero_node, ifexp2, integer_zero_node,
op == COMPARE_L_EXPR op == COMPARE_L_EXPR
? integer_minus_one_node ? integer_minus_one_node
: integer_one_node)); : integer_one_node));
return fold (build (COND_EXPR, int_type_node, ifexp1, return fold (build3 (COND_EXPR, int_type_node, ifexp1,
op == COMPARE_L_EXPR ? integer_one_node op == COMPARE_L_EXPR ? integer_one_node
: integer_minus_one_node, : integer_minus_one_node,
second_compare)); second_compare));
...@@ -1376,12 +1379,12 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) ...@@ -1376,12 +1379,12 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
case COMPARE_EXPR: case COMPARE_EXPR:
arg1 = save_expr (arg1); arg2 = save_expr (arg2); arg1 = save_expr (arg1); arg2 = save_expr (arg2);
{ {
tree ifexp1 = fold ( build (LT_EXPR, boolean_type_node, arg1, arg2)); tree ifexp1 = fold (build2 (LT_EXPR, boolean_type_node, arg1, arg2));
tree ifexp2 = fold ( build (GT_EXPR, boolean_type_node, arg1, arg2)); tree ifexp2 = fold (build2 (GT_EXPR, boolean_type_node, arg1, arg2));
tree second_compare = fold ( build (COND_EXPR, int_type_node, tree second_compare = fold (build3 (COND_EXPR, int_type_node,
ifexp2, integer_one_node, ifexp2, integer_one_node,
integer_zero_node)); integer_zero_node));
return fold (build (COND_EXPR, int_type_node, return fold (build3 (COND_EXPR, int_type_node,
ifexp1, integer_minus_one_node, second_compare)); ifexp1, integer_minus_one_node, second_compare));
} }
case TRUNC_DIV_EXPR: case TRUNC_DIV_EXPR:
...@@ -1395,7 +1398,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) ...@@ -1395,7 +1398,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
arg1 = convert (double_type_node, arg1); arg1 = convert (double_type_node, arg1);
arg2 = convert (double_type_node, arg2); arg2 = convert (double_type_node, arg2);
} }
call = build (CALL_EXPR, double_type_node, call = build3 (CALL_EXPR, double_type_node,
build_address_of (soft_fmod_node), build_address_of (soft_fmod_node),
tree_cons (NULL_TREE, arg1, tree_cons (NULL_TREE, arg1,
build_tree_list (NULL_TREE, arg2)), build_tree_list (NULL_TREE, arg2)),
...@@ -1413,7 +1416,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) ...@@ -1413,7 +1416,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
break; break;
default: ; default: ;
} }
return fold (build (op, type, arg1, arg2)); return fold (build2 (op, type, arg1, arg2));
} }
static void static void
...@@ -1537,14 +1540,14 @@ build_field_ref (tree self_value, tree self_class, tree name) ...@@ -1537,14 +1540,14 @@ build_field_ref (tree self_value, tree self_class, tree name)
(field_decl, &TYPE_OTABLE_METHODS (output_class)), (field_decl, &TYPE_OTABLE_METHODS (output_class)),
0); 0);
tree field_offset tree field_offset
= build (ARRAY_REF, integer_type_node, = build4 (ARRAY_REF, integer_type_node,
TYPE_OTABLE_DECL (output_class), otable_index, TYPE_OTABLE_DECL (output_class), otable_index,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
tree address; tree address;
field_offset = fold (convert (sizetype, field_offset)); field_offset = fold (convert (sizetype, field_offset));
address address
= fold (build (PLUS_EXPR, = fold (build2 (PLUS_EXPR,
build_pointer_type (TREE_TYPE (field_decl)), build_pointer_type (TREE_TYPE (field_decl)),
self_value, field_offset)); self_value, field_offset));
return fold (build1 (INDIRECT_REF, TREE_TYPE (field_decl), address)); return fold (build1 (INDIRECT_REF, TREE_TYPE (field_decl), address));
...@@ -1552,7 +1555,7 @@ build_field_ref (tree self_value, tree self_class, tree name) ...@@ -1552,7 +1555,7 @@ build_field_ref (tree self_value, tree self_class, tree name)
self_value = build_java_indirect_ref (TREE_TYPE (TREE_TYPE (self_value)), self_value = build_java_indirect_ref (TREE_TYPE (TREE_TYPE (self_value)),
self_value, check); self_value, check);
return fold (build (COMPONENT_REF, TREE_TYPE (field_decl), return fold (build3 (COMPONENT_REF, TREE_TYPE (field_decl),
self_value, field_decl, NULL_TREE)); self_value, field_decl, NULL_TREE));
} }
} }
...@@ -1617,10 +1620,10 @@ expand_compare (enum tree_code condition, tree value1, tree value2, ...@@ -1617,10 +1620,10 @@ expand_compare (enum tree_code condition, tree value1, tree value2,
int target_pc) int target_pc)
{ {
tree target = lookup_label (target_pc); tree target = lookup_label (target_pc);
tree cond = fold (build (condition, boolean_type_node, value1, value2)); tree cond = fold (build2 (condition, boolean_type_node, value1, value2));
java_add_stmt java_add_stmt
(build (COND_EXPR, void_type_node, java_truthvalue_conversion (cond), (build3 (COND_EXPR, void_type_node, java_truthvalue_conversion (cond),
build (GOTO_EXPR, void_type_node, target), build1 (GOTO_EXPR, void_type_node, target),
build_java_empty_stmt ())); build_java_empty_stmt ()));
} }
...@@ -1655,7 +1658,7 @@ expand_java_goto (int target_pc) ...@@ -1655,7 +1658,7 @@ expand_java_goto (int target_pc)
{ {
tree target_label = lookup_label (target_pc); tree target_label = lookup_label (target_pc);
flush_quick_stack (); flush_quick_stack ();
java_add_stmt (build (GOTO_EXPR, void_type_node, target_label)); java_add_stmt (build1 (GOTO_EXPR, void_type_node, target_label));
} }
static tree static tree
...@@ -1664,15 +1667,15 @@ expand_java_switch (tree selector, int default_pc) ...@@ -1664,15 +1667,15 @@ expand_java_switch (tree selector, int default_pc)
tree switch_expr, x; tree switch_expr, x;
flush_quick_stack (); flush_quick_stack ();
switch_expr = build (SWITCH_EXPR, TREE_TYPE (selector), selector, switch_expr = build3 (SWITCH_EXPR, TREE_TYPE (selector), selector,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
java_add_stmt (switch_expr); java_add_stmt (switch_expr);
x = build (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, x = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE,
create_artificial_label ()); create_artificial_label ());
append_to_statement_list (x, &SWITCH_BODY (switch_expr)); append_to_statement_list (x, &SWITCH_BODY (switch_expr));
x = build (GOTO_EXPR, void_type_node, lookup_label (default_pc)); x = build1 (GOTO_EXPR, void_type_node, lookup_label (default_pc));
append_to_statement_list (x, &SWITCH_BODY (switch_expr)); append_to_statement_list (x, &SWITCH_BODY (switch_expr));
return switch_expr; return switch_expr;
...@@ -1686,11 +1689,11 @@ expand_java_add_case (tree switch_expr, int match, int target_pc) ...@@ -1686,11 +1689,11 @@ expand_java_add_case (tree switch_expr, int match, int target_pc)
value = build_int_2 (match, match < 0 ? -1 : 0); value = build_int_2 (match, match < 0 ? -1 : 0);
TREE_TYPE (value) = TREE_TYPE (switch_expr); TREE_TYPE (value) = TREE_TYPE (switch_expr);
x = build (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE, x = build3 (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE,
create_artificial_label ()); create_artificial_label ());
append_to_statement_list (x, &SWITCH_BODY (switch_expr)); append_to_statement_list (x, &SWITCH_BODY (switch_expr));
x = build (GOTO_EXPR, void_type_node, lookup_label (target_pc)); x = build1 (GOTO_EXPR, void_type_node, lookup_label (target_pc));
append_to_statement_list (x, &SWITCH_BODY (switch_expr)); append_to_statement_list (x, &SWITCH_BODY (switch_expr));
} }
...@@ -1756,7 +1759,7 @@ build_class_init (tree clas, tree expr) ...@@ -1756,7 +1759,7 @@ build_class_init (tree clas, tree expr)
if (always_initialize_class_p) if (always_initialize_class_p)
{ {
init = build (CALL_EXPR, void_type_node, init = build3 (CALL_EXPR, void_type_node,
build_address_of (soft_initclass_node), build_address_of (soft_initclass_node),
build_tree_list (NULL_TREE, build_class_ref (clas)), build_tree_list (NULL_TREE, build_class_ref (clas)),
NULL_TREE); NULL_TREE);
...@@ -1787,25 +1790,25 @@ build_class_init (tree clas, tree expr) ...@@ -1787,25 +1790,25 @@ build_class_init (tree clas, tree expr)
DECL_IGNORED_P (*init_test_decl) = 1; DECL_IGNORED_P (*init_test_decl) = 1;
} }
init = build (CALL_EXPR, void_type_node, init = build3 (CALL_EXPR, void_type_node,
build_address_of (soft_initclass_node), build_address_of (soft_initclass_node),
build_tree_list (NULL_TREE, build_class_ref (clas)), build_tree_list (NULL_TREE, build_class_ref (clas)),
NULL_TREE); NULL_TREE);
TREE_SIDE_EFFECTS (init) = 1; TREE_SIDE_EFFECTS (init) = 1;
init = build (COND_EXPR, void_type_node, init = build3 (COND_EXPR, void_type_node,
build (EQ_EXPR, boolean_type_node, build2 (EQ_EXPR, boolean_type_node,
*init_test_decl, boolean_false_node), *init_test_decl, boolean_false_node),
init, integer_zero_node); init, integer_zero_node);
TREE_SIDE_EFFECTS (init) = 1; TREE_SIDE_EFFECTS (init) = 1;
init = build (COMPOUND_EXPR, TREE_TYPE (expr), init, init = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init,
build (MODIFY_EXPR, boolean_type_node, build2 (MODIFY_EXPR, boolean_type_node,
*init_test_decl, boolean_true_node)); *init_test_decl, boolean_true_node));
TREE_SIDE_EFFECTS (init) = 1; TREE_SIDE_EFFECTS (init) = 1;
} }
if (expr != NULL_TREE) if (expr != NULL_TREE)
{ {
expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr); expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
TREE_SIDE_EFFECTS (expr) = 1; TREE_SIDE_EFFECTS (expr) = 1;
return expr; return expr;
} }
...@@ -1832,7 +1835,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, ...@@ -1832,7 +1835,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
tree table_index tree table_index
= build_int_2 (get_symbol_table_index = build_int_2 (get_symbol_table_index
(method, &TYPE_ATABLE_METHODS (output_class)), 0); (method, &TYPE_ATABLE_METHODS (output_class)), 0);
func = build (ARRAY_REF, method_ptr_type_node, func = build4 (ARRAY_REF, method_ptr_type_node,
TYPE_ATABLE_DECL (output_class), table_index, TYPE_ATABLE_DECL (output_class), table_index,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
} }
...@@ -1860,8 +1863,9 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, ...@@ -1860,8 +1863,9 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
ncode_ident = get_identifier ("ncode"); ncode_ident = get_identifier ("ncode");
if (methods_ident == NULL_TREE) if (methods_ident == NULL_TREE)
methods_ident = get_identifier ("methods"); methods_ident = get_identifier ("methods");
ref = build (COMPONENT_REF, method_ptr_type_node, ref, ref = build3 (COMPONENT_REF, method_ptr_type_node, ref,
lookup_field (&class_type_node, methods_ident), NULL_TREE); lookup_field (&class_type_node, methods_ident),
NULL_TREE);
for (meth = TYPE_METHODS (self_type); for (meth = TYPE_METHODS (self_type);
; meth = TREE_CHAIN (meth)) ; meth = TREE_CHAIN (meth))
{ {
...@@ -1873,10 +1877,10 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, ...@@ -1873,10 +1877,10 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
method_index++; method_index++;
} }
method_index *= int_size_in_bytes (method_type_node); method_index *= int_size_in_bytes (method_type_node);
ref = fold (build (PLUS_EXPR, method_ptr_type_node, ref = fold (build2 (PLUS_EXPR, method_ptr_type_node,
ref, build_int_2 (method_index, 0))); ref, build_int_2 (method_index, 0)));
ref = build1 (INDIRECT_REF, method_type_node, ref); ref = build1 (INDIRECT_REF, method_type_node, ref);
func = build (COMPONENT_REF, nativecode_ptr_type_node, func = build3 (COMPONENT_REF, nativecode_ptr_type_node,
ref, lookup_field (&method_type_node, ncode_ident), ref, lookup_field (&method_type_node, ncode_ident),
NULL_TREE); NULL_TREE);
} }
...@@ -1901,7 +1905,7 @@ invoke_build_dtable (int is_invoke_interface, tree arg_list) ...@@ -1901,7 +1905,7 @@ invoke_build_dtable (int is_invoke_interface, tree arg_list)
dtable_ident = get_identifier ("vtable"); dtable_ident = get_identifier ("vtable");
dtable = build_java_indirect_ref (object_type_node, objectref, dtable = build_java_indirect_ref (object_type_node, objectref,
flag_check_references); flag_check_references);
dtable = build (COMPONENT_REF, dtable_ptr_type, dtable, dtable = build3 (COMPONENT_REF, dtable_ptr_type, dtable,
lookup_field (&object_type_node, dtable_ident), NULL_TREE); lookup_field (&object_type_node, dtable_ident), NULL_TREE);
return dtable; return dtable;
...@@ -1956,7 +1960,7 @@ build_invokevirtual (tree dtable, tree method) ...@@ -1956,7 +1960,7 @@ build_invokevirtual (tree dtable, tree method)
otable_index otable_index
= build_int_2 (get_symbol_table_index = build_int_2 (get_symbol_table_index
(method, &TYPE_OTABLE_METHODS (output_class)), 0); (method, &TYPE_OTABLE_METHODS (output_class)), 0);
method_index = build (ARRAY_REF, integer_type_node, method_index = build4 (ARRAY_REF, integer_type_node,
TYPE_OTABLE_DECL (output_class), TYPE_OTABLE_DECL (output_class),
otable_index, NULL_TREE, NULL_TREE); otable_index, NULL_TREE, NULL_TREE);
} }
...@@ -1974,7 +1978,7 @@ build_invokevirtual (tree dtable, tree method) ...@@ -1974,7 +1978,7 @@ build_invokevirtual (tree dtable, tree method)
size_int (TARGET_VTABLE_USES_DESCRIPTORS)); size_int (TARGET_VTABLE_USES_DESCRIPTORS));
} }
func = fold (build (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable, func = fold (build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
convert (nativecode_ptr_ptr_type_node, method_index))); convert (nativecode_ptr_ptr_type_node, method_index)));
if (TARGET_VTABLE_USES_DESCRIPTORS) if (TARGET_VTABLE_USES_DESCRIPTORS)
...@@ -2003,7 +2007,7 @@ build_invokeinterface (tree dtable, tree method) ...@@ -2003,7 +2007,7 @@ build_invokeinterface (tree dtable, tree method)
dtable = build_java_indirect_ref (dtable_type, dtable, dtable = build_java_indirect_ref (dtable_type, dtable,
flag_check_references); flag_check_references);
dtable = build (COMPONENT_REF, class_ptr_type, dtable, dtable = build3 (COMPONENT_REF, class_ptr_type, dtable,
lookup_field (&dtable_type, class_ident), NULL_TREE); lookup_field (&dtable_type, class_ident), NULL_TREE);
interface = DECL_CONTEXT (method); interface = DECL_CONTEXT (method);
...@@ -2016,7 +2020,7 @@ build_invokeinterface (tree dtable, tree method) ...@@ -2016,7 +2020,7 @@ build_invokeinterface (tree dtable, tree method)
otable_index otable_index
= build_int_2 (get_symbol_table_index = build_int_2 (get_symbol_table_index
(method, &TYPE_OTABLE_METHODS (output_class)), 0); (method, &TYPE_OTABLE_METHODS (output_class)), 0);
idx = build (ARRAY_REF, integer_type_node, idx = build4 (ARRAY_REF, integer_type_node,
TYPE_OTABLE_DECL (output_class), otable_index, TYPE_OTABLE_DECL (output_class), otable_index,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
} }
...@@ -2027,7 +2031,7 @@ build_invokeinterface (tree dtable, tree method) ...@@ -2027,7 +2031,7 @@ build_invokeinterface (tree dtable, tree method)
tree_cons (NULL_TREE, build_class_ref (interface), tree_cons (NULL_TREE, build_class_ref (interface),
build_tree_list (NULL_TREE, idx))); build_tree_list (NULL_TREE, idx)));
return build (CALL_EXPR, ptr_type_node, return build3 (CALL_EXPR, ptr_type_node,
build_address_of (soft_lookupinterfacemethod_node), build_address_of (soft_lookupinterfacemethod_node),
lookup_arg, NULL_TREE); lookup_arg, NULL_TREE);
} }
...@@ -2150,13 +2154,14 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2150,13 +2154,14 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
else else
func = build1 (NOP_EXPR, build_pointer_type (method_type), func); func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
call = build (CALL_EXPR, TREE_TYPE (method_type), func, arg_list, NULL_TREE); call = build3 (CALL_EXPR, TREE_TYPE (method_type),
func, arg_list, NULL_TREE);
TREE_SIDE_EFFECTS (call) = 1; TREE_SIDE_EFFECTS (call) = 1;
call = check_for_builtin (method, call); call = check_for_builtin (method, call);
if (check != NULL_TREE) if (check != NULL_TREE)
{ {
call = build (COMPOUND_EXPR, TREE_TYPE (call), check, call); call = build2 (COMPOUND_EXPR, TREE_TYPE (call), check, call);
TREE_SIDE_EFFECTS (call) = 1; TREE_SIDE_EFFECTS (call) = 1;
} }
...@@ -2231,8 +2236,8 @@ build_jni_stub (tree method) ...@@ -2231,8 +2236,8 @@ build_jni_stub (tree method)
TREE_TYPE (block) = TREE_TYPE (TREE_TYPE (method)); TREE_TYPE (block) = TREE_TYPE (TREE_TYPE (method));
/* Compute the local `env' by calling _Jv_GetJNIEnvNewFrame. */ /* Compute the local `env' by calling _Jv_GetJNIEnvNewFrame. */
body = build (MODIFY_EXPR, ptr_type_node, env_var, body = build2 (MODIFY_EXPR, ptr_type_node, env_var,
build (CALL_EXPR, ptr_type_node, build3 (CALL_EXPR, ptr_type_node,
build_address_of (soft_getjnienvnewframe_node), build_address_of (soft_getjnienvnewframe_node),
build_tree_list (NULL_TREE, klass), build_tree_list (NULL_TREE, klass),
NULL_TREE)); NULL_TREE));
...@@ -2294,40 +2299,40 @@ build_jni_stub (tree method) ...@@ -2294,40 +2299,40 @@ build_jni_stub (tree method)
jni_func_type = build_pointer_type (tem); jni_func_type = build_pointer_type (tem);
jnifunc = build (COND_EXPR, ptr_type_node, jnifunc = build3 (COND_EXPR, ptr_type_node,
meth_var, meth_var, meth_var, meth_var,
build (MODIFY_EXPR, ptr_type_node, build2 (MODIFY_EXPR, ptr_type_node, meth_var,
meth_var, build3 (CALL_EXPR, ptr_type_node,
build (CALL_EXPR, ptr_type_node, build_address_of
build_address_of (soft_lookupjnimethod_node), (soft_lookupjnimethod_node),
lookup_arg, NULL_TREE))); lookup_arg, NULL_TREE)));
/* Now we make the actual JNI call via the resulting function /* Now we make the actual JNI call via the resulting function
pointer. */ pointer. */
call = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)), call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
build1 (NOP_EXPR, jni_func_type, jnifunc), build1 (NOP_EXPR, jni_func_type, jnifunc),
args, NULL_TREE); args, NULL_TREE);
/* If the JNI call returned a result, capture it here. If we had to /* If the JNI call returned a result, capture it here. If we had to
unwrap JNI object results, we would do that here. */ unwrap JNI object results, we would do that here. */
if (res_var != NULL_TREE) if (res_var != NULL_TREE)
call = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (method)), call = build2 (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (method)),
res_var, call); res_var, call);
TREE_SIDE_EFFECTS (call) = 1; TREE_SIDE_EFFECTS (call) = 1;
CAN_COMPLETE_NORMALLY (call) = 1; CAN_COMPLETE_NORMALLY (call) = 1;
body = build (COMPOUND_EXPR, void_type_node, body, call); body = build2 (COMPOUND_EXPR, void_type_node, body, call);
TREE_SIDE_EFFECTS (body) = 1; TREE_SIDE_EFFECTS (body) = 1;
/* Now free the environment we allocated. */ /* Now free the environment we allocated. */
call = build (CALL_EXPR, ptr_type_node, call = build3 (CALL_EXPR, ptr_type_node,
build_address_of (soft_jnipopsystemframe_node), build_address_of (soft_jnipopsystemframe_node),
build_tree_list (NULL_TREE, env_var), build_tree_list (NULL_TREE, env_var),
NULL_TREE); NULL_TREE);
TREE_SIDE_EFFECTS (call) = 1; TREE_SIDE_EFFECTS (call) = 1;
CAN_COMPLETE_NORMALLY (call) = 1; CAN_COMPLETE_NORMALLY (call) = 1;
body = build (COMPOUND_EXPR, void_type_node, body, call); body = build2 (COMPOUND_EXPR, void_type_node, body, call);
TREE_SIDE_EFFECTS (body) = 1; TREE_SIDE_EFFECTS (body) = 1;
/* Finally, do the return. */ /* Finally, do the return. */
...@@ -2344,15 +2349,15 @@ build_jni_stub (tree method) ...@@ -2344,15 +2349,15 @@ build_jni_stub (tree method)
drt = TREE_TYPE (DECL_RESULT (method)); drt = TREE_TYPE (DECL_RESULT (method));
if (drt != TREE_TYPE (res_var)) if (drt != TREE_TYPE (res_var))
res_var = build1 (CONVERT_EXPR, drt, res_var); res_var = build1 (CONVERT_EXPR, drt, res_var);
res_var = build (MODIFY_EXPR, drt, DECL_RESULT (method), res_var); res_var = build2 (MODIFY_EXPR, drt, DECL_RESULT (method), res_var);
TREE_SIDE_EFFECTS (res_var) = 1; TREE_SIDE_EFFECTS (res_var) = 1;
} }
body = build (COMPOUND_EXPR, void_type_node, body, body = build2 (COMPOUND_EXPR, void_type_node, body,
build1 (RETURN_EXPR, res_type, res_var)); build1 (RETURN_EXPR, res_type, res_var));
TREE_SIDE_EFFECTS (body) = 1; TREE_SIDE_EFFECTS (body) = 1;
bind = build (BIND_EXPR, void_type_node, BLOCK_VARS (block), bind = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
body, block); body, block);
return bind; return bind;
} }
...@@ -2435,8 +2440,8 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) ...@@ -2435,8 +2440,8 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
field_decl, field_decl); field_decl, field_decl);
} }
} }
java_add_stmt (build (MODIFY_EXPR, java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (field_ref),
TREE_TYPE (field_ref), field_ref, new_value)); field_ref, new_value));
} }
else else
push_value (field_ref); push_value (field_ref);
...@@ -2642,7 +2647,7 @@ expand_byte_code (JCF *jcf, tree method) ...@@ -2642,7 +2647,7 @@ expand_byte_code (JCF *jcf, tree method)
tree label = lookup_label (PC); tree label = lookup_label (PC);
flush_quick_stack (); flush_quick_stack ();
if ((instruction_bits [PC] & BCODE_TARGET) != 0) if ((instruction_bits [PC] & BCODE_TARGET) != 0)
java_add_stmt (build (LABEL_EXPR, void_type_node, label)); java_add_stmt (build1 (LABEL_EXPR, void_type_node, label));
if (LABEL_VERIFIED (label) || PC == 0) if (LABEL_VERIFIED (label) || PC == 0)
load_type_state (label); load_type_state (label);
} }
...@@ -2931,7 +2936,7 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops, ...@@ -2931,7 +2936,7 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops,
type = TREE_TYPE (value); \ type = TREE_TYPE (value); \
decl = find_local_variable (index, type, oldpc); \ decl = find_local_variable (index, type, oldpc); \
set_local_type (index, type); \ set_local_type (index, type); \
java_add_stmt (build (MODIFY_EXPR, type, decl, value)); \ java_add_stmt (build2 (MODIFY_EXPR, type, decl, value)); \
update_aliases (decl, index); \ update_aliases (decl, index); \
} }
...@@ -3191,7 +3196,7 @@ force_evaluation_order (tree node) ...@@ -3191,7 +3196,7 @@ force_evaluation_order (tree node)
{ {
tree saved = save_expr (force_evaluation_order (TREE_VALUE (arg))); tree saved = save_expr (force_evaluation_order (TREE_VALUE (arg)));
cmp = (cmp == NULL_TREE ? saved : cmp = (cmp == NULL_TREE ? saved :
build (COMPOUND_EXPR, void_type_node, cmp, saved)); build2 (COMPOUND_EXPR, void_type_node, cmp, saved));
TREE_VALUE (arg) = saved; TREE_VALUE (arg) = saved;
} }
...@@ -3200,7 +3205,7 @@ force_evaluation_order (tree node) ...@@ -3200,7 +3205,7 @@ force_evaluation_order (tree node)
if (cmp) if (cmp)
{ {
cmp = build (COMPOUND_EXPR, TREE_TYPE (node), cmp, node); cmp = build2 (COMPOUND_EXPR, TREE_TYPE (node), cmp, node);
if (TREE_TYPE (cmp) != void_type_node) if (TREE_TYPE (cmp) != void_type_node)
cmp = save_expr (cmp); cmp = save_expr (cmp);
CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node); CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment