diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-09-18 19:10:15 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-09-18 19:10:15 +0000 |
commit | c298ec4e20cdb97f611f92920c7b7ac2a21820e4 (patch) | |
tree | 7a0442d15d00052dffd5178ca24bfb40f1386122 /gcc/java | |
parent | 2c05c0dad5f65ca5e17cfd16429d686fada2221c (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/java/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/java/builtins.c | 20 | ||||
-rw-r--r-- | gcc/java/class.c | 4 | ||||
-rw-r--r-- | gcc/java/expr.c | 93 | ||||
-rw-r--r-- | gcc/java/parse.y | 10 | ||||
-rw-r--r-- | gcc/java/typeck.c | 32 |
6 files changed, 92 insertions, 81 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index dcdb716..b629979 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,17 @@ +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. + 2005-09-14 Bryce McKinlay <mckinlay@redhat.com> PR java/23891 diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 68f0b95..2ea9e57 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -94,24 +94,24 @@ static GTY(()) struct builtin_record java_builtins[] = static tree max_builtin (tree method_return_type, tree method_arguments) { - return fold (build2 (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 (build2 (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 abs_builtin (tree method_return_type, tree method_arguments) { - return fold (build1 (ABS_EXPR, method_return_type, - TREE_VALUE (method_arguments))); + return fold_build1 (ABS_EXPR, method_return_type, + TREE_VALUE (method_arguments)); } /* Mostly copied from ../builtins.c. */ @@ -121,10 +121,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 = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), + return fold_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 a089112..47ae336 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -2380,8 +2380,8 @@ layout_class_method (tree this_class, tree super_class, /* We generate vtable entries for final methods because they may one day be changed to non-final. */ set_method_index (method_decl, dtable_count); - dtable_count = fold (build2 (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/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) \ { \ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 4d6a37f..b728554 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -13643,11 +13643,11 @@ patch_binop (tree node, tree wfl_op1, tree wfl_op2, int folding) /* Shift int only up to 0x1f and long up to 0x3f */ if (prom_type == int_type_node) - op2 = fold (build2 (BIT_AND_EXPR, int_type_node, op2, - build_int_cst (NULL_TREE, 0x1f))); + op2 = fold_build2 (BIT_AND_EXPR, int_type_node, op2, + build_int_cst (NULL_TREE, 0x1f)); else - op2 = fold (build2 (BIT_AND_EXPR, int_type_node, op2, - build_int_cst (NULL_TREE, 0x3f))); + op2 = fold_build2 (BIT_AND_EXPR, int_type_node, op2, + build_int_cst (NULL_TREE, 0x3f)); /* The >>> operator is a >> operating on unsigned quantities */ if (code == URSHIFT_EXPR && (folding || ! flag_emit_class_files)) @@ -15422,7 +15422,7 @@ patch_exit_expr (tree node) /* Now we know things are allright, invert the condition, fold and return */ TREE_OPERAND (node, 0) = - fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression)); + fold_build1 (TRUTH_NOT_EXPR, boolean_type_node, expression); if (! integer_zerop (TREE_OPERAND (node, 0)) && ctxp->current_loop != NULL_TREE diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 7a4abf8..2bafd84 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -83,24 +83,24 @@ convert_ieee_real_to_integer (tree type, tree expr) tree result; expr = save_expr (expr); - result = fold (build3 (COND_EXPR, type, - fold (build2 (NE_EXPR, boolean_type_node, expr, expr)), + result = fold_build3 (COND_EXPR, type, + fold_build2 (NE_EXPR, boolean_type_node, expr, expr), convert (type, integer_zero_node), - convert_to_integer (type, expr))); + convert_to_integer (type, expr)); - result = fold (build3 (COND_EXPR, type, - fold (build2 (LE_EXPR, boolean_type_node, expr, - convert (TREE_TYPE (expr), - TYPE_MIN_VALUE (type)))), - TYPE_MIN_VALUE (type), - result)); + result = fold_build3 (COND_EXPR, type, + fold_build2 (LE_EXPR, boolean_type_node, expr, + convert (TREE_TYPE (expr), + TYPE_MIN_VALUE (type))), + TYPE_MIN_VALUE (type), + result); - result = fold (build3 (COND_EXPR, type, - fold (build2 (GE_EXPR, boolean_type_node, expr, - convert (TREE_TYPE (expr), - TYPE_MAX_VALUE (type)))), - TYPE_MAX_VALUE (type), - result)); + result = fold_build3 (COND_EXPR, type, + fold_build2 (GE_EXPR, boolean_type_node, expr, + convert (TREE_TYPE (expr), + TYPE_MAX_VALUE (type))), + TYPE_MAX_VALUE (type), + result); return result; } @@ -135,7 +135,7 @@ convert (tree type, tree expr) && ! flag_emit_class_files)) && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT) - return fold (convert_ieee_real_to_integer (type, expr)); + return convert_ieee_real_to_integer (type, expr); else { /* fold very helpfully sets the overflow status if a type |