Mercurial > hg > CbC > CbC_gcc
diff gcc/tree-ssa-reassoc.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
line wrap: on
line diff
--- a/gcc/tree-ssa-reassoc.c Sun Feb 07 18:28:00 2010 +0900 +++ b/gcc/tree-ssa-reassoc.c Fri Feb 12 23:39:51 2010 +0900 @@ -106,34 +106,34 @@ mergetmp2 = d + e and put mergetmp2 on the merge worklist. - + so merge worklist = {mergetmp, c, mergetmp2} - + Continue building binary ops of these operations until you have only one operation left on the worklist. - + So we have - + build binary op mergetmp3 = mergetmp + c - + worklist = {mergetmp2, mergetmp3} - + mergetmp4 = mergetmp2 + mergetmp3 - + worklist = {mergetmp4} - + because we have one operation left, we can now just set the original statement equal to the result of that operation. - + This will at least expose a + b and d + e to redundancy elimination as binary operations. - + For extra points, you can reuse the old statements to build the mergetmps, since you shouldn't run out. So why don't we do this? - + Because it's expensive, and rarely will help. Most trees we are reassociating have 3 or less ops. If they have 2 ops, they already will be written into a nice single binary op. If you have 3 ops, a @@ -142,15 +142,15 @@ mergetmp = op1 + op2 newstmt = mergetmp + op3 - + instead of mergetmp = op2 + op3 newstmt = mergetmp + op1 - + If all three are of the same rank, you can't expose them all in a single binary operator anyway, so the above is *still* the best you can do. - + Thus, this is what we do. When we have three ops left, we check to see what order to put them in, and call it a day. As a nod to vector sum reduction, we check if any of the ops are really a phi node that is a @@ -192,7 +192,7 @@ find_operand_rank (tree e) { void **slot = pointer_map_contains (operand_rank, e); - return slot ? (long) *slot : -1; + return slot ? (long) (intptr_t) *slot : -1; } /* Insert {E,RANK} into the operand rank hashtable. */ @@ -204,7 +204,7 @@ gcc_assert (rank > 0); slot = pointer_map_insert (operand_rank, e); gcc_assert (!*slot); - *slot = (void *) rank; + *slot = (void *) (intptr_t) rank; } /* Given an expression E, return the rank of the expression. */ @@ -242,7 +242,7 @@ return 0; if (!is_gimple_assign (stmt) - || !ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS)) + || gimple_vdef (stmt)) return bb_rank[gimple_bb (stmt)->index]; /* If we already have a rank for this expression, use that. */ @@ -447,7 +447,7 @@ { VEC_free (operand_entry_t, heap, *ops); *ops = NULL; - add_to_ops_vec (ops, fold_convert (TREE_TYPE (last->op), + add_to_ops_vec (ops, fold_convert (TREE_TYPE (last->op), integer_zero_node)); *all_done = true; } @@ -511,7 +511,7 @@ } VEC_ordered_remove (operand_entry_t, *ops, i); - add_to_ops_vec (ops, fold_convert(TREE_TYPE (oe->op), + add_to_ops_vec (ops, fold_convert(TREE_TYPE (oe->op), integer_zero_node)); VEC_ordered_remove (operand_entry_t, *ops, currindex); reassociate_stats.ops_eliminated ++; @@ -579,7 +579,7 @@ oe->op = build_low_bits_mask (TREE_TYPE (oe->op), TYPE_PRECISION (TREE_TYPE (oe->op))); - reassociate_stats.ops_eliminated + reassociate_stats.ops_eliminated += VEC_length (operand_entry_t, *ops) - 1; VEC_free (operand_entry_t, heap, *ops); *ops = NULL; @@ -618,9 +618,9 @@ if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Found & 0, removing all other ops\n"); - reassociate_stats.ops_eliminated + reassociate_stats.ops_eliminated += VEC_length (operand_entry_t, *ops) - 1; - + VEC_free (operand_entry_t, heap, *ops); *ops = NULL; VEC_safe_push (operand_entry_t, heap, *ops, oelast); @@ -646,15 +646,15 @@ if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Found | -1, removing all other ops\n"); - reassociate_stats.ops_eliminated + reassociate_stats.ops_eliminated += VEC_length (operand_entry_t, *ops) - 1; - + VEC_free (operand_entry_t, heap, *ops); *ops = NULL; VEC_safe_push (operand_entry_t, heap, *ops, oelast); return; } - } + } else if (integer_zerop (oelast->op)) { if (VEC_length (operand_entry_t, *ops) != 1) @@ -677,8 +677,8 @@ { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Found * 0, removing all other ops\n"); - - reassociate_stats.ops_eliminated + + reassociate_stats.ops_eliminated += VEC_length (operand_entry_t, *ops) - 1; VEC_free (operand_entry_t, heap, *ops); *ops = NULL; @@ -1740,14 +1740,14 @@ We do this top down because we don't know whether the subtract is part of a possible chain of reassociation except at the top. - + IE given d = f + g c = a + e b = c - d q = b - r k = t - q - + we want to break up k = t - q, but we won't until we've transformed q = b - r, which won't be broken up until we transform b = c - d. @@ -2070,7 +2070,7 @@ NULL, /* next */ 0, /* static_pass_number */ TV_TREE_REASSOC, /* tv_id */ - PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */ + PROP_cfg | PROP_ssa, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */