diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2004-03-03 08:35:33 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2004-03-03 08:35:33 +0000 |
commit | ec8e098d3d9adeb04512169974fd67acd9b9ca0f (patch) | |
tree | 79c63a2ca1f9598f1822ace38905a1fe19aeb364 /gcc/cse.c | |
parent | a841ab8b3ea849b3146285b09ecb60ad81c011bf (diff) | |
download | gcc-ec8e098d3d9adeb04512169974fd67acd9b9ca0f.zip gcc-ec8e098d3d9adeb04512169974fd67acd9b9ca0f.tar.gz gcc-ec8e098d3d9adeb04512169974fd67acd9b9ca0f.tar.bz2 |
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 57 |
1 files changed, 28 insertions, 29 deletions
@@ -1214,7 +1214,7 @@ mention_regs (rtx x) call that expensive function in the most common case where the only use of the register is in the comparison. */ - if (code == COMPARE || GET_RTX_CLASS (code) == '<') + if (code == COMPARE || COMPARISON_P (x)) { if (GET_CODE (XEXP (x, 0)) == REG && ! REGNO_QTY_VALID_P (REGNO (XEXP (x, 0)))) @@ -2953,8 +2953,7 @@ find_best_addr (rtx insn, rtx *loc, enum machine_mode mode) code on the Alpha for unaligned byte stores. */ if (flag_expensive_optimizations - && (GET_RTX_CLASS (GET_CODE (*loc)) == '2' - || GET_RTX_CLASS (GET_CODE (*loc)) == 'c') + && ARITHMETIC_P (*loc) && GET_CODE (XEXP (*loc, 0)) == REG) { rtx op1 = XEXP (*loc, 1); @@ -3068,7 +3067,7 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, /* If ARG1 is a comparison operator and CODE is testing for STORE_FLAG_VALUE, get the inner arguments. */ - else if (GET_RTX_CLASS (GET_CODE (arg1)) == '<') + else if (COMPARISON_P (arg1)) { #ifdef FLOAT_STORE_FLAG_VALUE REAL_VALUE_TYPE fsfv; @@ -3157,7 +3156,7 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, REAL_VALUE_NEGATIVE (fsfv))) #endif ) - && GET_RTX_CLASS (GET_CODE (p->exp)) == '<')) + && COMPARISON_P (p->exp))) { x = p->exp; break; @@ -3177,7 +3176,7 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, REAL_VALUE_NEGATIVE (fsfv))) #endif ) - && GET_RTX_CLASS (GET_CODE (p->exp)) == '<') + && COMPARISON_P (p->exp)) { reverse_code = 1; x = p->exp; @@ -3210,7 +3209,7 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, else code = reversed; } - else if (GET_RTX_CLASS (GET_CODE (x)) == '<') + else if (COMPARISON_P (x)) code = GET_CODE (x); arg1 = XEXP (x, 0), arg2 = XEXP (x, 1); } @@ -3391,9 +3390,9 @@ fold_rtx (rtx x, rtx insn) enum rtx_code eltcode = GET_CODE (elt->exp); /* Just check for unary and binary operations. */ - if (GET_RTX_CLASS (GET_CODE (elt->exp)) == '1' - && GET_CODE (elt->exp) != SIGN_EXTEND - && GET_CODE (elt->exp) != ZERO_EXTEND + if (UNARY_P (elt->exp) + && eltcode != SIGN_EXTEND + && eltcode != ZERO_EXTEND && GET_CODE (XEXP (elt->exp, 0)) == SUBREG && GET_MODE (SUBREG_REG (XEXP (elt->exp, 0))) == mode && (GET_MODE_CLASS (mode) @@ -3409,8 +3408,7 @@ fold_rtx (rtx x, rtx insn) new = simplify_unary_operation (GET_CODE (elt->exp), mode, op0, mode); } - else if ((GET_RTX_CLASS (GET_CODE (elt->exp)) == '2' - || GET_RTX_CLASS (GET_CODE (elt->exp)) == 'c') + else if (ARITHMETIC_P (elt->exp) && eltcode != DIV && eltcode != MOD && eltcode != UDIV && eltcode != UMOD && eltcode != ASHIFTRT && eltcode != LSHIFTRT @@ -3768,9 +3766,8 @@ fold_rtx (rtx x, rtx insn) if (validate_change (insn, &XEXP (x, i), replacements[j], 0)) break; - if (code == NE || code == EQ || GET_RTX_CLASS (code) == 'c' - || code == LTGT || code == UNEQ || code == ORDERED - || code == UNORDERED) + if (GET_RTX_CLASS (code) == RTX_COMM_COMPARE + || GET_RTX_CLASS (code) == RTX_COMM_ARITH) { validate_change (insn, &XEXP (x, i), XEXP (x, 1 - i), 1); validate_change (insn, &XEXP (x, 1 - i), replacements[j], 1); @@ -3802,9 +3799,7 @@ fold_rtx (rtx x, rtx insn) operand unless the first operand is also a constant integer. Otherwise, place any constant second unless the first operand is also a constant. */ - if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c' - || code == LTGT || code == UNEQ || code == ORDERED - || code == UNORDERED) + if (COMMUTATIVE_P (x)) { if (must_swap || swap_commutative_operands_p (const_arg0 ? const_arg0 @@ -3834,7 +3829,7 @@ fold_rtx (rtx x, rtx insn) switch (GET_RTX_CLASS (code)) { - case '1': + case RTX_UNARY: { int is_const = 0; @@ -3857,7 +3852,8 @@ fold_rtx (rtx x, rtx insn) } break; - case '<': + case RTX_COMPARE: + case RTX_COMM_COMPARE: /* See what items are actually being compared and set FOLDED_ARG[01] to those values and CODE to the actual comparison code. If any are constant, set CONST_ARG0 and CONST_ARG1 appropriately. We needn't @@ -4039,8 +4035,8 @@ fold_rtx (rtx x, rtx insn) #endif break; - case '2': - case 'c': + case RTX_BIN_ARITH: + case RTX_COMM_ARITH: switch (code) { case PLUS: @@ -4245,7 +4241,7 @@ fold_rtx (rtx x, rtx insn) const_arg1 ? const_arg1 : folded_arg1); break; - case 'o': + case RTX_OBJ: /* (lo_sum (high X) X) is simply X. */ if (code == LO_SUM && const_arg0 != 0 && GET_CODE (const_arg0) == HIGH @@ -4253,15 +4249,15 @@ fold_rtx (rtx x, rtx insn) return const_arg1; break; - case '3': - case 'b': + case RTX_TERNARY: + case RTX_BITFIELD_OPS: new = simplify_ternary_operation (code, mode, mode_arg0, const_arg0 ? const_arg0 : folded_arg0, const_arg1 ? const_arg1 : folded_arg1, const_arg2 ? const_arg2 : XEXP (x, 2)); break; - case 'x': + case RTX_EXTRA: /* Eliminate CONSTANT_P_RTX if its constant. */ if (code == CONSTANT_P_RTX) { @@ -4271,6 +4267,9 @@ fold_rtx (rtx x, rtx insn) return const0_rtx; } break; + + default: + break; } return new ? new : x; @@ -5647,7 +5646,7 @@ cse_insn (rtx insn, rtx libcall_insn) #ifdef PUSH_ROUNDING /* Stack pushes invalidate the stack pointer. */ rtx addr = XEXP (dest, 0); - if (GET_RTX_CLASS (GET_CODE (addr)) == 'a' + if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC && XEXP (addr, 0) == stack_pointer_rtx) invalidate (stack_pointer_rtx, Pmode); #endif @@ -6313,7 +6312,7 @@ invalidate_memory (void) static int addr_affects_sp_p (rtx addr) { - if (GET_RTX_CLASS (GET_CODE (addr)) == 'a' + if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC && GET_CODE (XEXP (addr, 0)) == REG && REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM) { @@ -7193,7 +7192,7 @@ cse_basic_block (rtx from, rtx to, struct branch_path *next_branch, if (GET_MODE (insn) == QImode) PUT_MODE (insn, VOIDmode); - if (GET_RTX_CLASS (code) == 'i') + if (GET_RTX_CLASS (code) == RTX_INSN) { rtx p; |