aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-09-18 19:10:15 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-09-18 19:10:15 +0000
commitc298ec4e20cdb97f611f92920c7b7ac2a21820e4 (patch)
tree7a0442d15d00052dffd5178ca24bfb40f1386122 /gcc/java/expr.c
parent2c05c0dad5f65ca5e17cfd16429d686fada2221c (diff)
downloadgcc-c298ec4e20cdb97f611f92920c7b7ac2a21820e4.zip
gcc-c298ec4e20cdb97f611f92920c7b7ac2a21820e4.tar.gz
gcc-c298ec4e20cdb97f611f92920c7b7ac2a21820e4.tar.bz2
builtins.c (max_builtin, [...]): Use fold_buildN.
2005-09-18 James A. Morrison <phython@gcc.gnu.org> * builtins.c (max_builtin, min_builtin, abs_builtin, java_build_function_call_expr): Use fold_buildN. * class.c (layout_class_method): Likewise. * expr.c (java_truthvalue_conversion, build_java_jsr, build_java_arrayaccess, expand_java_arrayload, expand_iinc, build_java_binop, build_field_ref, expand_compare, build_known_method_ref, build_invokevirtual, process_jvm_instruction): Likewise. * parse.y (patch_binop, patch_exit_expr): Likewise. * typeck.c (convert_ieee_real_to_integer): Likewise. (convert): Don't call fold after convert_ieee_real_to_integer. From-SVN: r104407
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c93
1 files changed, 46 insertions, 47 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 8aa49ad..a21e151 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -192,10 +192,9 @@ java_truthvalue_conversion (tree expr)
case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */
- 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, 2))));
+ 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, 2)));
case NOP_EXPR:
/* If this is widening the argument, we can ignore it. */
@@ -205,8 +204,8 @@ java_truthvalue_conversion (tree expr)
/* fall through to default */
default:
- return fold (build2 (NE_EXPR, boolean_type_node,
- expr, boolean_false_node));
+ return fold_build2 (NE_EXPR, boolean_type_node,
+ expr, boolean_false_node);
}
}
@@ -729,7 +728,7 @@ build_java_jsr (int target_pc, int return_pc)
{
tree where = lookup_label (target_pc);
tree ret = lookup_label (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);
flush_quick_stack ();
java_add_stmt (build1 (GOTO_EXPR, void_type_node, where));
@@ -896,9 +895,9 @@ build_java_arrayaccess (tree array, tree type, tree index)
tree test;
tree len = convert (unsigned_int_type_node,
build_java_array_length_access (array));
- test = fold (build2 (GE_EXPR, boolean_type_node,
- convert (unsigned_int_type_node, index),
- len));
+ test = fold_build2 (GE_EXPR, boolean_type_node,
+ convert (unsigned_int_type_node, index),
+ len);
if (! integer_zerop (test))
{
throw = build2 (TRUTH_ANDIF_EXPR, int_type_node, test,
@@ -1190,7 +1189,7 @@ expand_java_arrayload (tree lhs_type_node)
lhs_type_node,
index_node);
if (INTEGRAL_TYPE_P (lhs_type_node) && TYPE_PRECISION (lhs_type_node) <= 32)
- load_node = fold (build1 (NOP_EXPR, int_type_node, load_node));
+ load_node = fold_build1 (NOP_EXPR, int_type_node, load_node);
push_value (load_node);
}
@@ -1451,7 +1450,7 @@ expand_iinc (unsigned int local_var_index, int ival, int pc)
flush_quick_stack ();
local_var = find_local_variable (local_var_index, int_type_node, pc);
constant_value = build_int_cst (NULL_TREE, ival);
- res = fold (build2 (PLUS_EXPR, int_type_node, local_var, constant_value));
+ res = fold_build2 (PLUS_EXPR, int_type_node, local_var, constant_value);
java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res));
update_aliases (local_var, local_var_index, pc);
}
@@ -1522,36 +1521,36 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
case RSHIFT_EXPR:
mask = build_int_cst (NULL_TREE,
TYPE_PRECISION (TREE_TYPE (arg1)) - 1);
- arg2 = fold (build2 (BIT_AND_EXPR, int_type_node, arg2, mask));
+ arg2 = fold_build2 (BIT_AND_EXPR, int_type_node, arg2, mask);
break;
case COMPARE_L_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);
{
- tree ifexp1 = fold (build2 (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR,
- boolean_type_node, arg1, arg2));
- tree ifexp2 = fold (build2 (EQ_EXPR, boolean_type_node, arg1, arg2));
- tree second_compare = fold (build3 (COND_EXPR, int_type_node,
- ifexp2, integer_zero_node,
- op == COMPARE_L_EXPR
- ? integer_minus_one_node
- : integer_one_node));
- return fold (build3 (COND_EXPR, int_type_node, ifexp1,
- op == COMPARE_L_EXPR ? integer_one_node
- : integer_minus_one_node,
- second_compare));
+ tree ifexp1 = fold_build2 (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR,
+ boolean_type_node, arg1, arg2);
+ tree ifexp2 = fold_build2 (EQ_EXPR, boolean_type_node, arg1, arg2);
+ tree second_compare = fold_build3 (COND_EXPR, int_type_node,
+ ifexp2, integer_zero_node,
+ op == COMPARE_L_EXPR
+ ? integer_minus_one_node
+ : integer_one_node);
+ return fold_build3 (COND_EXPR, int_type_node, ifexp1,
+ op == COMPARE_L_EXPR ? integer_one_node
+ : integer_minus_one_node,
+ second_compare);
}
case COMPARE_EXPR:
arg1 = save_expr (arg1); arg2 = save_expr (arg2);
{
- tree ifexp1 = fold (build2 (LT_EXPR, boolean_type_node, arg1, arg2));
- tree ifexp2 = fold (build2 (GT_EXPR, boolean_type_node, arg1, arg2));
- tree second_compare = fold (build3 (COND_EXPR, int_type_node,
- ifexp2, integer_one_node,
- integer_zero_node));
- return fold (build3 (COND_EXPR, int_type_node,
- ifexp1, integer_minus_one_node, second_compare));
+ tree ifexp1 = fold_build2 (LT_EXPR, boolean_type_node, arg1, arg2);
+ tree ifexp2 = fold_build2 (GT_EXPR, boolean_type_node, arg1, arg2);
+ tree second_compare = fold_build3 (COND_EXPR, int_type_node,
+ ifexp2, integer_one_node,
+ integer_zero_node);
+ return fold_build3 (COND_EXPR, int_type_node,
+ ifexp1, integer_minus_one_node, second_compare);
}
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
@@ -1582,7 +1581,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
break;
default: ;
}
- return fold (build2 (op, type, arg1, arg2));
+ return fold_build2 (op, type, arg1, arg2);
}
static void
@@ -1692,7 +1691,7 @@ build_field_ref (tree self_value, tree self_class, tree name)
tree base_type = promote_type (base_class);
if (base_type != TREE_TYPE (self_value))
- self_value = fold (build1 (NOP_EXPR, base_type, self_value));
+ self_value = fold_build1 (NOP_EXPR, base_type, self_value);
if (! flag_syntax_only && flag_indirect_dispatch)
{
tree otable_index
@@ -1706,16 +1705,16 @@ build_field_ref (tree self_value, tree self_class, tree name)
field_offset = fold (convert (sizetype, field_offset));
address
- = fold (build2 (PLUS_EXPR,
- build_pointer_type (TREE_TYPE (field_decl)),
- self_value, field_offset));
- return fold (build1 (INDIRECT_REF, TREE_TYPE (field_decl), address));
+ = fold_build2 (PLUS_EXPR,
+ build_pointer_type (TREE_TYPE (field_decl)),
+ self_value, field_offset);
+ return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address);
}
self_value = build_java_indirect_ref (TREE_TYPE (TREE_TYPE (self_value)),
self_value, check);
- return fold (build3 (COMPONENT_REF, TREE_TYPE (field_decl),
- self_value, field_decl, NULL_TREE));
+ return fold_build3 (COMPONENT_REF, TREE_TYPE (field_decl),
+ self_value, field_decl, NULL_TREE);
}
}
@@ -1781,7 +1780,7 @@ expand_compare (enum tree_code condition, tree value1, tree value2,
int target_pc)
{
tree target = lookup_label (target_pc);
- tree cond = fold (build2 (condition, boolean_type_node, value1, value2));
+ tree cond = fold_build2 (condition, boolean_type_node, value1, value2);
java_add_stmt
(build3 (COND_EXPR, void_type_node, java_truthvalue_conversion (cond),
build1 (GOTO_EXPR, void_type_node, target),
@@ -2061,8 +2060,8 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
method_index++;
}
method_index *= int_size_in_bytes (method_type_node);
- ref = fold (build2 (PLUS_EXPR, method_ptr_type_node,
- ref, build_int_cst (NULL_TREE, method_index)));
+ ref = fold_build2 (PLUS_EXPR, method_ptr_type_node,
+ ref, build_int_cst (NULL_TREE, method_index));
ref = build1 (INDIRECT_REF, method_type_node, ref);
func = build3 (COMPONENT_REF, nativecode_ptr_type_node,
ref, lookup_field (&method_type_node, ncode_ident),
@@ -2165,8 +2164,8 @@ build_invokevirtual (tree dtable, tree method)
size_int (TARGET_VTABLE_USES_DESCRIPTORS));
}
- func = fold (build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
- convert (nativecode_ptr_ptr_type_node, method_index)));
+ func = fold_build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
+ convert (nativecode_ptr_ptr_type_node, method_index));
if (TARGET_VTABLE_USES_DESCRIPTORS)
func = build1 (NOP_EXPR, nativecode_ptr_type_node, func);
@@ -3182,8 +3181,8 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops,
}
#define UNOP(OPERAND_TYPE, OPERAND_VALUE) \
- push_value (fold (build1 (NEGATE_EXPR, OPERAND_TYPE##_type_node, \
- pop_value (OPERAND_TYPE##_type_node))));
+ push_value (fold_build1 (NEGATE_EXPR, OPERAND_TYPE##_type_node, \
+ pop_value (OPERAND_TYPE##_type_node)));
#define CONVERT2(FROM_TYPE, TO_TYPE) \
{ \