From: Tomas Bily Date: Fri, 9 May 2008 14:57:39 +0000 (+0200) Subject: pa.c (reloc_needed): Use CASE_CONVERT. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1043771b10c5aba87e0dd41169cc6b4b790c59f4;p=gcc.git pa.c (reloc_needed): Use CASE_CONVERT. * config/pa/pa.c (reloc_needed): Use CASE_CONVERT. * tree-cfg.c (verify_expr, verify_gimple_expr): Likewise. * tree-ssa-structalias.c (get_constraint_for): Likewise. * c-common.c (c_common_truthvalue_conversion): Likewise. * tree-object-size.c (compute_object_offset): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * varasm.c (const_hash_1, compare_constant, copy_constant) (compute_reloc_for_constant, output_addressed_constants) (initializer_constant_valid_p): Likewise. * c-omp.c (check_omp_for_incr_expr): Likewise. * gimplify.c (gimplify_expr): Likewise. * c-typeck.c (c_finish_return): Likewise. * tree-vectorizer.c (supportable_widening_operation) (supportable_narrowing_operation): Likewise. * c-pretty-print.c (pp_c_cast_expression, pp_c_expression): Likewise. * matrix-reorg.c (can_calculate_expr_before_stmt): Likewise. * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info) (descr_info_loc): Likewise. * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. * fold-const.c (operand_equal_p, make_range, extract_muldiv_1) (fold_unary): Likewise. * builtins.c (get_pointer_alignment): Likewise. * tree-scalar-evolution.c (interpret_rhs_modify_stmt) (instantiate_parameters_1): Likewise. * tree.c (expr_align, stabilize_reference): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * tree-ssa-loop-niter.c (derive_constant_upper_bound): Likewise. * convert.c (strip_float_extensions): Use CONVERT_EXPR_P. * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. * config/alpha/alpha.c (va_list_skip_additions): Likewise. * c-common.c (c_alignof_expr, check_function_arguments_recurse): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Likewise. * varasm.c (initializer_constant_valid_p, output_constant): Likewise. * tree-ssa-forwprop.c (get_prop_source_stmt, can_propagate_from) (forward_propagate_addr_expr_1, forward_propagate_addr_expr) (forward_propagate_comparison) (tree_ssa_forward_propagate_single_use_vars): Likewise. * cfgexpand.c (discover_nonconstant_array_refs_r): Likewise. * emit-rtl.c (component_ref_for_mem_expr) (set_mem_attributes_minus_bitpos): Likewise. * tree-ssa-phiopt.c (conditional_replacement): Likewise. * gimplify.c (gimplify_conversion, goa_lhs_expr_p, gimplify_expr): Likewise. * c-typeck.c (default_function_array_conversion, build_indirect_ref) (build_function_call, pointer_diff, build_compound_expr) (c_finish_return): Likewise. * tree-vect-analyze.c (vect_determine_vectorization_factor): Likewise. * matrix-reorg.c (get_inner_of_cast_expr, may_flatten_matrices_1): Likewise. * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise. * expr.c (is_aligning_offset): Likewise. * tree-ssa-alias.c (is_escape_site): Likewise. * tree-stdarg.c (va_list_counter_bump, check_va_list_escapes) (check_all_va_list_escapes): Likewise. * tree-ssa-loop-ivopts.c (determine_base_object) (determine_common_wider_type): Likewise. * dojump.c (do_jump): Likewise. * tree-ssa-sccvn.c (simplify_unary_expression): Likewise. * tree-gimple.c (is_gimple_cast): Likewise. * fold-const.c (decode_field_reference, ) (fold_sign_changed_comparison, fold_unary, fold_comparison) (fold_binary): Likewise. * tree-ssa-alias-warnings.c (find_alias_site_helper) (already_warned_in_frontend_p): Likewise. * builtins.c (get_memory_rtx, fold_builtin_next_arg): Likewise. * tree.c (really_constant_p, get_unwidened): Likewise. * tree-ssa-loop-niter.c (expand_simple_operations): Likewise. * tree-ssa-loop-im.c (rewrite_bittest): Likewise. * tree-vrp.c (register_edge_assert_for_2, register_edge_assert_for_1): Likewise. * tree.h (STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS): Use CONVERT_EXPR_P. (CONVERT_EXPR_P): Define. (CASE_CONVERT): Define. From-SVN: r135114 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a74526bb14f..9c2f7617c6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,77 @@ +2008-05-09 Tomas Bily + + * config/pa/pa.c (reloc_needed): Use CASE_CONVERT. + * tree-cfg.c (verify_expr, verify_gimple_expr): Likewise. + * tree-ssa-structalias.c (get_constraint_for): Likewise. + * c-common.c (c_common_truthvalue_conversion): Likewise. + * tree-object-size.c (compute_object_offset): Likewise. + * tree-inline.c (estimate_num_insns_1): Likewise. + * varasm.c (const_hash_1, compare_constant, copy_constant) + (compute_reloc_for_constant, output_addressed_constants) + (initializer_constant_valid_p): Likewise. + * c-omp.c (check_omp_for_incr_expr): Likewise. + * gimplify.c (gimplify_expr): Likewise. + * c-typeck.c (c_finish_return): Likewise. + * tree-vectorizer.c (supportable_widening_operation) + (supportable_narrowing_operation): Likewise. + * c-pretty-print.c (pp_c_cast_expression, pp_c_expression): Likewise. + * matrix-reorg.c (can_calculate_expr_before_stmt): Likewise. + * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. + * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info) + (descr_info_loc): Likewise. + * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. + * fold-const.c (operand_equal_p, make_range, extract_muldiv_1) + (fold_unary): Likewise. + * builtins.c (get_pointer_alignment): Likewise. + * tree-scalar-evolution.c (interpret_rhs_modify_stmt) + (instantiate_parameters_1): Likewise. + * tree.c (expr_align, stabilize_reference): Likewise. + * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. + * tree-ssa-loop-niter.c (derive_constant_upper_bound): Likewise. + * convert.c (strip_float_extensions): Use CONVERT_EXPR_P. + * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. + * config/alpha/alpha.c (va_list_skip_additions): Likewise. + * c-common.c (c_alignof_expr, check_function_arguments_recurse): Likewise. + * tree-ssa.c (tree_ssa_useless_type_conversion): Likewise. + * varasm.c (initializer_constant_valid_p, output_constant): Likewise. + * tree-ssa-forwprop.c (get_prop_source_stmt, can_propagate_from) + (forward_propagate_addr_expr_1, forward_propagate_addr_expr) + (forward_propagate_comparison) + (tree_ssa_forward_propagate_single_use_vars): Likewise. + * cfgexpand.c (discover_nonconstant_array_refs_r): Likewise. + * emit-rtl.c (component_ref_for_mem_expr) + (set_mem_attributes_minus_bitpos): Likewise. + * tree-ssa-phiopt.c (conditional_replacement): Likewise. + * gimplify.c (gimplify_conversion, goa_lhs_expr_p, gimplify_expr): Likewise. + * c-typeck.c (default_function_array_conversion, build_indirect_ref) + (build_function_call, pointer_diff, build_compound_expr) + (c_finish_return): Likewise. + * tree-vect-analyze.c (vect_determine_vectorization_factor): Likewise. + * matrix-reorg.c (get_inner_of_cast_expr, may_flatten_matrices_1): Likewise. + * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise. + * expr.c (is_aligning_offset): Likewise. + * tree-ssa-alias.c (is_escape_site): Likewise. + * tree-stdarg.c (va_list_counter_bump, check_va_list_escapes) + (check_all_va_list_escapes): Likewise. + * tree-ssa-loop-ivopts.c (determine_base_object) + (determine_common_wider_type): Likewise. + * dojump.c (do_jump): Likewise. + * tree-ssa-sccvn.c (simplify_unary_expression): Likewise. + * tree-gimple.c (is_gimple_cast): Likewise. + * fold-const.c (decode_field_reference, ) + (fold_sign_changed_comparison, fold_unary, fold_comparison) + (fold_binary): Likewise. + * tree-ssa-alias-warnings.c (find_alias_site_helper) + (already_warned_in_frontend_p): Likewise. + * builtins.c (get_memory_rtx, fold_builtin_next_arg): Likewise. + * tree.c (really_constant_p, get_unwidened): Likewise. + * tree-ssa-loop-niter.c (expand_simple_operations): Likewise. + * tree-ssa-loop-im.c (rewrite_bittest): Likewise. + * tree-vrp.c (register_edge_assert_for_2, register_edge_assert_for_1): Likewise. + * tree.h (STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS): Use CONVERT_EXPR_P. + (CONVERT_EXPR_P): Define. + (CASE_CONVERT): Define. + 2008-05-08 Kenneth Zadeck PR middle-end/36117 diff --git a/gcc/builtins.c b/gcc/builtins.c index 61b42722056..7e1ca21fc88 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -279,8 +279,7 @@ get_pointer_alignment (tree exp, unsigned int max_align) { switch (TREE_CODE (exp)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: exp = TREE_OPERAND (exp, 0); if (! POINTER_TYPE_P (TREE_TYPE (exp))) return align; @@ -1077,7 +1076,7 @@ get_memory_rtx (tree exp, tree len) /* Get an expression we can use to find the attributes to assign to MEM. If it is an ADDR_EXPR, use the operand. Otherwise, dereference it if we can. First remove any nops. */ - while ((TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR) + while (CONVERT_EXPR_P (exp) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) exp = TREE_OPERAND (exp, 0); @@ -1107,8 +1106,7 @@ get_memory_rtx (tree exp, tree len) tree inner = exp; while (TREE_CODE (inner) == ARRAY_REF - || TREE_CODE (inner) == NOP_EXPR - || TREE_CODE (inner) == CONVERT_EXPR + || CONVERT_EXPR_P (inner) || TREE_CODE (inner) == VIEW_CONVERT_EXPR || TREE_CODE (inner) == SAVE_EXPR) inner = TREE_OPERAND (inner, 0); @@ -11368,8 +11366,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) is not quite the same as STRIP_NOPS. It does more. We must also strip off INDIRECT_EXPR for C++ reference parameters. */ - while (TREE_CODE (arg) == NOP_EXPR - || TREE_CODE (arg) == CONVERT_EXPR + while (CONVERT_EXPR_P (arg) || TREE_CODE (arg) == INDIRECT_REF) arg = TREE_OPERAND (arg, 0); if (arg != last_parm) diff --git a/gcc/c-common.c b/gcc/c-common.c index 0c27b3e6eba..415807f1c5b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3072,8 +3072,7 @@ c_common_truthvalue_conversion (tree expr) c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)), c_common_truthvalue_conversion (TREE_OPERAND (expr, 2))); - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, since that affects how `default_conversion' will behave. */ if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE @@ -3456,7 +3455,7 @@ c_alignof_expr (tree expr) tree best = t; int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - while ((TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR) + while (CONVERT_EXPR_P (t) && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE) { int thisalign; @@ -6566,7 +6565,7 @@ check_function_arguments_recurse (void (*callback) void *ctx, tree param, unsigned HOST_WIDE_INT param_num) { - if ((TREE_CODE (param) == NOP_EXPR || TREE_CODE (param) == CONVERT_EXPR) + if (CONVERT_EXPR_P (param) && (TYPE_PRECISION (TREE_TYPE (param)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (param, 0))))) { diff --git a/gcc/c-omp.c b/gcc/c-omp.c index f170fbe73e6..cdca2bcd4a9 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -171,8 +171,7 @@ check_omp_for_incr_expr (tree exp, tree decl) switch (TREE_CODE (exp)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl); if (t != error_mark_node) return fold_convert (TREE_TYPE (exp), t); diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 3c2f0218461..29e987d3660 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -1555,8 +1555,7 @@ pp_c_cast_expression (c_pretty_printer *pp, tree e) { case FLOAT_EXPR: case FIX_TRUNC_EXPR: - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: pp_c_type_cast (pp, TREE_TYPE (e)); pp_c_cast_expression (pp, TREE_OPERAND (e, 0)); break; @@ -1947,8 +1946,7 @@ pp_c_expression (c_pretty_printer *pp, tree e) case FLOAT_EXPR: case FIX_TRUNC_EXPR: - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: pp_c_cast_expression (pp, e); break; diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2f8428210d7..b52a349ac6f 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -1657,8 +1657,7 @@ default_function_array_conversion (struct c_expr exp) bool lvalue_array_p; while ((TREE_CODE (exp.value) == NON_LVALUE_EXPR - || TREE_CODE (exp.value) == NOP_EXPR - || TREE_CODE (exp.value) == CONVERT_EXPR) + || CONVERT_EXPR_P (exp.value)) && TREE_TYPE (TREE_OPERAND (exp.value, 0)) == type) { if (TREE_CODE (exp.value) == NON_LVALUE_EXPR) @@ -1978,8 +1977,7 @@ build_indirect_ref (tree ptr, const char *errorstring) if (TREE_CODE (type) == POINTER_TYPE) { - if (TREE_CODE (pointer) == CONVERT_EXPR - || TREE_CODE (pointer) == NOP_EXPR + if (CONVERT_EXPR_P (pointer) || TREE_CODE (pointer) == VIEW_CONVERT_EXPR) { /* If a warning is issued, mark it to avoid duplicates from @@ -2398,8 +2396,7 @@ build_function_call (tree function, tree params) expression if necessary. This has the nice side-effect to prevent the tree-inliner from generating invalid assignment trees which may blow up in the RTL expander later. */ - if ((TREE_CODE (function) == NOP_EXPR - || TREE_CODE (function) == CONVERT_EXPR) + if (CONVERT_EXPR_P (function) && TREE_CODE (tem = TREE_OPERAND (function, 0)) == ADDR_EXPR && TREE_CODE (tem = TREE_OPERAND (tem, 0)) == FUNCTION_DECL && !comptypes (fntype, TREE_TYPE (tem))) @@ -2821,13 +2818,13 @@ pointer_diff (tree op0, tree op1) different mode in place.) So first try to find a common term here 'by hand'; we want to cover at least the cases that occur in legal static initializers. */ - if ((TREE_CODE (op0) == NOP_EXPR || TREE_CODE (op0) == CONVERT_EXPR) + if (CONVERT_EXPR_P (op0) && (TYPE_PRECISION (TREE_TYPE (op0)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0))))) con0 = TREE_OPERAND (op0, 0); else con0 = op0; - if ((TREE_CODE (op1) == NOP_EXPR || TREE_CODE (op1) == CONVERT_EXPR) + if (CONVERT_EXPR_P (op1) && (TYPE_PRECISION (TREE_TYPE (op1)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0))))) con1 = TREE_OPERAND (op1, 0); @@ -3555,13 +3552,11 @@ build_compound_expr (tree expr1, tree expr2) if (warn_unused_value) { if (VOID_TYPE_P (TREE_TYPE (expr1)) - && (TREE_CODE (expr1) == NOP_EXPR - || TREE_CODE (expr1) == CONVERT_EXPR)) + && CONVERT_EXPR_P (expr1)) ; /* (void) a, b */ else if (VOID_TYPE_P (TREE_TYPE (expr1)) && TREE_CODE (expr1) == COMPOUND_EXPR - && (TREE_CODE (TREE_OPERAND (expr1, 1)) == CONVERT_EXPR - || TREE_CODE (TREE_OPERAND (expr1, 1)) == NOP_EXPR)) + && CONVERT_EXPR_P (TREE_OPERAND (expr1, 1))) ; /* (void) a, (void) b, c */ else warning (OPT_Wunused_value, @@ -7125,7 +7120,7 @@ c_finish_return (tree retval) { switch (TREE_CODE (inner)) { - case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR: + CASE_CONVERT: case NON_LVALUE_EXPR: case PLUS_EXPR: inner = TREE_OPERAND (inner, 0); continue; @@ -7138,9 +7133,8 @@ c_finish_return (tree retval) tree op1 = TREE_OPERAND (inner, 1); while (!POINTER_TYPE_P (TREE_TYPE (op1)) - && (TREE_CODE (op1) == NOP_EXPR - || TREE_CODE (op1) == NON_LVALUE_EXPR - || TREE_CODE (op1) == CONVERT_EXPR)) + && (CONVERT_EXPR_P (op1) + || TREE_CODE (op1) == NON_LVALUE_EXPR)) op1 = TREE_OPERAND (op1, 0); if (POINTER_TYPE_P (TREE_TYPE (op1))) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 273c6ac864a..3e36985b3d8 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1792,8 +1792,7 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, || TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR || TREE_CODE (t) == VIEW_CONVERT_EXPR - || TREE_CODE (t) == NOP_EXPR - || TREE_CODE (t) == CONVERT_EXPR) + || CONVERT_EXPR_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF) diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 21b0590d66a..f878e866f5f 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5825,8 +5825,7 @@ va_list_skip_additions (tree lhs) if (TREE_CODE (rhs) == WITH_SIZE_EXPR) rhs = TREE_OPERAND (rhs, 0); - if ((TREE_CODE (rhs) != NOP_EXPR - && TREE_CODE (rhs) != CONVERT_EXPR + if (((!CONVERT_EXPR_P (rhs)) && ((TREE_CODE (rhs) != PLUS_EXPR && TREE_CODE (rhs) != POINTER_PLUS_EXPR) || TREE_CODE (TREE_OPERAND (rhs, 1)) != INTEGER_CST diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 525572eb7c0..10c50ffcf12 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -2103,8 +2103,7 @@ reloc_needed (tree exp) reloc |= reloc_needed (TREE_OPERAND (exp, 1)); break; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case NON_LVALUE_EXPR: reloc = reloc_needed (TREE_OPERAND (exp, 0)); break; diff --git a/gcc/convert.c b/gcc/convert.c index f82604e775a..0fef3a2e746 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -98,8 +98,7 @@ strip_float_extensions (tree exp) return build_real (type, real_value_truncate (TYPE_MODE (type), orig)); } - if (TREE_CODE (exp) != NOP_EXPR - && TREE_CODE (exp) != CONVERT_EXPR) + if (!CONVERT_EXPR_P (exp)) return exp; sub = TREE_OPERAND (exp, 0); diff --git a/gcc/dojump.c b/gcc/dojump.c index e1d2fb2c5c3..43373481955 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -218,8 +218,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) rtx set_label, clr_label; /* Strip narrowing integral type conversions. */ - while ((TREE_CODE (exp0) == NOP_EXPR - || TREE_CODE (exp0) == CONVERT_EXPR) + while (CONVERT_EXPR_P (exp0) && TREE_OPERAND (exp0, 0) != error_mark_node && TYPE_PRECISION (TREE_TYPE (exp0)) <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp0, 0)))) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 861d3b3b1de..145b8fefaef 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9598,8 +9598,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) case COMPOUND_EXPR: return loc_descriptor_from_tree_1 (TREE_OPERAND (loc, 1), want_address); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: case SAVE_EXPR: case GIMPLE_MODIFY_STMT: @@ -11133,8 +11132,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b add_AT_unsigned (subrange_die, bound_attr, tree_low_cst (bound, 0)); break; - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: add_bound_info (subrange_die, bound_attr, TREE_OPERAND (bound, 0)); break; @@ -11818,8 +11816,7 @@ descr_info_loc (tree val, tree base_decl) switch (TREE_CODE (val)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: return descr_info_loc (TREE_OPERAND (val, 0), base_decl); case INTEGER_CST: if (host_integerp (val, 0)) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index aec01517b6d..45a256347c0 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1431,7 +1431,7 @@ component_ref_for_mem_expr (tree ref) { /* Now remove any conversions: they don't change what the underlying object is. Likewise for SAVE_EXPR. */ - while (TREE_CODE (inner) == NOP_EXPR || TREE_CODE (inner) == CONVERT_EXPR + while (CONVERT_EXPR_P (inner) || TREE_CODE (inner) == VIEW_CONVERT_EXPR || TREE_CODE (inner) == SAVE_EXPR) inner = TREE_OPERAND (inner, 0); @@ -1561,7 +1561,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, /* Now remove any conversions: they don't change what the underlying object is. Likewise for SAVE_EXPR. */ - while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR + while (CONVERT_EXPR_P (t) || TREE_CODE (t) == VIEW_CONVERT_EXPR || TREE_CODE (t) == SAVE_EXPR) t = TREE_OPERAND (t, 0); diff --git a/gcc/expr.c b/gcc/expr.c index ae25d40a681..f3d22d82db8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6600,7 +6600,7 @@ highest_pow2_factor (const_tree exp) } break; - case NOP_EXPR: case CONVERT_EXPR: + CASE_CONVERT: case SAVE_EXPR: return highest_pow2_factor (TREE_OPERAND (exp, 0)); @@ -8018,8 +8018,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return expand_call (exp, target, ignore); case PAREN_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: if (TREE_OPERAND (exp, 0) == error_mark_node) return const0_rtx; @@ -9410,8 +9409,7 @@ static int is_aligning_offset (const_tree offset, const_tree exp) { /* Strip off any conversions. */ - while (TREE_CODE (offset) == NOP_EXPR - || TREE_CODE (offset) == CONVERT_EXPR) + while (CONVERT_EXPR_P (offset)) offset = TREE_OPERAND (offset, 0); /* We must now have a BIT_AND_EXPR with a constant that is one less than @@ -9426,16 +9424,14 @@ is_aligning_offset (const_tree offset, const_tree exp) /* Look at the first operand of BIT_AND_EXPR and strip any conversion. It must be NEGATE_EXPR. Then strip any more conversions. */ offset = TREE_OPERAND (offset, 0); - while (TREE_CODE (offset) == NOP_EXPR - || TREE_CODE (offset) == CONVERT_EXPR) + while (CONVERT_EXPR_P (offset)) offset = TREE_OPERAND (offset, 0); if (TREE_CODE (offset) != NEGATE_EXPR) return 0; offset = TREE_OPERAND (offset, 0); - while (TREE_CODE (offset) == NOP_EXPR - || TREE_CODE (offset) == CONVERT_EXPR) + while (CONVERT_EXPR_P (offset)) offset = TREE_OPERAND (offset, 0); /* This must now be the address of EXP. */ diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1250d269502..358a6166f17 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3168,8 +3168,7 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) /* Two conversions are equal only if signedness and modes match. */ switch (TREE_CODE (arg0)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case FIX_TRUNC_EXPR: if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1))) @@ -3904,8 +3903,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize, /* We are interested in the bare arrangement of bits, so strip everything that doesn't affect the machine mode. However, record the type of the outermost expression if it may matter below. */ - if (TREE_CODE (exp) == NOP_EXPR - || TREE_CODE (exp) == CONVERT_EXPR + if (CONVERT_EXPR_P (exp) || TREE_CODE (exp) == NON_LVALUE_EXPR) outer_type = TREE_TYPE (exp); STRIP_NOPS (exp); @@ -4316,7 +4314,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh, exp = arg0; continue; - case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR: + CASE_CONVERT: case NON_LVALUE_EXPR: if (TYPE_PRECISION (arg0_type) > TYPE_PRECISION (exp_type)) break; @@ -5728,7 +5726,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, fold_convert (ctype, c), 0); break; - case CONVERT_EXPR: case NON_LVALUE_EXPR: case NOP_EXPR: + CASE_CONVERT: case NON_LVALUE_EXPR: /* If op0 is an expression ... */ if ((COMPARISON_CLASS_P (op0) || UNARY_CLASS_P (op0) @@ -6804,8 +6802,7 @@ fold_sign_changed_comparison (enum tree_code code, tree type, tree arg0_inner; tree inner_type, outer_type; - if (TREE_CODE (arg0) != NOP_EXPR - && TREE_CODE (arg0) != CONVERT_EXPR) + if (!CONVERT_EXPR_P (arg0)) return NULL_TREE; outer_type = TREE_TYPE (arg0); @@ -6830,8 +6827,7 @@ fold_sign_changed_comparison (enum tree_code code, tree type, return NULL_TREE; if (TREE_CODE (arg1) != INTEGER_CST - && !((TREE_CODE (arg1) == NOP_EXPR - || TREE_CODE (arg1) == CONVERT_EXPR) + && !(CONVERT_EXPR_P (arg1) && TREE_TYPE (TREE_OPERAND (arg1, 0)) == inner_type)) return NULL_TREE; @@ -7726,9 +7722,8 @@ fold_unary (enum tree_code code, tree type, tree op0) return fold_convert (type, op0); return NULL_TREE; - case NOP_EXPR: + CASE_CONVERT: case FLOAT_EXPR: - case CONVERT_EXPR: case FIX_TRUNC_EXPR: if (TREE_TYPE (op0) == type) return op0; @@ -7740,8 +7735,7 @@ fold_unary (enum tree_code code, tree type, tree op0) TREE_OPERAND (op0, 1)); /* Handle cases of two conversions in a row. */ - if (TREE_CODE (op0) == NOP_EXPR - || TREE_CODE (op0) == CONVERT_EXPR) + if (CONVERT_EXPR_P (op0)) { tree inside_type = TREE_TYPE (TREE_OPERAND (op0, 0)); tree inter_type = TREE_TYPE (op0); @@ -7936,8 +7930,7 @@ fold_unary (enum tree_code code, tree type, tree op0) if (INTEGRAL_TYPE_P (type) && TREE_CODE (op0) == BIT_NOT_EXPR && INTEGRAL_TYPE_P (TREE_TYPE (op0)) - && (TREE_CODE (TREE_OPERAND (op0, 0)) == NOP_EXPR - || TREE_CODE (TREE_OPERAND (op0, 0)) == CONVERT_EXPR) + && CONVERT_EXPR_P (TREE_OPERAND (op0, 0)) && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (op0))) { tem = TREE_OPERAND (TREE_OPERAND (op0, 0), 0); @@ -7993,8 +7986,7 @@ fold_unary (enum tree_code code, tree type, tree op0) return fold_convert (type, op0); /* Strip inner integral conversions that do not change the precision. */ - if ((TREE_CODE (op0) == NOP_EXPR - || TREE_CODE (op0) == CONVERT_EXPR) + if (CONVERT_EXPR_P (op0) && (INTEGRAL_TYPE_P (TREE_TYPE (op0)) || POINTER_TYPE_P (TREE_TYPE (op0))) && (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op0, 0))) @@ -8911,8 +8903,7 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) } if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE - && (TREE_CODE (arg0) == NOP_EXPR - || TREE_CODE (arg0) == CONVERT_EXPR)) + && CONVERT_EXPR_P (arg0)) { /* If we are widening one operand of an integer comparison, see if the other operand is similarly being widened. Perhaps we @@ -12666,8 +12657,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if ((code == LT_EXPR || code == GE_EXPR) && TYPE_UNSIGNED (TREE_TYPE (arg0)) - && (TREE_CODE (arg1) == NOP_EXPR - || TREE_CODE (arg1) == CONVERT_EXPR) + && CONVERT_EXPR_P (arg1) && TREE_CODE (TREE_OPERAND (arg1, 0)) == LSHIFT_EXPR && integer_onep (TREE_OPERAND (TREE_OPERAND (arg1, 0), 0))) return diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fc90fa35a20..2d0ecbf20d9 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1649,8 +1649,7 @@ static enum gimplify_status gimplify_conversion (tree *expr_p) { tree tem; - gcc_assert (TREE_CODE (*expr_p) == NOP_EXPR - || TREE_CODE (*expr_p) == CONVERT_EXPR); + gcc_assert (CONVERT_EXPR_P (*expr_p)); /* Then strip away all but the outermost conversion. */ STRIP_SIGN_NOPS (TREE_OPERAND (*expr_p, 0)); @@ -1676,7 +1675,7 @@ gimplify_conversion (tree *expr_p) /* If we still have a conversion at the toplevel, then canonicalize some constructs. */ - if (TREE_CODE (*expr_p) == NOP_EXPR || TREE_CODE (*expr_p) == CONVERT_EXPR) + if (CONVERT_EXPR_P (*expr_p)) { tree sub = TREE_OPERAND (*expr_p, 0); @@ -5467,8 +5466,7 @@ goa_lhs_expr_p (tree expr, tree addr) /* Also include casts to other type variants. The C front end is fond of adding these for e.g. volatile variables. This is like STRIP_TYPE_NOPS but includes the main variant lookup. */ - while ((TREE_CODE (expr) == NOP_EXPR - || TREE_CODE (expr) == CONVERT_EXPR + while ((CONVERT_EXPR_P (expr) || TREE_CODE (expr) == NON_LVALUE_EXPR) && TREE_OPERAND (expr, 0) != error_mark_node && (TYPE_MAIN_VARIANT (TREE_TYPE (expr)) @@ -5479,8 +5477,7 @@ goa_lhs_expr_p (tree expr, tree addr) { expr = TREE_OPERAND (expr, 0); while (expr != addr - && (TREE_CODE (expr) == NOP_EXPR - || TREE_CODE (expr) == CONVERT_EXPR + && (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == NON_LVALUE_EXPR) && TREE_CODE (expr) == TREE_CODE (addr) && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) @@ -5765,8 +5762,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ret = gimplify_va_arg_expr (expr_p, pre_p, post_p); break; - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: if (IS_EMPTY_STMT (*expr_p)) { ret = GS_ALL_DONE; diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c index 8a2734d0f0b..e77023400e0 100644 --- a/gcc/matrix-reorg.c +++ b/gcc/matrix-reorg.c @@ -410,7 +410,7 @@ mtt_info_eq (const void *mtt1, const void *mtt2) static tree get_inner_of_cast_expr (tree t) { - while (TREE_CODE (t) == CONVERT_EXPR || TREE_CODE (t) == NOP_EXPR + while (CONVERT_EXPR_P (t) || TREE_CODE (t) == VIEW_CONVERT_EXPR) t = TREE_OPERAND (t, 0); @@ -428,7 +428,7 @@ may_flatten_matrices_1 (tree stmt) { case GIMPLE_MODIFY_STMT: t = GIMPLE_STMT_OPERAND (stmt, 1); - while (TREE_CODE (t) == CONVERT_EXPR || TREE_CODE (t) == NOP_EXPR) + while (CONVERT_EXPR_P (t)) { if (TREE_TYPE (t) && POINTER_TYPE_P (TREE_TYPE (t))) { @@ -1442,8 +1442,7 @@ can_calculate_expr_before_stmt (tree expr, sbitmap visited) } return res; } - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: res = can_calculate_expr_before_stmt (TREE_OPERAND (expr, 0), visited); if (res != NULL_TREE) return build1 (TREE_CODE (expr), TREE_TYPE (expr), res); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index f559030fc58..340c7a257ce 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3252,8 +3252,7 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) case NON_LVALUE_EXPR: gcc_unreachable (); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case FIX_TRUNC_EXPR: case FLOAT_EXPR: case NEGATE_EXPR: @@ -3613,8 +3612,7 @@ verify_gimple_expr (tree expr) /* Special codes we cannot handle via their class. */ switch (TREE_CODE (expr)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: { tree op = TREE_OPERAND (expr, 0); if (!is_gimple_val (op)) diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c index 101dfd17c2b..da84777725a 100644 --- a/gcc/tree-gimple.c +++ b/gcc/tree-gimple.c @@ -515,8 +515,7 @@ is_gimple_min_lval (tree t) bool is_gimple_cast (tree t) { - return (TREE_CODE (t) == NOP_EXPR - || TREE_CODE (t) == CONVERT_EXPR + return (CONVERT_EXPR_P (t) || TREE_CODE (t) == FIX_TRUNC_EXPR); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 28727ccec0b..e7fed4f0723 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2220,8 +2220,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) case BIND_EXPR: case WITH_CLEANUP_EXPR: case PAREN_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: case SAVE_EXPR: case ADDR_EXPR: diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index bc99ae79e49..c1b3b5f1264 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -110,8 +110,7 @@ compute_object_offset (const_tree expr, const_tree var) break; case REALPART_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR: return compute_object_offset (TREE_OPERAND (expr, 0), var); diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index aa493a535ca..69e5e73bda8 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1422,8 +1422,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, case FIXED_CONVERT_EXPR: case FIX_TRUNC_EXPR: case FLOAT_EXPR: - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: type = TREE_TYPE (node); op0 = TREE_OPERAND (node, 0); if (type != TREE_TYPE (op0)) @@ -2452,8 +2451,7 @@ op_prio (const_tree op) case INDIRECT_REF: case ADDR_EXPR: case FLOAT_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case FIX_TRUNC_EXPR: case TARGET_EXPR: return 14; diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 31b77689b1a..b4db2f92281 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1675,8 +1675,7 @@ interpret_rhs_modify_stmt (struct loop *loop, tree at_stmt, at_stmt); break; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: opnd10 = TREE_OPERAND (opnd1, 0); chrec10 = analyze_scalar_evolution (loop, opnd10); res = chrec_convert (type, chrec10, at_stmt); @@ -2115,8 +2114,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache } return chrec; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: op0 = instantiate_parameters_1 (loop, TREE_OPERAND (chrec, 0), flags, cache, size_expr); if (op0 == chrec_dont_know) diff --git a/gcc/tree-ssa-alias-warnings.c b/gcc/tree-ssa-alias-warnings.c index 05d215c0f28..aacaa0ac0ee 100644 --- a/gcc/tree-ssa-alias-warnings.c +++ b/gcc/tree-ssa-alias-warnings.c @@ -258,8 +258,7 @@ find_alias_site_helper (tree var ATTRIBUTE_UNUSED, tree stmt, void *data) tree rhs_pointer = get_rhs (stmt); tree to_match = NULL_TREE; - while (TREE_CODE (rhs_pointer) == NOP_EXPR - || TREE_CODE (rhs_pointer) == CONVERT_EXPR + while (CONVERT_EXPR_P (rhs_pointer) || TREE_CODE (rhs_pointer) == VIEW_CONVERT_EXPR) rhs_pointer = TREE_OPERAND (rhs_pointer, 0); @@ -720,8 +719,7 @@ already_warned_in_frontend_p (tree stmt) rhs_pointer = get_rhs (stmt); - if ((TREE_CODE (rhs_pointer) == NOP_EXPR - || TREE_CODE (rhs_pointer) == CONVERT_EXPR + if ((CONVERT_EXPR_P (rhs_pointer) || TREE_CODE (rhs_pointer) == VIEW_CONVERT_EXPR) && TREE_NO_WARNING (rhs_pointer)) return true; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 814631a65d6..ddd79375289 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2864,8 +2864,7 @@ is_escape_site (tree stmt) if (lhs == NULL_TREE) return ESCAPE_UNKNOWN; - if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == NOP_EXPR - || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CONVERT_EXPR + if (CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (stmt, 1)) || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == VIEW_CONVERT_EXPR) { tree from diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 31322b65791..cf6cf04ac1b 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -234,8 +234,7 @@ get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p) /* We can look through pointer conversions in the search for a useful stmt for the comparison folding. */ rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (rhs)) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))) @@ -299,8 +298,7 @@ can_propagate_from (tree def_stmt) then we can not apply optimizations as some targets require function pointers to be canonicalized and in this case this optimization could eliminate a necessary canonicalization. */ - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))) && TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0)))) == FUNCTION_TYPE) @@ -586,8 +584,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt, a conversion to def_rhs type separate, though. */ if (TREE_CODE (lhs) == SSA_NAME && (rhs == name - || TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || CONVERT_EXPR_P (rhs)) && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (def_rhs))) { /* Only recurse if we don't deal with a single use. */ @@ -792,8 +789,7 @@ forward_propagate_addr_expr (tree name, tree rhs) if (result && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME && (TREE_CODE (use_rhs) == SSA_NAME - || ((TREE_CODE (use_rhs) == NOP_EXPR - || TREE_CODE (use_rhs) == CONVERT_EXPR) + || (CONVERT_EXPR_P (use_rhs) && TREE_CODE (TREE_OPERAND (use_rhs, 0)) == SSA_NAME))) { block_stmt_iterator bsi = bsi_for_stmt (use_stmt); @@ -832,8 +828,7 @@ forward_propagate_comparison (tree cond, tree stmt) /* Conversion of the condition result to another integral type. */ if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT - && (TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == CONVERT_EXPR - || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == NOP_EXPR + && (CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (use_stmt, 1)) || COMPARISON_CLASS_P (GIMPLE_STMT_OPERAND (use_stmt, 1)) || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == TRUTH_NOT_EXPR) && INTEGRAL_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (use_stmt, 0)))) @@ -842,8 +837,7 @@ forward_propagate_comparison (tree cond, tree stmt) tree rhs = GIMPLE_STMT_OPERAND (use_stmt, 1); /* We can propagate the condition into a conversion. */ - if (TREE_CODE (rhs) == CONVERT_EXPR - || TREE_CODE (rhs) == NOP_EXPR) + if (CONVERT_EXPR_P (rhs)) { /* Avoid using fold here as that may create a COND_EXPR with non-boolean condition as canonical form. */ @@ -1033,8 +1027,7 @@ tree_ssa_forward_propagate_single_use_vars (void) if (TREE_CODE (rhs) == ADDR_EXPR /* Handle pointer conversions on invariant addresses as well, as this is valid gimple. */ - || ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR && POINTER_TYPE_P (TREE_TYPE (rhs)))) { diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 3a28fadd792..4dbe7503c9e 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -202,8 +202,7 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit) if (TREE_CODE (t) != GIMPLE_MODIFY_STMT) break; t = GIMPLE_STMT_OPERAND (t, 1); - if (TREE_CODE (t) == NOP_EXPR - || TREE_CODE (t) == CONVERT_EXPR) + if (CONVERT_EXPR_P (t)) t = TREE_OPERAND (t, 0); } while (TREE_CODE (t) == SSA_NAME); diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index c896abb8ba7..ba36343f548 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -812,8 +812,7 @@ rewrite_bittest (block_stmt_iterator *bsi) /* There is a conversion in between possibly inserted by fold. */ t = GIMPLE_STMT_OPERAND (stmt1, 1); - if (TREE_CODE (t) == NOP_EXPR - || TREE_CODE (t) == CONVERT_EXPR) + if (CONVERT_EXPR_P (t)) { t = TREE_OPERAND (t, 0); if (TREE_CODE (t) != SSA_NAME diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index afa469b9cc3..0247a1e71f5 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -772,8 +772,7 @@ determine_base_object (tree expr) /* If this is a pointer casted to any type, we need to determine the base object for the pointer; so handle conversions before throwing away non-pointer expressions. */ - if (TREE_CODE (expr) == NOP_EXPR - || TREE_CODE (expr) == CONVERT_EXPR) + if (CONVERT_EXPR_P (expr)) return determine_base_object (TREE_OPERAND (expr, 0)); if (!POINTER_TYPE_P (TREE_TYPE (expr))) @@ -1540,8 +1539,7 @@ may_be_nonaddressable_p (tree expr) case ARRAY_RANGE_REF: return may_be_nonaddressable_p (TREE_OPERAND (expr, 0)); - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: return true; default: @@ -2684,8 +2682,7 @@ determine_common_wider_type (tree *a, tree *b) tree suba, subb; tree atype = TREE_TYPE (*a); - if ((TREE_CODE (*a) == NOP_EXPR - || TREE_CODE (*a) == CONVERT_EXPR)) + if (CONVERT_EXPR_P (*a)) { suba = TREE_OPERAND (*a, 0); wider_type = TREE_TYPE (suba); @@ -2695,8 +2692,7 @@ determine_common_wider_type (tree *a, tree *b) else return atype; - if ((TREE_CODE (*b) == NOP_EXPR - || TREE_CODE (*b) == CONVERT_EXPR)) + if (CONVERT_EXPR_P (*b)) { subb = TREE_OPERAND (*b, 0); if (TYPE_PRECISION (wider_type) != TYPE_PRECISION (TREE_TYPE (subb))) diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 40e7051c265..934afa78d7d 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1437,8 +1437,7 @@ expand_simple_operations (tree expr) e = GIMPLE_STMT_OPERAND (stmt, 1); if (/* Casts are simple. */ - TREE_CODE (e) != NOP_EXPR - && TREE_CODE (e) != CONVERT_EXPR + !CONVERT_EXPR_P (e) /* Copies are simple. */ && TREE_CODE (e) != SSA_NAME /* Assignments of invariants are simple. */ @@ -2190,8 +2189,7 @@ derive_constant_upper_bound (const_tree val) case INTEGER_CST: return tree_to_double_int (val); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: op0 = TREE_OPERAND (val, 0); subtype = TREE_TYPE (op0); if (!TYPE_UNSIGNED (subtype) diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 2a8c87827f7..fbc7a683ec8 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -592,8 +592,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb, /* Only "real" casts are OK here, not everything that is acceptable to is_gimple_cast. Make sure we don't do anything stupid here. */ - gcc_assert (TREE_CODE (cond) == NOP_EXPR - || TREE_CODE (cond) == CONVERT_EXPR); + gcc_assert (CONVERT_EXPR_P (cond)); op0 = TREE_OPERAND (cond, 0); tmp = create_tmp_var (TREE_TYPE (op0), NULL); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 6fc0840150f..f5ec0a737b4 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1569,8 +1569,7 @@ simplify_unary_expression (tree rhs) if (VN_INFO (op0)->has_constants) op0 = valueize_expr (VN_INFO (op0)->expr); - else if (TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR + else if (CONVERT_EXPR_P (rhs) || TREE_CODE (rhs) == REALPART_EXPR || TREE_CODE (rhs) == IMAGPART_EXPR || TREE_CODE (rhs) == VIEW_CONVERT_EXPR) diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index f368631fa2e..7c79a3df68d 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2911,8 +2911,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results) { switch (TREE_CODE (t)) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: { tree op = TREE_OPERAND (t, 0); diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index b15de2752eb..f5de5fdb7ac 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -455,8 +455,7 @@ simplify_control_stmt_condition (edge e, fold_defer_overflow_warnings (); cached_lhs = fold (COND_EXPR_COND (dummy_cond)); - while (TREE_CODE (cached_lhs) == NOP_EXPR - || TREE_CODE (cached_lhs) == CONVERT_EXPR) + while (CONVERT_EXPR_P (cached_lhs)) cached_lhs = TREE_OPERAND (cached_lhs, 0); fold_undefer_overflow_warnings (is_gimple_min_invariant (cached_lhs), diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 42d4e4952e8..9ba865e241d 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1216,7 +1216,7 @@ tree_ssa_useless_type_conversion (tree expr) the top of the RHS to the type of the LHS and the type conversion is "safe", then strip away the type conversion so that we can enter LHS = RHS into the const_and_copies table. */ - if (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR + if (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == VIEW_CONVERT_EXPR || TREE_CODE (expr) == NON_LVALUE_EXPR) /* FIXME: Use of GENERIC_TREE_TYPE here is a temporary measure to work diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index f1595fe99bc..728c37d4d6d 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -158,8 +158,7 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs, continue; } - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME) { lhs = TREE_OPERAND (rhs, 0); @@ -217,8 +216,7 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs, continue; } - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME) { lhs = TREE_OPERAND (rhs, 0); @@ -447,8 +445,7 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs) if (((TREE_CODE (rhs) == POINTER_PLUS_EXPR || TREE_CODE (rhs) == PLUS_EXPR) && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST) - || TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || CONVERT_EXPR_P (rhs)) rhs = TREE_OPERAND (rhs, 0); if (TREE_CODE (rhs) != SSA_NAME @@ -555,8 +552,7 @@ check_all_va_list_escapes (struct stdarg_info *si) statements. */ if ((TREE_CODE (rhs) == POINTER_PLUS_EXPR && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST) - || TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || CONVERT_EXPR_P (rhs)) rhs = TREE_OPERAND (rhs, 0); if (rhs == use) diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index 729ad799822..0ef7f9cc444 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -218,8 +218,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) scalar_type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0)); operation = GIMPLE_STMT_OPERAND (stmt, 1); - if (TREE_CODE (operation) == NOP_EXPR - || TREE_CODE (operation) == CONVERT_EXPR + if (CONVERT_EXPR_P (operation) || TREE_CODE (operation) == WIDEN_MULT_EXPR || TREE_CODE (operation) == FLOAT_EXPR) { diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index ac3f8437053..bfb41a67675 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -2172,8 +2172,7 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype, } break; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: if (BYTES_BIG_ENDIAN) { c1 = VEC_UNPACK_HI_EXPR; @@ -2267,8 +2266,7 @@ supportable_narrowing_operation (enum tree_code code, switch (code) { - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: c1 = VEC_PACK_TRUNC_EXPR; break; diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 4b409e46aaf..8636c5f4fa7 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -3797,12 +3797,10 @@ register_edge_assert_for_2 (tree name, edge e, block_stmt_iterator bsi, /* Extract NAME2 from the (optional) sign-changing cast. */ if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT - && (TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == NOP_EXPR - || TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == CONVERT_EXPR)) + && CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (def_stmt, 1))) { tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && ! TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (rhs, 0))) && (TYPE_PRECISION (TREE_TYPE (rhs)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (rhs, 0))))) @@ -3954,8 +3952,7 @@ register_edge_assert_for_1 (tree op, enum tree_code code, /* Recurse through the copy. */ retval |= register_edge_assert_for_1 (rhs, code, e, bsi); } - else if (TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + else if (CONVERT_EXPR_P (rhs)) { /* Recurse through the type conversion. */ retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0), diff --git a/gcc/tree.c b/gcc/tree.c index 933a2451b9f..5a0656c67ac 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1598,8 +1598,7 @@ int really_constant_p (const_tree exp) { /* This is not quite the same as STRIP_NOPS. It does more. */ - while (TREE_CODE (exp) == NOP_EXPR - || TREE_CODE (exp) == CONVERT_EXPR + while (CONVERT_EXPR_P (exp) || TREE_CODE (exp) == NON_LVALUE_EXPR) exp = TREE_OPERAND (exp, 0); return TREE_CONSTANT (exp); @@ -1918,7 +1917,7 @@ expr_align (const_tree t) switch (TREE_CODE (t)) { - case NOP_EXPR: case CONVERT_EXPR: case NON_LVALUE_EXPR: + CASE_CONVERT: case NON_LVALUE_EXPR: /* If we have conversions, we know that the alignment of the object must meet each of the alignments of the types. */ align0 = expr_align (TREE_OPERAND (t, 0)); @@ -2823,8 +2822,7 @@ stabilize_reference (tree ref) /* No action is needed in this case. */ return ref; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case FLOAT_EXPR: case FIX_TRUNC_EXPR: result = build_nt (code, stabilize_reference (TREE_OPERAND (ref, 0))); @@ -6054,8 +6052,7 @@ get_unwidened (tree op, tree for_type) && TYPE_UNSIGNED (type)); tree win = op; - while (TREE_CODE (op) == NOP_EXPR - || TREE_CODE (op) == CONVERT_EXPR) + while (CONVERT_EXPR_P (op)) { int bitschange; @@ -6093,8 +6090,7 @@ get_unwidened (tree op, tree for_type) Let's avoid computing it if it does not affect WIN and if UNS will not be needed again. */ if ((uns - || TREE_CODE (op) == NOP_EXPR - || TREE_CODE (op) == CONVERT_EXPR) + || CONVERT_EXPR_P (op)) && TYPE_UNSIGNED (TREE_TYPE (op))) { uns = 1; diff --git a/gcc/tree.h b/gcc/tree.h index 3f1e7b69e12..82c44b10a5d 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -995,12 +995,23 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, (TREE_CODE (NODE) == PHI_NODE ? PHI_CHAIN (NODE) : \ GIMPLE_STMT_P (NODE) ? NULL_TREE : TREE_CHAIN (NODE)) +/* Tests if expression is conversion expr (NOP_EXPRs or CONVERT_EXPRs). */ + +#define CONVERT_EXPR_P(EXP) \ + (TREE_CODE (EXP) == NOP_EXPR \ + || TREE_CODE (EXP) == CONVERT_EXPR) + +/* Generate case for NOP_EXPR, CONVERT_EXPR. */ + +#define CASE_CONVERT \ + case NOP_EXPR: \ + case CONVERT_EXPR + /* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs that don't change the machine mode. */ #define STRIP_NOPS(EXP) \ - while ((TREE_CODE (EXP) == NOP_EXPR \ - || TREE_CODE (EXP) == CONVERT_EXPR \ + while ((CONVERT_EXPR_P (EXP) \ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ && TREE_OPERAND (EXP, 0) != error_mark_node \ && (TYPE_MODE (TREE_TYPE (EXP)) \ @@ -1010,8 +1021,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, /* Like STRIP_NOPS, but don't let the signedness change either. */ #define STRIP_SIGN_NOPS(EXP) \ - while ((TREE_CODE (EXP) == NOP_EXPR \ - || TREE_CODE (EXP) == CONVERT_EXPR \ + while ((CONVERT_EXPR_P (EXP) \ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ && TREE_OPERAND (EXP, 0) != error_mark_node \ && (TYPE_MODE (TREE_TYPE (EXP)) \ @@ -1025,8 +1035,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, /* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */ #define STRIP_TYPE_NOPS(EXP) \ - while ((TREE_CODE (EXP) == NOP_EXPR \ - || TREE_CODE (EXP) == CONVERT_EXPR \ + while ((CONVERT_EXPR_P (EXP) \ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ && TREE_OPERAND (EXP, 0) != error_mark_node \ && (TREE_TYPE (EXP) \ diff --git a/gcc/varasm.c b/gcc/varasm.c index 0d22fc33c0c..d9468c4997d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2867,8 +2867,7 @@ const_hash_1 (const tree exp) return (const_hash_1 (TREE_OPERAND (exp, 0)) * 9 + const_hash_1 (TREE_OPERAND (exp, 1))); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: return const_hash_1 (TREE_OPERAND (exp, 0)) * 7 + 2; default: @@ -3021,8 +3020,7 @@ compare_constant (const tree t1, const tree t2) return (compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)) && compare_constant(TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1))); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: return compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)); @@ -3068,8 +3066,7 @@ copy_constant (tree exp) copy_constant (TREE_OPERAND (exp, 0)), copy_constant (TREE_OPERAND (exp, 1))); - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: return build1 (TREE_CODE (exp), TREE_TYPE (exp), copy_constant (TREE_OPERAND (exp, 0))); @@ -3966,8 +3963,7 @@ compute_reloc_for_constant (tree exp) reloc |= reloc2; break; - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: reloc = compute_reloc_for_constant (TREE_OPERAND (exp, 0)); break; @@ -4021,8 +4017,7 @@ output_addressed_constants (tree exp) output_addressed_constants (TREE_OPERAND (exp, 1)); /* Fall through. */ - case NOP_EXPR: - case CONVERT_EXPR: + CASE_CONVERT: case VIEW_CONVERT_EXPR: output_addressed_constants (TREE_OPERAND (exp, 0)); break; @@ -4128,8 +4123,7 @@ initializer_constant_valid_p (tree value, tree endtype) case NON_LVALUE_EXPR: return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); - case CONVERT_EXPR: - case NOP_EXPR: + CASE_CONVERT: { tree src; tree src_type; @@ -4245,8 +4239,7 @@ initializer_constant_valid_p (tree value, tree endtype) (int)(p1 - p2) to ((int)p1 - (int)p2) under the theory that the narrower operation is cheaper. */ - while (TREE_CODE (op0) == NOP_EXPR - || TREE_CODE (op0) == CONVERT_EXPR + while (CONVERT_EXPR_P (op0) || TREE_CODE (op0) == NON_LVALUE_EXPR) { tree inner = TREE_OPERAND (op0, 0); @@ -4258,8 +4251,7 @@ initializer_constant_valid_p (tree value, tree endtype) op0 = inner; } - while (TREE_CODE (op1) == NOP_EXPR - || TREE_CODE (op1) == CONVERT_EXPR + while (CONVERT_EXPR_P (op1) || TREE_CODE (op1) == NON_LVALUE_EXPR) { tree inner = TREE_OPERAND (op1, 0); @@ -4360,7 +4352,7 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) /* Eliminate any conversions since we'll be outputting the underlying constant. */ - while (TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR + while (CONVERT_EXPR_P (exp) || TREE_CODE (exp) == NON_LVALUE_EXPR || TREE_CODE (exp) == VIEW_CONVERT_EXPR) {