Commit 3e6688a7 by Eric Christopher

fold-const.c (tree_swap_operands_p): Remove duplicated code.

2004-09-29  Eric Christopher  <echristo@redhat.com>

	* fold-const.c (tree_swap_operands_p): Remove duplicated code.

From-SVN: r88299
parent 8820e4be
2004-09-29 Eric Christopher <echristo@redhat.com>
* fold-const.c (tree_swap_operands_p): Remove duplicated code.
2004-09-29 Hans-Peter Nilsson <hp@axis.com> 2004-09-29 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.md (moverside, movemside): With MEM, make sure * config/cris/cris.md (moverside, movemside): With MEM, make sure
...@@ -155,7 +159,7 @@ ...@@ -155,7 +159,7 @@
* config/s390/s390.c (s390_adjust_cost): Remove. * config/s390/s390.c (s390_adjust_cost): Remove.
(TARGET_SCHED_ADJUST_COST): Do not redefine. (TARGET_SCHED_ADJUST_COST): Do not redefine.
(s390_adjust_priority): Handle TYPE_STM like TYPE_STORE. (s390_adjust_priority): Handle TYPE_STM like TYPE_STORE.
* config/s390/s390.md ("main_pool"): Use "larl" type * config/s390/s390.md ("main_pool"): Use "larl" type
attribute if TARGET_CPU_ZARCH. attribute if TARGET_CPU_ZARCH.
2004-09-28 Jakub Jelinek <jakub@redhat.com> 2004-09-28 Jakub Jelinek <jakub@redhat.com>
...@@ -204,7 +208,7 @@ ...@@ -204,7 +208,7 @@
2004-09-28 Devang Patel <dpatel@apple.com> 2004-09-28 Devang Patel <dpatel@apple.com>
* tree-pretty-print.c (dump_generic_node): Print vector types. * tree-pretty-print.c (dump_generic_node): Print vector types.
2004-09-28 Nick Clifton <nickc@redhat.com> 2004-09-28 Nick Clifton <nickc@redhat.com>
* config/sh/sh.h (INIT_CUMULATIVE_ARGS): Replace with an * config/sh/sh.h (INIT_CUMULATIVE_ARGS): Replace with an
...@@ -561,7 +565,7 @@ ...@@ -561,7 +565,7 @@
* tree-ssa-propagate.c (simulate_stmt): Likewise. * tree-ssa-propagate.c (simulate_stmt): Likewise.
(simulate_block): Likewise. (simulate_block): Likewise.
(ssa_prop_init): Likewise. (ssa_prop_init): Likewise.
* tree-ssa-threadupdate.c (thread_block): Likewise. * tree-ssa-threadupdate.c (thread_block): Likewise.
(create_block_for_threading): Likewise. (create_block_for_threading): Likewise.
(remove_last_stmt_and_useless_edges): Likewise. (remove_last_stmt_and_useless_edges): Likewise.
* tree-ssa.c (verify_phi_args): Likewise. * tree-ssa.c (verify_phi_args): Likewise.
...@@ -683,7 +687,7 @@ ...@@ -683,7 +687,7 @@
2004-09-27 Devang Patel <dpatel@apple.com> 2004-09-27 Devang Patel <dpatel@apple.com>
* tree-pretty-print.c (dump_generic_node): Print VEC_COND_EXPR. * tree-pretty-print.c (dump_generic_node): Print VEC_COND_EXPR.
2004-09-27 Jan Hubicka <jh@suse.cz> 2004-09-27 Jan Hubicka <jh@suse.cz>
* i386.c (athlon_cost, k8_cost): Set BRANCH_COST to 5. * i386.c (athlon_cost, k8_cost): Set BRANCH_COST to 5.
...@@ -700,7 +704,7 @@ ...@@ -700,7 +704,7 @@
* ggc-page.c (GGC_QUIRE_SIZE): Bump up from 16 to 256 if we're * ggc-page.c (GGC_QUIRE_SIZE): Bump up from 16 to 256 if we're
using mmap. using mmap.
2004-09-26 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2004-09-26 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
...@@ -898,7 +902,7 @@ ...@@ -898,7 +902,7 @@
only if compiling with back chain. only if compiling with back chain.
("save_stack_nonlocal", "restore_stack_nonlocal"): Save/restore ("save_stack_nonlocal", "restore_stack_nonlocal"): Save/restore
back chain only if back chain enabled. Use s390_back_chain_rtx. back chain only if back chain enabled. Use s390_back_chain_rtx.
2004-09-25 Joseph S. Myers <jsm@polyomino.org.uk> 2004-09-25 Joseph S. Myers <jsm@polyomino.org.uk>
* doc/trouble.texi: Remove obsolete information. Update * doc/trouble.texi: Remove obsolete information. Update
...@@ -980,7 +984,7 @@ ...@@ -980,7 +984,7 @@
* tree-if-conv.c (tree_if_convert_cond_expr0: Create temp. variable * tree-if-conv.c (tree_if_convert_cond_expr0: Create temp. variable
only when necesssary. only when necesssary.
(combine_blocks): Combine loop header and exit block. (combine_blocks): Combine loop header and exit block.
2004-09-24 Paolo Bonzini <bonzini@gnu.org> 2004-09-24 Paolo Bonzini <bonzini@gnu.org>
* hooks.c (hook_tree_tree_bool_null): New. * hooks.c (hook_tree_tree_bool_null): New.
...@@ -1087,7 +1091,7 @@ ...@@ -1087,7 +1091,7 @@
PR c++/13989 PR c++/13989
PR c++/9844 PR c++/9844
* tree.c (reconstruct_complex_type): Remove extra "this". * tree.c (reconstruct_complex_type): Remove extra "this".
* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): * config/rs6000/rs6000.c (rs6000_handle_altivec_attribute):
Add V4SFmode to case statement. Add V4SFmode to case statement.
2004-09-23 Joseph S. Myers <jsm@polyomino.org.uk> 2004-09-23 Joseph S. Myers <jsm@polyomino.org.uk>
...@@ -1105,7 +1109,7 @@ ...@@ -1105,7 +1109,7 @@
dominance data during error message printing. dominance data during error message printing.
* tree-mudflap.c (mf_build_check_statement_for): Build basic blocks * tree-mudflap.c (mf_build_check_statement_for): Build basic blocks
and edges more correctly. and edges more correctly.
2004-09-23 Dorit Naishlos <dorit@il.ibm.com> 2004-09-23 Dorit Naishlos <dorit@il.ibm.com>
* tree.def (ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): * tree.def (ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF):
......
...@@ -209,7 +209,7 @@ force_fit_type (tree t, int overflowable, ...@@ -209,7 +209,7 @@ force_fit_type (tree t, int overflowable,
int sign_extended_type; int sign_extended_type;
gcc_assert (TREE_CODE (t) == INTEGER_CST); gcc_assert (TREE_CODE (t) == INTEGER_CST);
low = TREE_INT_CST_LOW (t); low = TREE_INT_CST_LOW (t);
high = TREE_INT_CST_HIGH (t); high = TREE_INT_CST_HIGH (t);
...@@ -267,7 +267,7 @@ force_fit_type (tree t, int overflowable, ...@@ -267,7 +267,7 @@ force_fit_type (tree t, int overflowable,
|| low != TREE_INT_CST_LOW (t) || high != TREE_INT_CST_HIGH (t)) || low != TREE_INT_CST_LOW (t) || high != TREE_INT_CST_HIGH (t))
{ {
t = build_int_cst_wide (TREE_TYPE (t), low, high); t = build_int_cst_wide (TREE_TYPE (t), low, high);
if (overflowed if (overflowed
|| overflowable < 0 || overflowable < 0
|| (overflowable > 0 && sign_extended_type)) || (overflowable > 0 && sign_extended_type))
...@@ -282,7 +282,7 @@ force_fit_type (tree t, int overflowable, ...@@ -282,7 +282,7 @@ force_fit_type (tree t, int overflowable,
TREE_CONSTANT_OVERFLOW (t) = 1; TREE_CONSTANT_OVERFLOW (t) = 1;
} }
} }
return t; return t;
} }
...@@ -1451,7 +1451,7 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) ...@@ -1451,7 +1451,7 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
| TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2), | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2),
TREE_CONSTANT_OVERFLOW (arg1) TREE_CONSTANT_OVERFLOW (arg1)
| TREE_CONSTANT_OVERFLOW (arg2)); | TREE_CONSTANT_OVERFLOW (arg2));
return t; return t;
} }
...@@ -1890,7 +1890,7 @@ fold_convert (tree type, tree arg) ...@@ -1890,7 +1890,7 @@ fold_convert (tree type, tree arg)
gcc_assert (TREE_CODE (orig) == VECTOR_TYPE gcc_assert (TREE_CODE (orig) == VECTOR_TYPE
&& tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
return fold (build1 (NOP_EXPR, type, arg)); return fold (build1 (NOP_EXPR, type, arg));
case REAL_TYPE: case REAL_TYPE:
if (TREE_CODE (arg) == INTEGER_CST) if (TREE_CODE (arg) == INTEGER_CST)
{ {
...@@ -1911,19 +1911,19 @@ fold_convert (tree type, tree arg) ...@@ -1911,19 +1911,19 @@ fold_convert (tree type, tree arg)
case BOOLEAN_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE: case ENUMERAL_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE: case POINTER_TYPE: case REFERENCE_TYPE:
return fold (build1 (FLOAT_EXPR, type, arg)); return fold (build1 (FLOAT_EXPR, type, arg));
case REAL_TYPE: case REAL_TYPE:
return fold (build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR, return fold (build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR,
type, arg)); type, arg));
case COMPLEX_TYPE: case COMPLEX_TYPE:
tem = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg)); tem = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
return fold_convert (type, tem); return fold_convert (type, tem);
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
case COMPLEX_TYPE: case COMPLEX_TYPE:
switch (TREE_CODE (orig)) switch (TREE_CODE (orig))
{ {
...@@ -1937,14 +1937,14 @@ fold_convert (tree type, tree arg) ...@@ -1937,14 +1937,14 @@ fold_convert (tree type, tree arg)
case COMPLEX_TYPE: case COMPLEX_TYPE:
{ {
tree rpart, ipart; tree rpart, ipart;
if (TREE_CODE (arg) == COMPLEX_EXPR) if (TREE_CODE (arg) == COMPLEX_EXPR)
{ {
rpart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 0)); rpart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 0));
ipart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 1)); ipart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 1));
return fold (build2 (COMPLEX_EXPR, type, rpart, ipart)); return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
} }
arg = save_expr (arg); arg = save_expr (arg);
rpart = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg)); rpart = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
ipart = fold (build1 (IMAGPART_EXPR, TREE_TYPE (orig), arg)); ipart = fold (build1 (IMAGPART_EXPR, TREE_TYPE (orig), arg));
...@@ -1952,11 +1952,11 @@ fold_convert (tree type, tree arg) ...@@ -1952,11 +1952,11 @@ fold_convert (tree type, tree arg)
ipart = fold_convert (TREE_TYPE (type), ipart); ipart = fold_convert (TREE_TYPE (type), ipart);
return fold (build2 (COMPLEX_EXPR, type, rpart, ipart)); return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
} }
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
case VECTOR_TYPE: case VECTOR_TYPE:
if (integer_zerop (arg)) if (integer_zerop (arg))
return build_zero_vector (type); return build_zero_vector (type);
...@@ -3310,7 +3310,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -3310,7 +3310,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize,
mask = build_int_cst (unsigned_type, -1); mask = build_int_cst (unsigned_type, -1);
mask = force_fit_type (mask, 0, false, false); mask = force_fit_type (mask, 0, false, false);
mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0); mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0); mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
...@@ -3336,7 +3336,7 @@ all_ones_mask_p (tree mask, int size) ...@@ -3336,7 +3336,7 @@ all_ones_mask_p (tree mask, int size)
tmask = build_int_cst (lang_hooks.types.signed_type (type), -1); tmask = build_int_cst (lang_hooks.types.signed_type (type), -1);
tmask = force_fit_type (tmask, 0, false, false); tmask = force_fit_type (tmask, 0, false, false);
return return
tree_int_cst_equal (mask, tree_int_cst_equal (mask,
const_binop (RSHIFT_EXPR, const_binop (RSHIFT_EXPR,
...@@ -5902,7 +5902,7 @@ static bool ...@@ -5902,7 +5902,7 @@ static bool
reorder_operands_p (tree arg0, tree arg1) reorder_operands_p (tree arg0, tree arg1)
{ {
if (! flag_evaluation_order) if (! flag_evaluation_order)
return true; return true;
if (TREE_CONSTANT (arg0) || TREE_CONSTANT (arg1)) if (TREE_CONSTANT (arg0) || TREE_CONSTANT (arg1))
return true; return true;
return ! TREE_SIDE_EFFECTS (arg0) return ! TREE_SIDE_EFFECTS (arg0)
...@@ -5952,15 +5952,6 @@ tree_swap_operands_p (tree arg0, tree arg1, bool reorder) ...@@ -5952,15 +5952,6 @@ tree_swap_operands_p (tree arg0, tree arg1, bool reorder)
if (DECL_P (arg0)) if (DECL_P (arg0))
return 1; return 1;
if (reorder && flag_evaluation_order
&& (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1)))
return 0;
if (DECL_P (arg1))
return 0;
if (DECL_P (arg0))
return 1;
/* It is preferable to swap two SSA_NAME to ensure a canonical form /* It is preferable to swap two SSA_NAME to ensure a canonical form
for commutative and comparison operators. Ensuring a canonical for commutative and comparison operators. Ensuring a canonical
form allows the optimizers to find additional redundancies without form allows the optimizers to find additional redundancies without
...@@ -10288,7 +10279,7 @@ fold_negate_const (tree arg0, tree type) ...@@ -10288,7 +10279,7 @@ fold_negate_const (tree arg0, tree type)
TREE_CONSTANT_OVERFLOW (arg0)); TREE_CONSTANT_OVERFLOW (arg0));
break; break;
} }
case REAL_CST: case REAL_CST:
t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0))); t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
break; break;
...@@ -10296,7 +10287,7 @@ fold_negate_const (tree arg0, tree type) ...@@ -10296,7 +10287,7 @@ fold_negate_const (tree arg0, tree type)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
return t; return t;
} }
...@@ -10334,18 +10325,18 @@ fold_abs_const (tree arg0, tree type) ...@@ -10334,18 +10325,18 @@ fold_abs_const (tree arg0, tree type)
TREE_CONSTANT_OVERFLOW (arg0)); TREE_CONSTANT_OVERFLOW (arg0));
} }
break; break;
case REAL_CST: case REAL_CST:
if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg0))) if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg0)))
t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0))); t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
else else
t = arg0; t = arg0;
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
return t; return t;
} }
...@@ -10358,13 +10349,13 @@ fold_not_const (tree arg0, tree type) ...@@ -10358,13 +10349,13 @@ fold_not_const (tree arg0, tree type)
tree t = NULL_TREE; tree t = NULL_TREE;
gcc_assert (TREE_CODE (arg0) == INTEGER_CST); gcc_assert (TREE_CODE (arg0) == INTEGER_CST);
t = build_int_cst_wide (type, t = build_int_cst_wide (type,
~ TREE_INT_CST_LOW (arg0), ~ TREE_INT_CST_LOW (arg0),
~ TREE_INT_CST_HIGH (arg0)); ~ TREE_INT_CST_HIGH (arg0));
t = force_fit_type (t, 0, TREE_OVERFLOW (arg0), t = force_fit_type (t, 0, TREE_OVERFLOW (arg0),
TREE_CONSTANT_OVERFLOW (arg0)); TREE_CONSTANT_OVERFLOW (arg0));
return t; return t;
} }
...@@ -10630,7 +10621,7 @@ round_up (tree value, int divisor) ...@@ -10630,7 +10621,7 @@ round_up (tree value, int divisor)
if (divisor == (divisor & -divisor)) if (divisor == (divisor & -divisor))
{ {
tree t; tree t;
t = build_int_cst (TREE_TYPE (value), divisor - 1); t = build_int_cst (TREE_TYPE (value), divisor - 1);
value = size_binop (PLUS_EXPR, value, t); value = size_binop (PLUS_EXPR, value, t);
t = build_int_cst (TREE_TYPE (value), -divisor); t = build_int_cst (TREE_TYPE (value), -divisor);
...@@ -10674,7 +10665,7 @@ round_down (tree value, int divisor) ...@@ -10674,7 +10665,7 @@ round_down (tree value, int divisor)
if (divisor == (divisor & -divisor)) if (divisor == (divisor & -divisor))
{ {
tree t; tree t;
t = build_int_cst (TREE_TYPE (value), -divisor); t = build_int_cst (TREE_TYPE (value), -divisor);
value = size_binop (BIT_AND_EXPR, value, t); value = size_binop (BIT_AND_EXPR, value, t);
} }
...@@ -10701,7 +10692,7 @@ ptr_difference_const (tree e1, tree e2, HOST_WIDE_INT *diff) ...@@ -10701,7 +10692,7 @@ ptr_difference_const (tree e1, tree e2, HOST_WIDE_INT *diff)
tree toffset1, toffset2, tdiff, type; tree toffset1, toffset2, tdiff, type;
enum machine_mode mode1, mode2; enum machine_mode mode1, mode2;
int unsignedp1, unsignedp2, volatilep1, volatilep2; int unsignedp1, unsignedp2, volatilep1, volatilep2;
core1 = get_inner_reference (e1, &bitsize1, &bitpos1, &toffset1, &mode1, core1 = get_inner_reference (e1, &bitsize1, &bitpos1, &toffset1, &mode1,
&unsignedp1, &volatilep1); &unsignedp1, &volatilep1);
core2 = get_inner_reference (e2, &bitsize2, &bitpos2, &toffset2, &mode2, core2 = get_inner_reference (e2, &bitsize2, &bitpos2, &toffset2, &mode2,
......
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