gcc/gcc/tree-ssa-pre.c

4308 lines
121 KiB
C
Raw Normal View History

/* SSA-PRE for trees.
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org> and Steven Bosscher
2006-07-04 23:23:03 +02:00
<stevenb@suse.de>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
2005-06-25 04:02:01 +02:00
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
#include "tree.h"
#include "basic-block.h"
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
#include "tree-gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "fibheap.h"
#include "hashtab.h"
#include "tree-iterator.h"
#include "real.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "flags.h"
#include "bitmap.h"
#include "langhooks.h"
#include "cfgloop.h"
/* TODO:
2006-07-04 23:23:03 +02:00
1. Avail sets can be shared by making an avail_find_leader that
walks up the dominator tree and looks in those avail sets.
This might affect code optimality, it's unclear right now.
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2. Strength reduction can be performed by anticipating expressions
we can repair later on.
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
3. We can do back-substitution or smarter value numbering to catch
commutative expressions split up over multiple statements.
4. ANTIC_SAFE_LOADS could be a lot smarter than it is now.
Right now, it is simply calculating loads that occur before
any store in a block, instead of loads that occur before
stores that affect them. This is relatively more expensive, and
it's not clear how much more it will buy us.
2006-07-04 23:23:03 +02:00
*/
/* For ease of terminology, "expression node" in the below refers to
every expression node but MODIFY_EXPR, because MODIFY_EXPR's represent
the actual statement containing the expressions we care about, and
we cache the value number by putting it in the expression. */
/* Basic algorithm
2006-07-04 23:23:03 +02:00
First we walk the statements to generate the AVAIL sets, the
EXP_GEN sets, and the tmp_gen sets. EXP_GEN sets represent the
generation of values/expressions by a given block. We use them
when computing the ANTIC sets. The AVAIL sets consist of
SSA_NAME's that represent values, so we know what values are
available in what blocks. AVAIL is a forward dataflow problem. In
SSA, values are never killed, so we don't need a kill set, or a
fixpoint iteration, in order to calculate the AVAIL sets. In
traditional parlance, AVAIL sets tell us the downsafety of the
expressions/values.
2006-07-04 23:23:03 +02:00
Next, we generate the ANTIC sets. These sets represent the
anticipatable expressions. ANTIC is a backwards dataflow
problem. An expression is anticipatable in a given block if it could
be generated in that block. This means that if we had to perform
an insertion in that block, of the value of that expression, we
could. Calculating the ANTIC sets requires phi translation of
expressions, because the flow goes backwards through phis. We must
iterate to a fixpoint of the ANTIC sets, because we have a kill
set. Even in SSA form, values are not live over the entire
function, only from their definition point onwards. So we have to
remove values from the ANTIC set once we go past the definition
point of the leaders that make them up.
compute_antic/compute_antic_aux performs this computation.
Third, we perform insertions to make partially redundant
expressions fully redundant.
An expression is partially redundant (excluding partial
anticipation) if:
1. It is AVAIL in some, but not all, of the predecessors of a
given block.
2. It is ANTIC in all the predecessors.
In order to make it fully redundant, we insert the expression into
the predecessors where it is not available, but is ANTIC.
For the partial anticipation case, we only perform insertion if it
is partially anticipated in some block, and fully available in all
of the predecessors.
insert/insert_aux/do_regular_insertion/do_partial_partial_insertion
performs these steps.
Fourth, we eliminate fully redundant expressions.
This is a simple statement walk that replaces redundant
calculations with the now available values. */
/* Representations of value numbers:
Value numbers are represented using the "value handle" approach.
This means that each SSA_NAME (and for other reasons to be
disclosed in a moment, expression nodes) has a value handle that
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
can be retrieved through get_value_handle. This value handle *is*
the value number of the SSA_NAME. You can pointer compare the
value handles for equivalence purposes.
For debugging reasons, the value handle is internally more than
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
just a number, it is a VALUE_HANDLE named "VH.x", where x is a
unique number for each value number in use. This allows
expressions with SSA_NAMES replaced by value handles to still be
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
pretty printed in a sane way. They simply print as "VH.3 *
VH.5", etc.
Expression nodes have value handles associated with them as a
cache. Otherwise, we'd have to look them up again in the hash
table This makes significant difference (factor of two or more) on
some test cases. They can be thrown away after the pass is
finished. */
2006-07-04 23:23:03 +02:00
/* Representation of expressions on value numbers:
In some portions of this code, you will notice we allocate "fake"
analogues to the expression we are value numbering, and replace the
operands with the values of the expression. Since we work on
values, and not just names, we canonicalize expressions to value
2006-07-04 23:23:03 +02:00
expressions for use in the ANTIC sets, the EXP_GEN set, etc.
This is theoretically unnecessary, it just saves a bunch of
repeated get_value_handle and find_leader calls in the remainder of
the code, trading off temporary memory usage for speed. The tree
nodes aren't actually creating more garbage, since they are
allocated in a special pools which are thrown away at the end of
2006-07-04 23:23:03 +02:00
this pass.
All of this also means that if you print the EXP_GEN or ANTIC sets,
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
you will see "VH.5 + VH.7" in the set, instead of "a_55 +
b_66" or something. The only thing that actually cares about
seeing the value leaders is phi translation, and it needs to be
able to find the leader for a value in an arbitrary block, so this
"value expression" form is perfect for it (otherwise you'd do
get_value_handle->find_leader->translate->get_value_handle->find_leader).*/
/* Representation of sets:
There are currently two types of sets used, hopefully to be unified soon.
The AVAIL sets do not need to be sorted in any particular order,
and thus, are simply represented as two bitmaps, one that keeps
track of values present in the set, and one that keeps track of
expressions present in the set.
2006-07-04 23:23:03 +02:00
The other sets are represented as doubly linked lists kept in topological
order, with an optional supporting bitmap of values present in the
set. The sets represent values, and the elements can be values or
expressions. The elements can appear in different sets, but each
element can only appear once in each set.
Since each node in the set represents a value, we also want to be
able to map expression, set pairs to something that tells us
whether the value is present is a set. We use a per-set bitmap for
that. The value handles also point to a linked list of the
expressions they represent via a tree annotation. This is mainly
useful only for debugging, since we don't do identity lookups. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Next global expression id number. */
static unsigned int next_expression_id;
/* Mapping from expression to id number we can use in bitmap sets. */
static VEC(tree, heap) *expressions;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Allocate an expression id for EXPR. */
static inline unsigned int
alloc_expression_id (tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree_ann_common_t ann;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ann = get_tree_common_ann (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Make sure we won't overflow. */
gcc_assert (next_expression_id + 1 > next_expression_id);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ann->aux = XNEW (unsigned int);
* ((unsigned int *)ann->aux) = next_expression_id++;
VEC_safe_push (tree, heap, expressions, expr);
return next_expression_id - 1;
}
/* Return the expression id for tree EXPR. */
static inline unsigned int
get_expression_id (tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree_ann_common_t ann = tree_common_ann (expr);
gcc_assert (ann);
gcc_assert (ann->aux);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return *((unsigned int *)ann->aux);
}
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return the existing expression id for EXPR, or create one if one
does not exist yet. */
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static inline unsigned int
get_or_alloc_expression_id (tree expr)
{
tree_ann_common_t ann = tree_common_ann (expr);
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (ann == NULL || !ann->aux)
return alloc_expression_id (expr);
return get_expression_id (expr);
}
/* Return the expression that has expression id ID */
static inline tree
expression_for_id (unsigned int id)
{
return VEC_index (tree, expressions, id);
}
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Free the expression id field in all of our expressions,
and then destroy the expressions array. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static void
clear_expression_ids (void)
{
int i;
tree expr;
for (i = 0; VEC_iterate (tree, expressions, i, expr); i++)
{
free (tree_common_ann (expr)->aux);
tree_common_ann (expr)->aux = NULL;
}
VEC_free (tree, heap, expressions);
}
static bool in_fre = false;
/* An unordered bitmap set. One bitmap tracks values, the other,
expressions. */
typedef struct bitmap_set
{
bitmap expressions;
bitmap values;
} *bitmap_set_t;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
#define FOR_EACH_EXPR_ID_IN_SET(set, id, bi) \
EXECUTE_IF_SET_IN_BITMAP(set->expressions, 0, id, bi)
/* Sets that we need to keep track of. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
typedef struct bb_bitmap_sets
{
/* The EXP_GEN set, which represents expressions/values generated in
a basic block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exp_gen;
/* The PHI_GEN set, which represents PHI results generated in a
basic block. */
bitmap_set_t phi_gen;
/* The TMP_GEN set, which represents results/temporaries generated
in a basic block. IE the LHS of an expression. */
bitmap_set_t tmp_gen;
/* The AVAIL_OUT set, which represents which values are available in
a given basic block. */
bitmap_set_t avail_out;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* The ANTIC_IN set, which represents which values are anticipatable
in a given basic block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t antic_in;
/* The PA_IN set, which represents which values are
partially anticipatable in a given basic block. */
bitmap_set_t pa_in;
/* The NEW_SETS set, which is used during insertion to augment the
AVAIL_OUT set of blocks with the new insertions performed during
the current iteration. */
bitmap_set_t new_sets;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* The RVUSE sets, which are used during ANTIC computation to ensure
that we don't mark loads ANTIC once they have died. */
bitmap rvuse_in;
bitmap rvuse_out;
bitmap rvuse_gen;
bitmap rvuse_kill;
/* For actually occurring loads, as long as they occur before all the
other stores in the block, we know they are antic at the top of
the block, regardless of RVUSE_KILL. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t antic_safe_loads;
/* True if we have visited this block during ANTIC calculation. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int visited:1;
/* True we have deferred processing this block during ANTIC
calculation until its successor is processed. */
unsigned int deferred : 1;
} *bb_value_sets_t;
#define EXP_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->exp_gen
#define PHI_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->phi_gen
#define TMP_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->tmp_gen
#define AVAIL_OUT(BB) ((bb_value_sets_t) ((BB)->aux))->avail_out
#define ANTIC_IN(BB) ((bb_value_sets_t) ((BB)->aux))->antic_in
#define PA_IN(BB) ((bb_value_sets_t) ((BB)->aux))->pa_in
#define RVUSE_IN(BB) ((bb_value_sets_t) ((BB)->aux))->rvuse_in
#define RVUSE_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->rvuse_gen
#define RVUSE_KILL(BB) ((bb_value_sets_t) ((BB)->aux))->rvuse_kill
#define RVUSE_OUT(BB) ((bb_value_sets_t) ((BB)->aux))->rvuse_out
#define NEW_SETS(BB) ((bb_value_sets_t) ((BB)->aux))->new_sets
#define ANTIC_SAFE_LOADS(BB) ((bb_value_sets_t) ((BB)->aux))->antic_safe_loads
#define BB_VISITED(BB) ((bb_value_sets_t) ((BB)->aux))->visited
#define BB_DEFERRED(BB) ((bb_value_sets_t) ((BB)->aux))->deferred
/* Maximal set of values, used to initialize the ANTIC problem, which
is an intersection problem. */
static bitmap_set_t maximal_set;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Basic block list in postorder. */
static int *postorder;
/* This structure is used to keep track of statistics on what
optimization PRE was able to perform. */
static struct
{
/* The number of RHS computations eliminated by PRE. */
int eliminations;
/* The number of new expressions/temporaries generated by PRE. */
int insertions;
/* The number of inserts found due to partial anticipation */
int pa_insert;
/* The number of new PHI nodes added by PRE. */
int phis;
2006-07-04 23:23:03 +02:00
/* The number of values found constant. */
int constified;
2006-07-04 23:23:03 +02:00
} pre_stats;
static bool do_partial_partial;
static tree bitmap_find_leader (bitmap_set_t, tree);
static void bitmap_value_insert_into_set (bitmap_set_t, tree);
static void bitmap_value_replace_in_set (bitmap_set_t, tree);
static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
static bool bitmap_set_contains_value (bitmap_set_t, tree);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static void bitmap_insert_into_set (bitmap_set_t, tree);
static bitmap_set_t bitmap_set_new (void);
static bool is_undefined_value (tree);
static tree create_expression_by_pieces (basic_block, tree, tree);
static tree find_or_generate_expression (basic_block, tree, tree);
/* We can add and remove elements and entries to and from sets
and hash tables, so we use alloc pools for them. */
static alloc_pool bitmap_set_pool;
static alloc_pool binary_node_pool;
static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
static alloc_pool comparison_node_pool;
static alloc_pool expression_node_pool;
static alloc_pool list_node_pool;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static alloc_pool modify_expr_node_pool;
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
static bitmap_obstack grand_bitmap_obstack;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* To avoid adding 300 temporary variables when we only need one, we
only create one temporary variable, on demand, and build ssa names
off that. We do have to change the variable if the types don't
match the current variable's type. */
static tree pretemp;
static tree storetemp;
static tree mergephitemp;
static tree prephitemp;
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
/* Set of blocks with statements that have had its EH information
cleaned up. */
static bitmap need_eh_cleanup;
/* The phi_translate_table caches phi translations for a given
expression and predecessor. */
static htab_t phi_translate_table;
/* A three tuple {e, pred, v} used to cache phi translations in the
phi_translate_table. */
typedef struct expr_pred_trans_d
{
/* The expression. */
tree e;
/* The predecessor block along which we translated the expression. */
basic_block pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* vuses associated with the expression. */
VEC (tree, gc) *vuses;
/* The value that resulted from the translation. */
tree v;
/* The hashcode for the expression, pred pair. This is cached for
speed reasons. */
hashval_t hashcode;
} *expr_pred_trans_t;
/* Return the hash value for a phi translation table entry. */
static hashval_t
expr_pred_trans_hash (const void *p)
{
const expr_pred_trans_t ve = (expr_pred_trans_t) p;
return ve->hashcode;
}
/* Return true if two phi translation table entries are the same.
P1 and P2 should point to the expr_pred_trans_t's to be compared.*/
static int
expr_pred_trans_eq (const void *p1, const void *p2)
{
const expr_pred_trans_t ve1 = (expr_pred_trans_t) p1;
const expr_pred_trans_t ve2 = (expr_pred_trans_t) p2;
basic_block b1 = ve1->pred;
basic_block b2 = ve2->pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
int i;
tree vuse1;
2006-07-04 23:23:03 +02:00
/* If they are not translations for the same basic block, they can't
be equal. */
if (b1 != b2)
return false;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* If they are for the same basic block, determine if the
2006-07-04 23:23:03 +02:00
expressions are equal. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!expressions_equal_p (ve1->e, ve2->e))
return false;
/* Make sure the vuses are equivalent. */
if (ve1->vuses == ve2->vuses)
return true;
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (VEC_length (tree, ve1->vuses) != VEC_length (tree, ve2->vuses))
return false;
for (i = 0; VEC_iterate (tree, ve1->vuses, i, vuse1); i++)
{
if (VEC_index (tree, ve2->vuses, i) != vuse1)
return false;
}
return true;
}
/* Search in the phi translation table for the translation of
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
expression E in basic block PRED with vuses VUSES.
Return the translated value, if found, NULL otherwise. */
static inline tree
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_lookup (tree e, basic_block pred, VEC (tree, gc) *vuses)
{
void **slot;
struct expr_pred_trans_d ept;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
ept.e = e;
ept.pred = pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
ept.vuses = vuses;
ept.hashcode = vn_compute (e, (unsigned long) pred);
slot = htab_find_slot_with_hash (phi_translate_table, &ept, ept.hashcode,
NO_INSERT);
if (!slot)
return NULL;
else
return ((expr_pred_trans_t) *slot)->v;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Add the tuple mapping from {expression E, basic block PRED, vuses VUSES} to
value V, to the phi translation table. */
static inline void
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (tree e, tree v, basic_block pred, VEC (tree, gc) *vuses)
{
void **slot;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
expr_pred_trans_t new_pair = XNEW (struct expr_pred_trans_d);
new_pair->e = e;
new_pair->pred = pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
new_pair->vuses = vuses;
new_pair->v = v;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
new_pair->hashcode = vn_compute (e, (unsigned long) pred);
slot = htab_find_slot_with_hash (phi_translate_table, new_pair,
new_pair->hashcode, INSERT);
if (*slot)
free (*slot);
*slot = (void *) new_pair;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return true if V is a value expression that represents itself.
In our world, this is *only* non-value handles. */
static inline bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
constant_expr_p (tree v)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return TREE_CODE (v) != VALUE_HANDLE && is_gimple_min_invariant (v);
/* return TREE_CODE (v) != VALUE_HANDLE; */
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Add expression E to the expression set of value V. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void
add_to_value (tree v, tree e)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Constants have no expression sets. */
if (constant_expr_p (v))
return;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (VALUE_HANDLE_EXPR_SET (v) == NULL)
VALUE_HANDLE_EXPR_SET (v) = bitmap_set_new ();
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_insert_into_set (VALUE_HANDLE_EXPR_SET (v), e);
}
/* Create a new bitmap set and return it. */
2006-07-04 23:23:03 +02:00
static bitmap_set_t
bitmap_set_new (void)
{
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
bitmap_set_t ret = (bitmap_set_t) pool_alloc (bitmap_set_pool);
ret->expressions = BITMAP_ALLOC (&grand_bitmap_obstack);
ret->values = BITMAP_ALLOC (&grand_bitmap_obstack);
return ret;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Remove an expression EXPR from a bitmapped set. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_remove_from_set (bitmap_set_t set, tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree val = get_value_handle (expr);
2006-07-04 23:23:03 +02:00
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (val);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!constant_expr_p (val))
{
bitmap_clear_bit (set->values, VALUE_HANDLE_ID (val));
bitmap_clear_bit (set->expressions, get_expression_id (expr));
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Insert an expression EXPR into a bitmapped set. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_insert_into_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
gcc_assert (val);
if (!constant_expr_p (val))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_bit (set->values, VALUE_HANDLE_ID (val));
bitmap_set_bit (set->expressions, get_or_alloc_expression_id (expr));
}
}
/* Copy a bitmapped set ORIG, into bitmapped set DEST. */
static void
bitmap_set_copy (bitmap_set_t dest, bitmap_set_t orig)
{
bitmap_copy (dest->expressions, orig->expressions);
bitmap_copy (dest->values, orig->values);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Free memory used up by SET. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_free (bitmap_set_t set)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
BITMAP_FREE (set->expressions);
BITMAP_FREE (set->values);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* A comparison function for use in qsort to top sort a bitmap set. Simply
subtracts value handle ids, since they are created in topo-order. */
static int
vh_compare (const void *pa, const void *pb)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
const tree vha = get_value_handle (*((const tree *)pa));
const tree vhb = get_value_handle (*((const tree *)pb));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* This can happen when we constify things. */
if (constant_expr_p (vha))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (vhb))
return -1;
return -1;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
else if (constant_expr_p (vhb))
return 1;
return VALUE_HANDLE_ID (vha) - VALUE_HANDLE_ID (vhb);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Generate an topological-ordered array of bitmap set SET. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static VEC(tree, heap) *
sorted_array_from_bitmap_set (bitmap_set_t set)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int i;
bitmap_iterator bi;
VEC(tree, heap) *result = NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (set, i, bi)
VEC_safe_push (tree, heap, result, expression_for_id (i));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
qsort (VEC_address (tree, result), VEC_length (tree, result),
sizeof (tree), vh_compare);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return result;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Perform bitmapped set operation DEST &= ORIG. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_and (bitmap_set_t dest, bitmap_set_t orig)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_iterator bi;
unsigned int i;
if (dest != orig)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
bitmap_and_into (dest->values, orig->values);
bitmap_copy (temp, dest->expressions);
EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
{
tree expr = expression_for_id (i);
tree val = get_value_handle (expr);
if (!bitmap_bit_p (dest->values, VALUE_HANDLE_ID (val)))
bitmap_clear_bit (dest->expressions, i);
}
BITMAP_FREE (temp);
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Subtract all values and expressions contained in ORIG from DEST. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bitmap_set_t
bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t result = bitmap_set_new ();
bitmap_iterator bi;
unsigned int i;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_and_compl (result->expressions, dest->expressions,
orig->expressions);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (result, i, bi)
{
tree expr = expression_for_id (i);
tree val = get_value_handle (expr);
bitmap_set_bit (result->values, VALUE_HANDLE_ID (val));
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return result;
}
/* Subtract all the values in bitmap set B from bitmap set A. */
static void
bitmap_set_subtract_values (bitmap_set_t a, bitmap_set_t b)
{
unsigned int i;
bitmap_iterator bi;
bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
bitmap_copy (temp, a->expressions);
EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
{
tree expr = expression_for_id (i);
if (bitmap_set_contains_value (b, get_value_handle (expr)))
bitmap_remove_from_set (a, expr);
}
BITMAP_FREE (temp);
}
/* Return true if bitmapped set SET contains the value VAL. */
static bool
bitmap_set_contains_value (bitmap_set_t set, tree val)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return true;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!set || bitmap_empty_p (set->expressions))
return false;
return bitmap_bit_p (set->values, VALUE_HANDLE_ID (val));
}
static inline bool
bitmap_set_contains_expr (bitmap_set_t set, tree expr)
{
return bitmap_bit_p (set->expressions, get_expression_id (expr));
}
/* Replace an instance of value LOOKFOR with expression EXPR in SET. */
static void
bitmap_set_replace_value (bitmap_set_t set, tree lookfor, tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset;
unsigned int i;
bitmap_iterator bi;
if (constant_expr_p (lookfor))
return;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!bitmap_set_contains_value (set, lookfor))
return;
/* The number of expressions having a given value is usually
significantly less than the total number of expressions in SET.
Thus, rather than check, for each expression in SET, whether it
has the value LOOKFOR, we walk the reverse mapping that tells us
what expressions have a given value, and see if any of those
expressions are in our set. For large testcases, this is about
5-10x faster than walking the bitmap. If this is somehow a
significant lose for some cases, we can choose which set to walk
based on the set size. */
exprset = VALUE_HANDLE_EXPR_SET (lookfor);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (exprset, i, bi)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_bit_p (set->expressions, i))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_clear_bit (set->expressions, i);
bitmap_set_bit (set->expressions, get_expression_id (expr));
return;
}
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return true if two bitmap sets are equal. */
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_equal (bitmap_set_t a, bitmap_set_t b)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return bitmap_equal_p (a->values, b->values);
}
/* Replace an instance of EXPR's VALUE with EXPR in SET if it exists,
and add it otherwise. */
static void
bitmap_value_replace_in_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_set_contains_value (set, val))
bitmap_set_replace_value (set, val, expr);
else
bitmap_insert_into_set (set, expr);
}
/* Insert EXPR into SET if EXPR's value is not already present in
SET. */
static void
bitmap_value_insert_into_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return;
2006-07-04 23:23:03 +02:00
if (!bitmap_set_contains_value (set, val))
bitmap_insert_into_set (set, expr);
}
/* Print out SET to OUTFILE. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (FILE *outfile, bitmap_set_t set,
const char *setname, int blockindex)
{
fprintf (outfile, "%s[%d] := { ", setname, blockindex);
if (set)
{
bool first = true;
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (set, i, bi)
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (i);
if (!first)
fprintf (outfile, ", ");
first = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (outfile, expr, 0);
2006-07-04 23:23:03 +02:00
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
fprintf (outfile, " (");
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (outfile, get_value_handle (expr), 0);
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
fprintf (outfile, ") ");
}
}
fprintf (outfile, " }\n");
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void debug_bitmap_set (bitmap_set_t);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void
debug_bitmap_set (bitmap_set_t set)
{
print_bitmap_set (stderr, set, "debug", 0);
}
/* Print out the expressions that have VAL to OUTFILE. */
void
print_value_expressions (FILE *outfile, tree val)
{
if (VALUE_HANDLE_EXPR_SET (val))
{
char s[10];
sprintf (s, "VH.%04d", VALUE_HANDLE_ID (val));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (outfile, VALUE_HANDLE_EXPR_SET (val), s, 0);
}
}
void
debug_value_expressions (tree val)
{
print_value_expressions (stderr, val);
}
/* Return the folded version of T if T, when folded, is a gimple
2006-07-04 23:23:03 +02:00
min_invariant. Otherwise, return T. */
static tree
fully_constant_expression (tree t)
2006-07-04 23:23:03 +02:00
{
tree folded;
folded = fold (t);
if (folded && is_gimple_min_invariant (folded))
return folded;
return t;
}
/* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
2006-07-04 23:23:03 +02:00
For example, this can copy a list made of TREE_LIST nodes.
Allocates the nodes in list_node_pool*/
static tree
pool_copy_list (tree list)
{
tree head;
tree prev, next;
if (list == 0)
return 0;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
head = (tree) pool_alloc (list_node_pool);
2006-07-04 23:23:03 +02:00
memcpy (head, list, tree_size (list));
prev = head;
2006-07-04 23:23:03 +02:00
next = TREE_CHAIN (list);
while (next)
{
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
TREE_CHAIN (prev) = (tree) pool_alloc (list_node_pool);
memcpy (TREE_CHAIN (prev), next, tree_size (next));
prev = TREE_CHAIN (prev);
next = TREE_CHAIN (next);
}
return head;
}
/* Translate the vuses in the VUSES vector backwards through phi nodes
in PHIBLOCK, so that they have the value they would have in
BLOCK. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static VEC(tree, gc) *
translate_vuses_through_block (VEC (tree, gc) *vuses,
basic_block phiblock,
basic_block block)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree oldvuse;
VEC(tree, gc) *result = NULL;
int i;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
for (i = 0; VEC_iterate (tree, vuses, i, oldvuse); i++)
{
tree phi = SSA_NAME_DEF_STMT (oldvuse);
if (TREE_CODE (phi) == PHI_NODE
&& bb_for_stmt (phi) == phiblock)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
edge e = find_edge (block, bb_for_stmt (phi));
if (e)
{
tree def = PHI_ARG_DEF (phi, e->dest_idx);
if (def != oldvuse)
{
if (!result)
result = VEC_copy (tree, gc, vuses);
VEC_replace (tree, result, i, def);
}
}
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* We avoid creating a new copy of the vuses unless something
actually changed, so result can be NULL. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (result)
{
sort_vuses (result);
return result;
}
return vuses;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Like find_leader, but checks for the value existing in SET1 *or*
SET2. This is used to avoid making a set consisting of the union
of PA_IN and ANTIC_IN during insert. */
static inline tree
find_leader_in_sets (tree expr, bitmap_set_t set1, bitmap_set_t set2)
{
tree result;
result = bitmap_find_leader (set1, expr);
if (!result && set2)
result = bitmap_find_leader (set2, expr);
return result;
}
/* Translate EXPR using phis in PHIBLOCK, so that it has the values of
the phis in PRED. Return NULL if we can't find a leader for each
part of the translated expression. */
static tree
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_translate (tree expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock)
{
tree phitrans = NULL;
tree oldexpr = expr;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (expr == NULL)
return NULL;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
if (is_gimple_min_invariant (expr))
return expr;
/* Phi translations of a given expression don't change. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (EXPR_P (expr))
{
tree vh;
vh = get_value_handle (expr);
if (vh && TREE_CODE (vh) == VALUE_HANDLE)
phitrans = phi_trans_lookup (expr, pred, VALUE_HANDLE_VUSES (vh));
else
phitrans = phi_trans_lookup (expr, pred, NULL);
}
else
phitrans = phi_trans_lookup (expr, pred, NULL);
if (phitrans)
return phitrans;
2006-07-04 23:23:03 +02:00
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
tree oldop0 = TREE_OPERAND (expr, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval0 = oldop0;
tree oldarglist = TREE_OPERAND (expr, 1);
tree oldop2 = TREE_OPERAND (expr, 2);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval2 = oldop2;
tree newop0;
tree newarglist;
tree newop2 = NULL;
tree oldwalker;
tree newwalker;
tree newexpr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree vh = get_value_handle (expr);
bool listchanged = false;
bool invariantarg = false;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
/* Call expressions are kind of weird because they have an
argument list. We don't want to value number the list
as one value number, because that doesn't make much
sense, and just breaks the support functions we call,
which expect TREE_OPERAND (call_expr, 2) to be a
2006-07-04 23:23:03 +02:00
TREE_LIST. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldval0 = find_leader_in_sets (oldop0, set1, set2);
newop0 = phi_translate (oldval0, set1, set2, pred, phiblock);
if (newop0 == NULL)
return NULL;
if (oldop2)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = find_leader_in_sets (oldop2, set1, set2);
newop2 = phi_translate (oldop2, set1, set2, pred, phiblock);
if (newop2 == NULL)
return NULL;
}
/* phi translate the argument list piece by piece.
2006-07-04 23:23:03 +02:00
We could actually build the list piece by piece here,
but it's likely to not be worth the memory we will save,
unless you have millions of call arguments. */
newarglist = pool_copy_list (oldarglist);
for (oldwalker = oldarglist, newwalker = newarglist;
oldwalker && newwalker;
2006-07-04 23:23:03 +02:00
oldwalker = TREE_CHAIN (oldwalker),
newwalker = TREE_CHAIN (newwalker))
{
2006-07-04 23:23:03 +02:00
tree oldval = TREE_VALUE (oldwalker);
tree newval;
if (oldval)
{
/* This may seem like a weird place for this
check, but it's actually the easiest place to
do it. We can't do it lower on in the
recursion because it's valid for pieces of a
component ref to be of AGGREGATE_TYPE, as long
as the outermost one is not.
To avoid *that* case, we have a check for
AGGREGATE_TYPE_P in insert_aux. However, that
check will *not* catch this case because here
it occurs in the argument list. */
if (AGGREGATE_TYPE_P (TREE_TYPE (oldval)))
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldval = find_leader_in_sets (oldval, set1, set2);
newval = phi_translate (oldval, set1, set2, pred,
phiblock);
if (newval == NULL)
return NULL;
if (newval != oldval)
{
listchanged = true;
invariantarg |= is_gimple_min_invariant (newval);
TREE_VALUE (newwalker) = get_value_handle (newval);
}
}
}
/* In case of new invariant args we might try to fold the call
again. */
if (invariantarg)
{
tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr),
newop0, newarglist, newop2);
if (tmp)
{
STRIP_TYPE_NOPS (tmp);
if (is_gimple_min_invariant (tmp))
return tmp;
}
}
if (listchanged)
vn_lookup_or_add (newarglist, NULL);
2006-07-04 23:23:03 +02:00
tvuses = translate_vuses_through_block (vuses, phiblock, pred);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (listchanged || (newop0 != oldop0) || (oldop2 != newop2)
|| vuses != tvuses)
{
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
newexpr = (tree) pool_alloc (expression_node_pool);
memcpy (newexpr, expr, tree_size (expr));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
TREE_OPERAND (newexpr, 0) = newop0 == oldop0 ? oldval0 : get_value_handle (newop0);
TREE_OPERAND (newexpr, 1) = listchanged ? newarglist : oldarglist;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
TREE_OPERAND (newexpr, 2) = newop2 == oldop2 ? oldval2 : get_value_handle (newop2);
newexpr->common.ann = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_lookup_or_add_with_vuses (newexpr, tvuses);
expr = newexpr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (oldexpr, newexpr, pred, tvuses);
}
}
}
return expr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
case tcc_declaration:
{
VEC (tree, gc) * oldvuses = NULL;
VEC (tree, gc) * newvuses = NULL;
oldvuses = VALUE_HANDLE_VUSES (get_value_handle (expr));
if (oldvuses)
newvuses = translate_vuses_through_block (oldvuses, phiblock,
pred);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (oldvuses != newvuses)
vn_lookup_or_add_with_vuses (expr, newvuses);
phi_trans_add (oldexpr, expr, pred, newvuses);
}
return expr;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_reference:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree oldop0 = TREE_OPERAND (expr, 0);
tree oldop1 = NULL;
tree newop0;
tree newop1 = NULL;
tree oldop2 = NULL;
tree newop2 = NULL;
tree oldop3 = NULL;
tree newop3 = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree newexpr;
VEC (tree, gc) * oldvuses = NULL;
VEC (tree, gc) * newvuses = NULL;
if (TREE_CODE (expr) != INDIRECT_REF
&& TREE_CODE (expr) != COMPONENT_REF
&& TREE_CODE (expr) != ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop0 = find_leader_in_sets (oldop0, set1, set2);
newop0 = phi_translate (oldop0, set1, set2, pred, phiblock);
if (newop0 == NULL)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return NULL;
2006-07-04 23:23:03 +02:00
if (TREE_CODE (expr) == ARRAY_REF)
{
oldop1 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
newop1 = phi_translate (oldop1, set1, set2, pred, phiblock);
2006-07-04 23:23:03 +02:00
if (newop1 == NULL)
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = TREE_OPERAND (expr, 2);
if (oldop2)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = find_leader_in_sets (oldop2, set1, set2);
newop2 = phi_translate (oldop2, set1, set2, pred, phiblock);
2006-07-04 23:23:03 +02:00
if (newop2 == NULL)
return NULL;
}
oldop3 = TREE_OPERAND (expr, 3);
if (oldop3)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop3 = find_leader_in_sets (oldop3, set1, set2);
newop3 = phi_translate (oldop3, set1, set2, pred, phiblock);
2006-07-04 23:23:03 +02:00
if (newop3 == NULL)
return NULL;
}
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
oldvuses = VALUE_HANDLE_VUSES (get_value_handle (expr));
if (oldvuses)
newvuses = translate_vuses_through_block (oldvuses, phiblock,
pred);
2006-07-04 23:23:03 +02:00
if (newop0 != oldop0 || newvuses != oldvuses
2006-07-04 23:23:03 +02:00
|| newop1 != oldop1
|| newop2 != oldop2
|| newop3 != oldop3)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree t;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
newexpr = (tree) pool_alloc (reference_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (newexpr, expr, tree_size (expr));
TREE_OPERAND (newexpr, 0) = get_value_handle (newop0);
if (TREE_CODE (expr) == ARRAY_REF)
{
TREE_OPERAND (newexpr, 1) = get_value_handle (newop1);
if (newop2)
TREE_OPERAND (newexpr, 2) = get_value_handle (newop2);
if (newop3)
TREE_OPERAND (newexpr, 3) = get_value_handle (newop3);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (reference_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->common.ann = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_lookup_or_add_with_vuses (newexpr, newvuses);
}
expr = newexpr;
phi_trans_add (oldexpr, newexpr, pred, newvuses);
}
}
return expr;
break;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval1 = oldop1;
tree oldop2 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval2 = oldop2;
tree newop1;
tree newop2;
tree newexpr;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
newop1 = phi_translate (oldop1, set1, set2, pred, phiblock);
if (newop1 == NULL)
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = find_leader_in_sets (oldop2, set1, set2);
newop2 = phi_translate (oldop2, set1, set2, pred, phiblock);
if (newop2 == NULL)
return NULL;
if (newop1 != oldop1 || newop2 != oldop2)
{
tree t;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
newexpr = (tree) pool_alloc (binary_node_pool);
memcpy (newexpr, expr, tree_size (expr));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
TREE_OPERAND (newexpr, 0) = newop1 == oldop1 ? oldval1 : get_value_handle (newop1);
TREE_OPERAND (newexpr, 1) = newop2 == oldop2 ? oldval2 : get_value_handle (newop2);
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (binary_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->common.ann = NULL;
vn_lookup_or_add (newexpr, NULL);
}
expr = newexpr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (oldexpr, newexpr, pred, NULL);
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
case tcc_unary:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree newop1;
tree newexpr;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
newop1 = phi_translate (oldop1, set1, set2, pred, phiblock);
if (newop1 == NULL)
return NULL;
if (newop1 != oldop1)
{
tree t;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
newexpr = (tree) pool_alloc (unary_node_pool);
memcpy (newexpr, expr, tree_size (expr));
TREE_OPERAND (newexpr, 0) = get_value_handle (newop1);
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (unary_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->common.ann = NULL;
vn_lookup_or_add (newexpr, NULL);
}
expr = newexpr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (oldexpr, newexpr, pred, NULL);
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
case tcc_exceptional:
{
tree phi = NULL;
edge e;
tree def_stmt;
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (TREE_CODE (expr) == SSA_NAME);
def_stmt = SSA_NAME_DEF_STMT (expr);
if (TREE_CODE (def_stmt) == PHI_NODE
&& bb_for_stmt (def_stmt) == phiblock)
phi = def_stmt;
else
return expr;
2006-07-04 23:23:03 +02:00
e = find_edge (pred, bb_for_stmt (phi));
if (e)
{
if (is_undefined_value (PHI_ARG_DEF (phi, e->dest_idx)))
return NULL;
vn_lookup_or_add (PHI_ARG_DEF (phi, e->dest_idx), NULL);
return PHI_ARG_DEF (phi, e->dest_idx);
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
default:
gcc_unreachable ();
}
}
/* For each expression in SET, translate the value handles through phi nodes
in PHIBLOCK using edge PHIBLOCK->PRED, and store the resulting
expressions in DEST. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
basic_block phiblock)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC (tree, heap) *exprs;
tree expr;
int i;
if (!phi_nodes (phiblock))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_copy (dest, set);
return;
}
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
exprs = sorted_array_from_bitmap_set (set);
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
tree translated;
translated = phi_translate (expr, set, NULL, pred, phiblock);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Don't add constants or empty translations to the cache, since
we won't look them up that way, or use the result, anyway. */
if (translated && !is_gimple_min_invariant (translated))
{
tree vh = get_value_handle (translated);
VEC (tree, gc) *vuses;
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* The value handle itself may also be an invariant, in
which case, it has no vuses. */
vuses = !is_gimple_min_invariant (vh)
? VALUE_HANDLE_VUSES (vh) : NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_trans_add (expr, translated, pred, vuses);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
if (translated != NULL)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (dest, translated);
2006-07-04 23:23:03 +02:00
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC_free (tree, heap, exprs);
}
/* Find the leader for a value (i.e., the name representing that
value) in a given set, and return it. Return NULL if no leader is
found. */
static tree
bitmap_find_leader (bitmap_set_t set, tree val)
{
if (val == NULL)
return NULL;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return val;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_set_contains_value (set, val))
{
/* Rather than walk the entire bitmap of expressions, and see
whether any of them has the value we are looking for, we look
at the reverse mapping, which tells us the set of expressions
that have a given value (IE value->expressions with that
value) and see if any of those expressions are in our set.
The number of expressions per value is usually significantly
less than the number of expressions in the set. In fact, for
large testcases, doing it this way is roughly 5-10x faster
than walking the bitmap.
If this is somehow a significant lose for some cases, we can
2006-07-04 23:23:03 +02:00
choose which set to walk based on which set is smaller. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int i;
bitmap_iterator bi;
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (val);
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
EXECUTE_IF_AND_IN_BITMAP (exprset->expressions,
set->expressions, 0, i, bi)
return expression_for_id (i);
}
return NULL;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Given the vuse representative map, MAP, and an SSA version number,
ID, return the bitmap of names ID represents, or NULL, if none
exists. */
static bitmap
get_representative (bitmap *map, int id)
{
if (map[id] != NULL)
return map[id];
return NULL;
}
/* A vuse is anticipable at the top of block x, from the bottom of the
block, if it reaches the top of the block, and is not killed in the
block. In effect, we are trying to see if the vuse is transparent
backwards in the block. */
static bool
vuses_dies_in_block_x (VEC (tree, gc) *vuses, basic_block block)
{
int i;
tree vuse;
for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
{
/* Any places where this is too conservative, are places
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
where we created a new version and shouldn't have. */
if (!bitmap_bit_p (RVUSE_IN (block), SSA_NAME_VERSION (vuse))
|| bitmap_bit_p (RVUSE_KILL (block), SSA_NAME_VERSION (vuse)))
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return true;
}
return false;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Determine if the expression EXPR is valid in SET1 U SET2.
ONLY SET2 CAN BE NULL.
This means that we have a leader for each part of the expression
(if it consists of values), or the expression is an SSA_NAME.
NB: We never should run into a case where we have SSA_NAME +
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
SSA_NAME or SSA_NAME + value. The sets valid_in_sets is called on,
the ANTIC sets, will only ever have SSA_NAME's or value expressions
(IE VALUE1 + VALUE2, *VALUE1, VALUE1 < VALUE2) */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
#define union_contains_value(SET1, SET2, VAL) \
(bitmap_set_contains_value ((SET1), (VAL)) \
|| ((SET2) && bitmap_set_contains_value ((SET2), (VAL))))
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, tree expr,
basic_block block)
{
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree vh = get_value_handle (expr);
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return union_contains_value (set1, set2, op1)
&& union_contains_value (set1, set2, op2);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_unary:
{
tree op1 = TREE_OPERAND (expr, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return union_contains_value (set1, set2, op1);
}
2006-07-04 23:23:03 +02:00
case tcc_expression:
{
if (TREE_CODE (expr) == CALL_EXPR)
{
tree op0 = TREE_OPERAND (expr, 0);
tree arglist = TREE_OPERAND (expr, 1);
tree op2 = TREE_OPERAND (expr, 2);
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
/* Check the non-list operands first. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!union_contains_value (set1, set2, op0)
|| (op2 && !union_contains_value (set1, set2, op2)))
return false;
/* Now check the operands. */
for (; arglist; arglist = TREE_CHAIN (arglist))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree arg = TREE_VALUE (arglist);
if (!union_contains_value (set1, set2, arg))
return false;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return !vuses_dies_in_block_x (VALUE_HANDLE_VUSES (vh), block);
}
return false;
}
2006-07-04 23:23:03 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_reference:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
2006-07-04 23:23:03 +02:00
if (TREE_CODE (expr) == INDIRECT_REF
|| TREE_CODE (expr) == COMPONENT_REF
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (expr) == ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree op0 = TREE_OPERAND (expr, 0);
gcc_assert (is_gimple_min_invariant (op0)
|| TREE_CODE (op0) == VALUE_HANDLE);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!union_contains_value (set1, set2, op0))
return false;
if (TREE_CODE (expr) == ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree op1 = TREE_OPERAND (expr, 1);
tree op2 = TREE_OPERAND (expr, 2);
tree op3 = TREE_OPERAND (expr, 3);
gcc_assert (is_gimple_min_invariant (op1)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op1) == VALUE_HANDLE);
if (!union_contains_value (set1, set2, op1))
return false;
gcc_assert (!op2 || is_gimple_min_invariant (op2)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op2) == VALUE_HANDLE);
if (op2
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& !union_contains_value (set1, set2, op2))
return false;
gcc_assert (!op3 || is_gimple_min_invariant (op3)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op3) == VALUE_HANDLE);
if (op3
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& !union_contains_value (set1, set2, op3))
return false;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return bitmap_set_contains_value (ANTIC_SAFE_LOADS (block),
vh)
|| !vuses_dies_in_block_x (VALUE_HANDLE_VUSES (vh),
block);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return false;
case tcc_exceptional:
{
gcc_assert (TREE_CODE (expr) == SSA_NAME);
return bitmap_set_contains_expr (AVAIL_OUT (block), expr);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_declaration:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return !vuses_dies_in_block_x (VALUE_HANDLE_VUSES (vh), block);
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
default:
/* No other cases should be encountered. */
2006-07-04 23:23:03 +02:00
gcc_unreachable ();
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
}
}
/* Clean the set of expressions that are no longer valid in SET1 or
SET2. This means expressions that are made up of values we have no
leaders for in SET1 or SET2. This version is used for partial
anticipation, which means it is not valid in either ANTIC_IN or
PA_IN. */
static void
dependent_clean (bitmap_set_t set1, bitmap_set_t set2, basic_block block)
{
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (set1);
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (!valid_in_sets (set1, set2, expr, block))
bitmap_remove_from_set (set1, expr);
}
VEC_free (tree, heap, exprs);
}
/* Clean the set of expressions that are no longer valid in SET. This
means expressions that are made up of values we have no leaders for
in SET. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
clean (bitmap_set_t set, basic_block block)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (set);
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!valid_in_sets (set, NULL, expr, block))
bitmap_remove_from_set (set, expr);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC_free (tree, heap, exprs);
}
static sbitmap has_abnormal_preds;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* List of blocks that may have changed during ANTIC computation and
thus need to be iterated over. */
static sbitmap changed_blocks;
/* Compute the ANTIC set for BLOCK.
If succs(BLOCK) > 1 then
ANTIC_OUT[BLOCK] = intersection of ANTIC_IN[b] for all succ(BLOCK)
else if succs(BLOCK) == 1 then
ANTIC_OUT[BLOCK] = phi_translate (ANTIC_IN[succ(BLOCK)])
ANTIC_IN[BLOCK] = clean(ANTIC_OUT[BLOCK] U EXP_GEN[BLOCK] - TMP_GEN[BLOCK])
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
*/
static bool
compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
{
bool changed = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t S, old, ANTIC_OUT;
bitmap_iterator bi;
unsigned int bii;
edge e;
edge_iterator ei;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
old = ANTIC_OUT = S = NULL;
BB_VISITED (block) = 1;
/* If any edges from predecessors are abnormal, antic_in is empty,
so do nothing. */
if (block_has_abnormal_pred_edge)
goto maybe_dump_sets;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
old = ANTIC_IN (block);
ANTIC_OUT = bitmap_set_new ();
/* If the block has no successors, ANTIC_OUT is empty. */
if (EDGE_COUNT (block->succs) == 0)
;
/* If we have one successor, we could have some phi nodes to
translate through. */
basic-block.h (single_succ_p, [...]): New inline functions. * basic-block.h (single_succ_p, single_pred_p, single_succ_edge, single_pred_edge, single_succ, single_pred): New inline functions. * bb-reorder.c (rotate_loop, find_traces_1_round, add_labels_and_missing_jumps, fix_up_fall_thru_edges, duplicate_computed_gotos): Use the single_succ/pred functions. * cfganal.c (forwarder_block_p): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * cfgcleanup.c (try_simplify_condjump, try_forward_edges, outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg, merge_seq_blocks): Ditto. * cfghooks.c (split_edge, tidy_fallthru_edges): Ditto. * cfglayout.c (fixup_reorder_chain): Ditto. * cfgloop.c (mark_single_exit_loops, update_latch_info, canonicalize_loop_headers, verify_loop_structure): Ditto. * cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge, mfb_update_loops, create_preheader, force_single_succ_latches, create_loop_notes): Ditto. * cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump, force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge, commit_one_edge_insertion, purge_dead_edges, cfg_layout_can_merge_blocks_p): Ditto. * except.c (sjlj_emit_function_enter): Ditto. * flow.c (init_propagate_block_info): Ditto. * function.c (thread_prologue_and_epilogue_insns): Ditto. * gcse.c (find_implicit_sets, bypass_conditional_jumps, insert_insn_end_bb): Ditto. * ifcvt.c (merge_if_block, find_if_block, find_if_case_1, find_if_case_2): Ditto. * lambda-code.c (perfect_nestify): Ditto. * lcm.c (optimize_mode_switching): Ditto. * loop-doloop.c (doloop_modify): Ditto. * loop-init.c (loop_optimizer_init): Ditto. * loop-iv.c (simplify_using_initial_values): Ditto. * loop-unroll.c (unroll_loop_runtime_iterations): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * modulo-sched.c (generate_prolog_epilog): Ditto. * predict.c (combine_predictions_for_insn, estimate_probability, tree_estimate_probability, last_basic_block_p, estimate_bb_frequencies): Ditto. * profile.c (branch_prob): Ditto. * regrename.c (copyprop_hardreg_forward): Ditto. * sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto. * tracer.c (layout_superblocks): Ditto. * tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks, cfg_remove_useless_stmts_bb, cleanup_control_flow, cleanup_control_expr_graph, disband_implicit_edges, tree_find_edge_insert_loc, bsi_commit_edge_inserts, tree_verify_flow_info, tree_make_forwarder_block, tree_forwarder_block_p, remove_forwarder_block, remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. * tree-if-conv.c (tree_if_conversion): Ditto. * tree-mudflap.c (mf_build_check_statement_for): Ditto. * tree-ssa-dce.c (remove_dead_stmt): Ditto. * tree-ssa-dom.c (dom_opt_finalize_block): Ditto. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, copy_loop_headers): Ditto. * tree-ssa-loop-im.c (loop_commit_inserts): Ditto. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto. * tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos, lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto. * tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto. * tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto. * tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto. * tree-ssa-threadupdate.c (redirect_edges): Ditto. * tree-tailcall.c (independent_of_stmt_p, find_tail_calls, eliminate_tail_call, tree_optimize_tail_calls_1): Ditto. * tree-vect-analyze.c (vect_analyze_loop_form): Ditto. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard, slpeel_add_loop_guard): Ditto. From-SVN: r96292
2005-03-11 10:05:12 +01:00
else if (single_succ_p (block))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
basic_block succ_bb = single_succ (block);
/* We trade iterations of the dataflow equations for having to
phi translate the maximal set, which is incredibly slow
(since the maximal set often has 300+ members, even when you
have a small number of blocks).
Basically, we defer the computation of ANTIC for this block
until we have processed it's successor, which will inveitably
have a *much* smaller set of values to phi translate once
clean has been run on it.
The cost of doing this is that we technically perform more
iterations, however, they are lower cost iterations.
Timings for PRE on tramp3d-v4:
without maximal set fix: 11 seconds
with maximal set fix/without deferring: 26 seconds
with maximal set fix/with deferring: 11 seconds
*/
if (!BB_VISITED (succ_bb))
{
changed = true;
SET_BIT (changed_blocks, block->index);
BB_VISITED (block) = 0;
BB_DEFERRED (block) = 1;
goto maybe_dump_sets;
}
else
phi_translate_set (ANTIC_OUT, ANTIC_IN (succ_bb),
block, succ_bb);
}
/* If we have multiple successors, we take the intersection of all of
them. */
else
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC(basic_block, heap) * worklist;
size_t i;
basic_block bprime, first;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
worklist = VEC_alloc (basic_block, heap, EDGE_COUNT (block->succs));
backport: basic-block.h: Include vec.h, errors.h. 2004-09-24 Ben Elliston <bje@au.ibm.com> Steven Bosscher <stevenb@suse.de> Andrew Pinski <pinskia@physics.uc.edu> Merge from edge-vector-branch: * basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge). (struct edge_def): Remove pred_next, succ_next members. (struct basic_block_def): Remove pred, succ members. Add preds and succs members of type VEC(edge). (FALLTHRU_EDGE): Redefine using EDGE_SUCC. (BRANCH_EDGE): Likewise. (EDGE_CRITICAL_P): Redefine using EDGE_COUNT. (EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New. (edge_iterator): New. (ei_start, ei_last, ei_end_p, ei_one_before_end_p): New. (ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise. (FOR_EACH_EDGE): New. * bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros where applicable. (rotate_loop): Likewise. (find_traces_1_route): Likewise. (bb_to_key): Likewise. (connect_traces): Likewise. (copy_bb_p): Likewise. (find_rarely_executed_basic_blocks_and_crossing_edges): Likewise. (add_labels_and_missing_jumps): Likewise. (fix_up_fall_thru_edges): Likewise. (find_jump_block): Likewise. (fix_crossing_conditional_branches): Likewise. (fix_crossing_unconditional_branches): Likewise. (add_reg_crossing_jump_notes): Likewise. * bt-load.c (augment_live_range): Likewise. * cfg.c (clear_edges): Likewise. (unchecked_make_edge): Likewise. (cached_make_edge): Likewise. (make_single_succ_edge): Likewise. (remove_edge): Likewise. (redirect_edge_succ_nodup): Likewise. (check_bb_profile): Likewise. (dump_flow_info): Likewise. (alloc_aux_for_edges): Likewise. (clear_aux_for_edges): Likewise. (dump_cfg_bb_info): Likewise. * cfganal.c (forwarder_block_p): Likewise. (can_fallthru): Likewise. (could_fall_through): Likewise. (mark_dfs_back_edges): Likewise. (set_edge_can_fallthru_flag): Likewise. (find_unreachable_blocks): Likewise. (create_edge_list): Likewise. (verify_edge_list): Likewise. (add_noreturn_fake_exit_edges): Likewise. (connect_infinite_loops_to_exit): Likewise. (flow_reverse_top_sort_order_compute): Likewise. (flow_depth_first_order_compute): Likewise. (flow_preorder_transversal_compute): Likewise. (flow_dfs_compute_reverse_execute): Likewise. (dfs_enumerate_from): Likewise. (compute_dominance_frontiers_1): Likewise. * cfgbuild.c (make_edges): Likewise. (compute_outgoing_frequencies): Likewise. (find_many_sub_basic_blocks): Likewise. (find_sub_basic_blocks): Likewise. * cfgcleanup.c (try_simplify_condjump): Likewise. (thread_jump): Likewise. (try_forward_edges): Likewise. (merge_blocks_move): Likewise. (outgoing_edges_match): Likewise. (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. (try_optimize_cfg): Likewise. (merge_seq_blocks): Likewise. * cfgexpand.c (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Likewise. (construct_init_block): Likewise. (construct_exit_block): Likewise. * cfghooks.c (verify_flow_info): Likewise. (dump_bb): Likewise. (delete_basic_block): Likewise. (split_edge): Likewise. (merge_blocks): Likewise. (make_forwarder_block): Likewise. (tidy_fallthru_edges): Likewise. (can_duplicate_block_p): Likewise. (duplicate_block): Likewise. * cfglayout.c (fixup_reorder_chain): Likewise. (fixup_fallthru_exit_predecessor): Likewise. (can_copy_bbs_p): Likewise. (copy_bbs): Likewise. * cfgloop.c (flow_loops_cfg_dump): Likewise. (flow_loop_entry_edges_find): Likewise. (flow_loop_exit_edges_find): Likewise. (flow_loop_nodes_find): Likewise. (mark_single_exit_loops): Likewise. (flow_loop_pre_header_scan): Likewise. (flow_loop_pre_header_find): Likewise. (update_latch_info): Likewise. (canonicalize_loop_headers): Likewise. (flow_loops_find): Likewise. (get_loop_body_in_bfs_order): Likewise. (get_loop_exit_edges): Likewise. (num_loop_branches): Likewise. (verify_loop_structure): Likewise. (loop_latch_edge): Likewise. (loop_preheader_edge): Likewise. * cfgloopanal.c (mark_irreducible_loops): Likewise. (expected_loop_iterations): Likewise. * cfgloopmanip.c (remove_bbs): Likewise. (fix_bb_placement): Likewise. (fix_irreducible_loops): Likewise. (remove_path): Likewise. (scale_bbs_frequencies): Likewise. (loopify): Likewise. (unloop): Likewise. (fix_loop_placement): Likewise. (loop_delete_branch_edge): Likewise. (duplicate_loop_to_header_edge): Likewise. (mfb_keep_just): Likewise. (create_preheader): Likewise. (force_single_succ_latches): Likewise. (loop_split_edge_with): Likewise. (create_loop_notes): Likewise. * cfgrtl.c (rtl_split_block): Likewise. (rtl_merge_blocks): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (force_nonfallthru_and_redirect): Likewise. (rtl_tidy_fallthru_edge): Likewise. (commit_one_edge_insertion): Likewise. (commit_edge_insertions): Likewise. (commit_edge_insertions_watch_calls): Likewise. (rtl_verify_flow_info_1): Likewise. (rtl_verify_flow_info): Likewise. (purge_dead_edges): Likewise. (cfg_layout_redirect_edge_and_branch): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. (rtl_flow_call_edges_add): Likewise. * cse.c (cse_cc_succs): Likewise. * df.c (hybrid_search): Likewise. * dominance.c (calc_dfs_tree_nonrec): Likewise. (calc_dfs_tree): Likewise. (calc_idoms): Likewise. (recount_dominator): Likewise. * domwalk.c (walk_dominator_tree): Likewise. * except.c (emit_to_new_bb_before): Likewise. (connect_post_landing_pads): Likewise. (sjlj_emit_function_enter): Likewise. (sjlj_emit_function_exit): Likewise. (finish_eh_generation): Likewise. * final.c (compute_alignments): Likewise. * flow.c (calculate_global_regs_live): Likewise. (initialize_uninitialized_subregs): Likewise. (init_propagate_block_info): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. * gcse.c (find_implicit_sets): Likewise. (bypass_block): Likewise. (bypass_conditional_jumps): Likewise. (compute_pre_data): Likewise. (insert_insn_end_bb): Likewise. (insert_store): Likewise. (remove_reachable_equiv_notes): Likewise. * global.c (global_conflicts): Likewise. (calculate_reg_pav): Likewise. * graph.c (print_rtl_graph_with_bb): Likewise. * ifcvt.c (mark_loop_exit_edges): Likewise. (merge_if_block): Likewise. (find_if_header): Likewise. (block_jumps_and_fallthru_p): Likewise. (find_if_block): Likewise. (find_cond_trap): Likewise. (block_has_only_trap): Likewise. (find_if_case1): Likewise. (find_if_case_2): Likewise. * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise. (perfect_nestify): Likewise. * lcm.c (compute_antinout_edge): Likewise. (compute_laterin): Likewise. (compute_available): Likewise. (compute_nearerout): Likewise. * loop-doloop.c (doloop_modify): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * loop-invariant.c (find_exits): Likewise. * loop-iv.c (simplify_using_initial_values): Likewise. (check_simple_exit): Likewise. (find_simple_exit): Likewise. * loop-unroll.c (peel_loop_completely): Likewise. (unroll_loop_constant_iterations): Likewise. (unroll_loop_runtime_iterations): Likewise. * loop-unswitch.c (may_unswitch_on): Likewise. (unswitch_loop): Likewise. * modulo-sched.c (generate_prolog_epilog): Likewise. (sms_schedule): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. * predict.c (can_predict_insn_p): Likewise. (set_even_probabilities): Likewise. (combine_predictions_for_bb): Likewise. (predict_loops): Likewise. (estimate_probability): Likewise. (tree_predict_by_opcode): Likewise. (tree_estimate_probability): Likewise. (last_basic_block_p): Likewise. (propagate_freq): Likewise. (estimate_loops_at_level): Likewise. (estimate_bb_frequencies): Likewise. * profile.c (instrument_edges): Likewise. (get_exec_counts): Likewise. (compute_branch_probabilities): Likewise. (branch_prob): Likewise. * ra-build.c (live_in): Likewise. * ra-rewrite.c (rewrite_program2): Likewise. * ra.c (reg_alloc): Likewise. * reg-stack.c (reg_to_stack): Likewise. (convert_regs_entry): Likewise. (compensate_edge): Likewise. (convert_regs_1): Likewise, (convert_regs_2): Likewise. (convert_regs): Likewise. * regrename.c (copyprop_hardreg_forward): Likewise. * reload1.c (fixup_abnormal_edges): Likewise. * sbitmap.c (sbitmap_intersection_of_succs): Likewise. (sbitmap_insersection_of_preds): Likewise. (sbitmap_union_of_succs): Likewise. (sbitmap_union_of_preds): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. (fix_basic_block_boundaries): Likewise. (sched_ebbs): Likewise. * sched-rgn.c (build_control_flow): Likewise. (find_rgns): Likewise. * tracer.c (find_best_successor): Likewise. (find_best_predecessor): Likewise. (tail_duplicate): Likewise. * tree-cfg.c (make_edges): Likewise. (make_ctrl_stmt_edges): Likewise. (make_goto_expr_edges): Likewise. (tree_can_merge_blocks_p): Likewise. (tree_merge_blocks): Likewise. (cfg_remove_useless_stmts_bb): Likewise. (remove_phi_nodes_and_edges_for_unreachable_block): Likewise. (tree_block_forwards_to): Likewise. (cleanup_control_expr_graph): Likewise. (find_taken_edge): Likewise. (dump_cfg_stats): Likewise. (tree_cfg2vcg): Likewise. (disband_implicit_edges): Likewise. (tree_find_edge_insert_loc): Likewise. (bsi_commit_edge_inserts): Likewise. (tree_split_edge): Likewise. (tree_verify_flow_info): Likewise. (tree_make_forwarder_block): Likewise. (tree_forwarder_block_p): Likewise. (thread_jumps): Likewise. (tree_try_redirect_by_replacing_jump): Likewise. (tree_split_block): Likewise. (add_phi_args_after_copy_bb): Likewise. (rewrite_to_new_ssa_names_bb): Likewise. (dump_function_to_file): Likewise. (print_pred_bbs): Likewise. (print_loop): Likewise. (tree_flow_call_edges_add): Likewise. (split_critical_edges): Likewise. (execute_warn_function_return): Likewise. (extract_true_false_edges_from_block): Likewise. * tree-if-conv.c (tree_if_conversion): Likewise. (if_convertable_bb_p): Likewise. (find_phi_replacement_condition): Likewise. (combine_blocks): Likewise. * tree-into-ssa.c (compute_global_livein): Likewise. (ssa_mark_phi_uses): Likewise. (ssa_rewrite_initialize_block): Likewise. (rewrite_add_phi_arguments): Likewise. (ssa_rewrite_phi_arguments): Likewise. (insert_phi_nodes_for): Likewise. (rewrite_into_ssa): Likewise. (rewrite_ssa_into_ssa): Likewise. * tree-mudflap.c (mf_build_check_statement_for): Likewise. * tree-outof-ssa.c (coalesce_abnormal_edges): Likewise. (rewrite_trees): Likewise. * tree-pretty-print.c (dump_bb_header): Likewise. (dump_implicit_edges): Likewise. * tree-sra.c (insert_edge_copies): Likewise. (find_obviously_necessary_stmts): Likewise. (remove_data_stmt): Likewise. * tree-ssa-dom.c (thread_across_edge): Likewise. (dom_opt_finalize_block): Likewise. (single_incoming_edge_ignoring_loop_edges): Likewise. (record_equivalences_from_incoming_edges): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-live.c (live_worklist): Likewise. (calculate_live_on_entry): Likewise. (calculate_live_on_exit): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. (copy_loop_headers): Likewise. * tree-ssa-loop-im.c (loop_commit_inserts): Likewise. (fill_always_executed_in): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise. * tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise. (compute_phi_arg_on_exit): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise. (get_loops_exit): Likewise. (split_loop_exit_edge): Likewise. (ip_normal_pos): Likewise. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Likewise. * tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise. (replace_phi_with_stmt): Likewise. (value_replacement): Likewise. * tree-ssa-pre.c (compute_antic_aux): Likewise. (insert_aux): Likewise. (init_pre): Likewise. * tree-ssa-propagate.c (simulate_stmt): Likewise. (simulate_block): Likewise. (ssa_prop_init): Likewise. * tree-ssa-threadupdate.c (thread_block): Likewise. (create_block_for_threading): Likewise. (remove_last_stmt_and_useless_edges): Likewise. * tree-ssa.c (verify_phi_args): Likewise. (verify_ssa): Likewise. * tree_tailcall.c (independent_of_stmt_p): Likewise. (find_tail_calls): Likewise. (eliminate_tail_call): Likewise. (tree_optimize_tail_calls_1): Likewise. * tree-vectorizer.c (vect_transform_loop): Likewise. * var-tracking.c (prologue_stack_adjust): Likewise. (vt_stack_adjustments): Likewise. (vt_find_locations): Likewise. * config/frv/frv.c (frv_ifcvt_modify_tests): Likewise. * config/i386/i386.c (ix86_pad_returns): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu> Co-Authored-By: Steven Bosscher <stevenb@suse.de> From-SVN: r88222
2004-09-28 09:59:54 +02:00
FOR_EACH_EDGE (e, ei, block->succs)
VEC_quick_push (basic_block, worklist, e->dest);
first = VEC_index (basic_block, worklist, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!BB_VISITED (first))
bitmap_set_copy (ANTIC_OUT, maximal_set);
else
bitmap_set_copy (ANTIC_OUT, ANTIC_IN (first));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
for (i = 1; VEC_iterate (basic_block, worklist, i, bprime); i++)
{
if (!BB_VISITED (bprime))
bitmap_set_and (ANTIC_OUT, maximal_set);
else
bitmap_set_and (ANTIC_OUT, ANTIC_IN (bprime));
}
VEC_free (basic_block, heap, worklist);
}
/* Generate ANTIC_OUT - TMP_GEN. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
S = bitmap_set_subtract (ANTIC_OUT, TMP_GEN (block));
/* Start ANTIC_IN with EXP_GEN - TMP_GEN. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (block) = bitmap_set_subtract (EXP_GEN (block),
TMP_GEN (block));
/* Then union in the ANTIC_OUT - TMP_GEN values,
to get ANTIC_OUT U EXP_GEN - TMP_GEN */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (S, bii, bi)
bitmap_value_insert_into_set (ANTIC_IN (block),
expression_for_id (bii));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
clean (ANTIC_IN (block), block);
/* !old->expressions can happen when we deferred a block. */
if (!old->expressions || !bitmap_set_equal (old, ANTIC_IN (block)))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
changed = true;
SET_BIT (changed_blocks, block->index);
FOR_EACH_EDGE (e, ei, block->preds)
SET_BIT (changed_blocks, e->src->index);
}
else
RESET_BIT (changed_blocks, block->index);
maybe_dump_sets:
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (!BB_DEFERRED (block) || BB_VISITED (block))
{
if (ANTIC_OUT)
print_bitmap_set (dump_file, ANTIC_OUT, "ANTIC_OUT", block->index);
if (ANTIC_SAFE_LOADS (block))
print_bitmap_set (dump_file, ANTIC_SAFE_LOADS (block),
"ANTIC_SAFE_LOADS", block->index);
print_bitmap_set (dump_file, ANTIC_IN (block), "ANTIC_IN",
block->index);
if (S)
print_bitmap_set (dump_file, S, "S", block->index);
}
else
{
fprintf (dump_file,
"Block %d was deferred for a future iteration.\n",
block->index);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
if (old)
bitmap_set_free (old);
if (S)
bitmap_set_free (S);
if (ANTIC_OUT)
bitmap_set_free (ANTIC_OUT);
return changed;
}
/* Compute PARTIAL_ANTIC for BLOCK.
If succs(BLOCK) > 1 then
PA_OUT[BLOCK] = value wise union of PA_IN[b] + all ANTIC_IN not
in ANTIC_OUT for all succ(BLOCK)
else if succs(BLOCK) == 1 then
PA_OUT[BLOCK] = phi_translate (PA_IN[succ(BLOCK)])
PA_IN[BLOCK] = dependent_clean(PA_OUT[BLOCK] - TMP_GEN[BLOCK]
- ANTIC_IN[BLOCK])
*/
static bool
compute_partial_antic_aux (basic_block block,
bool block_has_abnormal_pred_edge)
{
bool changed = false;
bitmap_set_t old_PA_IN;
bitmap_set_t PA_OUT;
edge e;
edge_iterator ei;
old_PA_IN = PA_OUT = NULL;
/* If any edges from predecessors are abnormal, antic_in is empty,
so do nothing. */
if (block_has_abnormal_pred_edge)
goto maybe_dump_sets;
old_PA_IN = PA_IN (block);
PA_OUT = bitmap_set_new ();
/* If the block has no successors, ANTIC_OUT is empty. */
if (EDGE_COUNT (block->succs) == 0)
;
/* If we have one successor, we could have some phi nodes to
translate through. Note that we can't phi translate across DFS
back edges in partial antic, because it uses a union operation
on the successors. For recurrences like IV's, we will end up generating a
new value in the set on each go around (i + 3 (VH.1) VH.1 + 1
(VH.2), VH.2 + 1 (VH.3), etc), forever. */
else if (single_succ_p (block))
{
basic_block succ = single_succ (block);
if (!(single_succ_edge (block)->flags & EDGE_DFS_BACK))
phi_translate_set (PA_OUT, PA_IN (succ), block, succ);
}
/* If we have multiple successors, we take the union of all of
them. */
else
{
VEC(basic_block, heap) * worklist;
size_t i;
basic_block bprime;
worklist = VEC_alloc (basic_block, heap, EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs)
{
if (e->flags & EDGE_DFS_BACK)
continue;
VEC_quick_push (basic_block, worklist, e->dest);
}
if (VEC_length (basic_block, worklist) > 0)
{
for (i = 0; VEC_iterate (basic_block, worklist, i, bprime); i++)
{
unsigned int i;
bitmap_iterator bi;
FOR_EACH_EXPR_ID_IN_SET (ANTIC_IN (bprime), i, bi)
bitmap_value_insert_into_set (PA_OUT,
expression_for_id (i));
FOR_EACH_EXPR_ID_IN_SET (PA_IN (bprime), i, bi)
bitmap_value_insert_into_set (PA_OUT,
expression_for_id (i));
}
}
VEC_free (basic_block, heap, worklist);
}
/* PA_IN starts with PA_OUT - TMP_GEN.
Then we subtract things from ANTIC_IN. */
PA_IN (block) = bitmap_set_subtract (PA_OUT, TMP_GEN (block));
/* For partial antic, we want to put back in the phi results, since
we will properly avoid making them partially antic over backedges. */
bitmap_ior_into (PA_IN (block)->values, PHI_GEN (block)->values);
bitmap_ior_into (PA_IN (block)->expressions, PHI_GEN (block)->expressions);
/* PA_IN[block] = PA_IN[block] - ANTIC_IN[block] */
bitmap_set_subtract_values (PA_IN (block), ANTIC_IN (block));
dependent_clean (PA_IN (block), ANTIC_IN (block), block);
if (!bitmap_set_equal (old_PA_IN, PA_IN (block)))
{
changed = true;
SET_BIT (changed_blocks, block->index);
FOR_EACH_EDGE (e, ei, block->preds)
SET_BIT (changed_blocks, e->src->index);
}
else
RESET_BIT (changed_blocks, block->index);
maybe_dump_sets:
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (PA_OUT)
print_bitmap_set (dump_file, PA_OUT, "PA_OUT", block->index);
print_bitmap_set (dump_file, PA_IN (block), "PA_IN", block->index);
}
if (old_PA_IN)
bitmap_set_free (old_PA_IN);
if (PA_OUT)
bitmap_set_free (PA_OUT);
return changed;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Compute ANTIC and partial ANTIC sets. */
static void
compute_antic (void)
{
bool changed = true;
int num_iterations = 0;
basic_block block;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
int i;
/* If any predecessor edges are abnormal, we punt, so antic_in is empty.
We pre-build the map of blocks with incoming abnormal edges here. */
has_abnormal_preds = sbitmap_alloc (last_basic_block);
sbitmap_zero (has_abnormal_preds);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_BB (block)
{
edge_iterator ei;
edge e;
FOR_EACH_EDGE (e, ei, block->preds)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
e->flags &= ~EDGE_DFS_BACK;
if (e->flags & EDGE_ABNORMAL)
{
SET_BIT (has_abnormal_preds, block->index);
break;
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
BB_VISITED (block) = 0;
BB_DEFERRED (block) = 0;
/* While we are here, give empty ANTIC_IN sets to each block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (block) = bitmap_set_new ();
PA_IN (block) = bitmap_set_new ();
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* At the exit block we anticipate nothing. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (EXIT_BLOCK_PTR) = bitmap_set_new ();
BB_VISITED (EXIT_BLOCK_PTR) = 1;
PA_IN (EXIT_BLOCK_PTR) = bitmap_set_new ();
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
changed_blocks = sbitmap_alloc (last_basic_block + 1);
sbitmap_ones (changed_blocks);
while (changed)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting iteration %d\n", num_iterations);
num_iterations++;
changed = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
for (i = 0; i < last_basic_block - NUM_FIXED_BLOCKS; i++)
{
if (TEST_BIT (changed_blocks, postorder[i]))
{
basic_block block = BASIC_BLOCK (postorder[i]);
changed |= compute_antic_aux (block,
TEST_BIT (has_abnormal_preds,
block->index));
}
}
/* Theoretically possible, but *highly* unlikely. */
gcc_assert (num_iterations < 50);
}
if (dump_file && (dump_flags & TDF_STATS))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
fprintf (dump_file, "compute_antic required %d iterations\n",
num_iterations);
if (do_partial_partial)
{
sbitmap_ones (changed_blocks);
mark_dfs_back_edges ();
num_iterations = 0;
changed = true;
while (changed)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting iteration %d\n", num_iterations);
num_iterations++;
changed = false;
for (i = 0; i < last_basic_block - NUM_FIXED_BLOCKS; i++)
{
if (TEST_BIT (changed_blocks, postorder[i]))
{
basic_block block = BASIC_BLOCK (postorder[i]);
changed
|= compute_partial_antic_aux (block,
TEST_BIT (has_abnormal_preds,
block->index));
}
}
/* Theoretically possible, but *highly* unlikely. */
gcc_assert (num_iterations < 50);
}
if (dump_file && (dump_flags & TDF_STATS))
fprintf (dump_file, "compute_partial_antic required %d iterations\n",
num_iterations);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
sbitmap_free (has_abnormal_preds);
sbitmap_free (changed_blocks);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Print the names represented by the bitmap NAMES, to the file OUT. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static void
dump_bitmap_of_names (FILE *out, bitmap names)
{
bitmap_iterator bi;
unsigned int i;
fprintf (out, " { ");
EXECUTE_IF_SET_IN_BITMAP (names, 0, i, bi)
{
print_generic_expr (out, ssa_name (i), 0);
fprintf (out, " ");
}
fprintf (out, "}\n");
}
/* Compute a set of representative vuse versions for each phi. This
is so we can compute conservative kill sets in terms of all vuses
that are killed, instead of continually walking chains.
We also have to be able kill all names associated with a phi when
the phi dies in order to ensure we don't generate overlapping
live ranges, which are not allowed in virtual SSA. */
static bitmap *vuse_names;
static void
compute_vuse_representatives (void)
{
tree phi;
basic_block bb;
VEC (tree, heap) *phis = NULL;
bool changed = true;
size_t i;
FOR_EACH_BB (bb)
{
for (phi = phi_nodes (bb);
phi;
phi = PHI_CHAIN (phi))
if (!is_gimple_reg (PHI_RESULT (phi)))
VEC_safe_push (tree, heap, phis, phi);
}
while (changed)
{
changed = false;
for (i = 0; VEC_iterate (tree, phis, i, phi); i++)
{
size_t ver = SSA_NAME_VERSION (PHI_RESULT (phi));
use_operand_p usep;
ssa_op_iter iter;
if (vuse_names[ver] == NULL)
{
vuse_names[ver] = BITMAP_ALLOC (&grand_bitmap_obstack);
bitmap_set_bit (vuse_names[ver], ver);
}
FOR_EACH_PHI_ARG (usep, phi, iter, SSA_OP_ALL_USES)
{
tree use = USE_FROM_PTR (usep);
bitmap usebitmap = get_representative (vuse_names,
SSA_NAME_VERSION (use));
if (usebitmap != NULL)
{
changed |= bitmap_ior_into (vuse_names[ver],
usebitmap);
}
else
{
changed |= !bitmap_bit_p (vuse_names[ver],
SSA_NAME_VERSION (use));
if (changed)
bitmap_set_bit (vuse_names[ver],
SSA_NAME_VERSION (use));
}
}
}
}
if (dump_file && (dump_flags & TDF_DETAILS))
for (i = 0; VEC_iterate (tree, phis, i, phi); i++)
{
bitmap reps = get_representative (vuse_names,
SSA_NAME_VERSION (PHI_RESULT (phi)));
if (reps)
{
print_generic_expr (dump_file, PHI_RESULT (phi), 0);
fprintf (dump_file, " represents ");
dump_bitmap_of_names (dump_file, reps);
}
}
VEC_free (tree, heap, phis);
}
/* Compute reaching vuses and antic safe loads. RVUSE computation is
is a small bit of iterative dataflow to determine what virtual uses
reach what blocks. Because we can't generate overlapping virtual
uses, and virtual uses *do* actually die, this ends up being faster
in most cases than continually walking the virtual use/def chains
to determine whether we are inside a block where a given virtual is
2006-07-04 23:23:03 +02:00
still available to be used.
ANTIC_SAFE_LOADS are those loads that actually occur before any kill to
their vuses in the block,and thus, are safe at the top of the
2006-07-04 23:23:03 +02:00
block.
An example:
<block begin>
b = *a
*a = 9
<block end>
2006-07-04 23:23:03 +02:00
b = *a is an antic safe load because it still safe to consider it
ANTIC at the top of the block.
We currently compute a conservative approximation to
ANTIC_SAFE_LOADS. We compute those loads that occur before *any*
stores in the block. This is not because it is difficult to
compute the precise answer, but because it is expensive. More
testing is necessary to determine whether it is worth computing the
precise answer. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static void
compute_rvuse_and_antic_safe (void)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int i;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree phi;
basic_block bb;
bool changed = true;
unsigned int *first_store_uid;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
first_store_uid = xcalloc (n_basic_blocks, sizeof (unsigned int));
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
compute_vuse_representatives ();
FOR_ALL_BB (bb)
{
RVUSE_IN (bb) = BITMAP_ALLOC (&grand_bitmap_obstack);
RVUSE_GEN (bb) = BITMAP_ALLOC (&grand_bitmap_obstack);
RVUSE_KILL (bb) = BITMAP_ALLOC (&grand_bitmap_obstack);
RVUSE_OUT (bb) = BITMAP_ALLOC (&grand_bitmap_obstack);
ANTIC_SAFE_LOADS (bb) = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
/* Mark live on entry */
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (name && !is_gimple_reg (name)
&& IS_EMPTY_STMT (SSA_NAME_DEF_STMT (name)))
bitmap_set_bit (RVUSE_OUT (ENTRY_BLOCK_PTR),
SSA_NAME_VERSION (name));
}
/* Compute local sets for reaching vuses.
GEN(block) = generated in block and not locally killed.
KILL(block) = set of vuses killed in block.
*/
FOR_EACH_BB (bb)
{
block_stmt_iterator bsi;
ssa_op_iter iter;
def_operand_p defp;
use_operand_p usep;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
2006-07-04 23:23:03 +02:00
if (first_store_uid[bb->index] == 0
&& !ZERO_SSA_OPERANDS (stmt, SSA_OP_VMAYUSE | SSA_OP_VMAYDEF
| SSA_OP_VMUSTDEF | SSA_OP_VMUSTKILL))
{
first_store_uid[bb->index] = stmt_ann (stmt)->uid;
}
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
FOR_EACH_SSA_USE_OPERAND (usep, stmt, iter, SSA_OP_VIRTUAL_KILLS
| SSA_OP_VMAYUSE)
{
tree use = USE_FROM_PTR (usep);
bitmap repbit = get_representative (vuse_names,
SSA_NAME_VERSION (use));
if (repbit != NULL)
{
bitmap_and_compl_into (RVUSE_GEN (bb), repbit);
bitmap_ior_into (RVUSE_KILL (bb), repbit);
}
else
{
bitmap_set_bit (RVUSE_KILL (bb), SSA_NAME_VERSION (use));
bitmap_clear_bit (RVUSE_GEN (bb), SSA_NAME_VERSION (use));
}
}
FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_VIRTUAL_DEFS)
{
tree def = DEF_FROM_PTR (defp);
bitmap_set_bit (RVUSE_GEN (bb), SSA_NAME_VERSION (def));
}
}
}
FOR_EACH_BB (bb)
{
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
if (!is_gimple_reg (PHI_RESULT (phi)))
{
edge e;
edge_iterator ei;
tree def = PHI_RESULT (phi);
/* In reality, the PHI result is generated at the end of
each predecessor block. This will make the value
LVUSE_IN for the bb containing the PHI, which is
correct. */
FOR_EACH_EDGE (e, ei, bb->preds)
bitmap_set_bit (RVUSE_GEN (e->src), SSA_NAME_VERSION (def));
}
}
}
/* Solve reaching vuses.
RVUSE_IN[BB] = Union of RVUSE_OUT of predecessors.
RVUSE_OUT[BB] = RVUSE_GEN[BB] U (RVUSE_IN[BB] - RVUSE_KILL[BB])
*/
changed = true;
while (changed)
{
int j;
changed = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
for (j = n_basic_blocks - NUM_FIXED_BLOCKS - 1; j >= 0; j--)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
edge e;
edge_iterator ei;
bb = BASIC_BLOCK (postorder[j]);
FOR_EACH_EDGE (e, ei, bb->preds)
bitmap_ior_into (RVUSE_IN (bb), RVUSE_OUT (e->src));
changed |= bitmap_ior_and_compl (RVUSE_OUT (bb),
RVUSE_GEN (bb),
RVUSE_IN (bb),
RVUSE_KILL (bb));
}
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
FOR_ALL_BB (bb)
{
fprintf (dump_file, "RVUSE_IN (%d) =", bb->index);
dump_bitmap_of_names (dump_file, RVUSE_IN (bb));
fprintf (dump_file, "RVUSE_KILL (%d) =", bb->index);
dump_bitmap_of_names (dump_file, RVUSE_KILL (bb));
fprintf (dump_file, "RVUSE_GEN (%d) =", bb->index);
dump_bitmap_of_names (dump_file, RVUSE_GEN (bb));
fprintf (dump_file, "RVUSE_OUT (%d) =", bb->index);
dump_bitmap_of_names (dump_file, RVUSE_OUT (bb));
}
}
FOR_EACH_BB (bb)
2006-07-04 23:23:03 +02:00
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_iterator bi;
if (bitmap_empty_p (RVUSE_KILL (bb)))
continue;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (EXP_GEN (bb), i, bi)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (i);
if (REFERENCE_CLASS_P (expr))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree vh = get_value_handle (expr);
tree maybe = bitmap_find_leader (AVAIL_OUT (bb), vh);
2006-07-04 23:23:03 +02:00
if (maybe)
{
tree def = SSA_NAME_DEF_STMT (maybe);
if (bb_for_stmt (def) != bb)
continue;
2006-07-04 23:23:03 +02:00
if (TREE_CODE (def) == PHI_NODE
|| stmt_ann (def)->uid < first_store_uid[bb->index])
{
if (ANTIC_SAFE_LOADS (bb) == NULL)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_SAFE_LOADS (bb) = bitmap_set_new ();
bitmap_value_insert_into_set (ANTIC_SAFE_LOADS (bb),
expr);
}
}
}
}
}
free (first_store_uid);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
/* Return true if we can value number the call in STMT. This is true
if we have a pure or constant call. */
static bool
can_value_number_call (tree stmt)
{
tree call = get_call_expr_in (stmt);
if (call_expr_flags (call) & (ECF_PURE | ECF_CONST))
return true;
return false;
}
/* Return true if OP is a tree which we can perform value numbering
on. */
static bool
can_value_number_operation (tree op)
{
return UNARY_CLASS_P (op)
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
|| REFERENCE_CLASS_P (op)
|| (TREE_CODE (op) == CALL_EXPR
&& can_value_number_call (op));
}
/* Return true if OP is a tree which we can perform PRE on
on. This may not match the operations we can value number, but in
a perfect world would. */
static bool
can_PRE_operation (tree op)
{
return UNARY_CLASS_P (op)
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
|| TREE_CODE (op) == INDIRECT_REF
|| TREE_CODE (op) == COMPONENT_REF
|| TREE_CODE (op) == CALL_EXPR
|| TREE_CODE (op) == ARRAY_REF;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
/* Inserted expressions are placed onto this worklist, which is used
for performing quick dead code elimination of insertions we made
that didn't turn out to be necessary. */
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
static VEC(tree,heap) *inserted_exprs;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Pool allocated fake store expressions are placed onto this
worklist, which, after performing dead code elimination, is walked
to see which expressions need to be put into GC'able memory */
static VEC(tree, heap) *need_creation;
/* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
trying to rename aggregates into ssa form directly, which is a no
no.
Thus, this routine doesn't create temporaries, it just builds a
single access expression for the array, calling
find_or_generate_expression to build the innermost pieces.
2006-07-04 23:23:03 +02:00
This function is a subroutine of create_expression_by_pieces, and
should not be called on it's own unless you really know what you
are doing.
*/
static tree
create_component_ref_by_pieces (basic_block block, tree expr, tree stmts)
{
tree genop = expr;
tree folded;
if (TREE_CODE (genop) == VALUE_HANDLE)
{
tree found = bitmap_find_leader (AVAIL_OUT (block), expr);
if (found)
return found;
}
2006-07-04 23:23:03 +02:00
if (TREE_CODE (genop) == VALUE_HANDLE)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (expr);
unsigned int firstbit = bitmap_first_set_bit (exprset->expressions);
genop = expression_for_id (firstbit);
}
switch TREE_CODE (genop)
{
case ARRAY_REF:
{
tree op0;
tree op1, op2, op3;
2006-07-04 23:23:03 +02:00
op0 = create_component_ref_by_pieces (block,
TREE_OPERAND (genop, 0),
stmts);
op1 = TREE_OPERAND (genop, 1);
if (TREE_CODE (op1) == VALUE_HANDLE)
op1 = find_or_generate_expression (block, op1, stmts);
op2 = TREE_OPERAND (genop, 2);
if (op2 && TREE_CODE (op2) == VALUE_HANDLE)
op2 = find_or_generate_expression (block, op2, stmts);
op3 = TREE_OPERAND (genop, 3);
if (op3 && TREE_CODE (op3) == VALUE_HANDLE)
op3 = find_or_generate_expression (block, op3, stmts);
2006-07-04 23:23:03 +02:00
folded = build4 (ARRAY_REF, TREE_TYPE (genop), op0, op1,
op2, op3);
return folded;
}
case COMPONENT_REF:
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset;
unsigned int firstbit;
tree op0;
tree op1;
2006-07-04 23:23:03 +02:00
op0 = create_component_ref_by_pieces (block,
TREE_OPERAND (genop, 0),
stmts);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
exprset = VALUE_HANDLE_EXPR_SET (TREE_OPERAND (genop, 1));
firstbit = bitmap_first_set_bit (exprset->expressions);
op1 = expression_for_id (firstbit);
2006-07-04 23:23:03 +02:00
folded = fold_build3 (COMPONENT_REF, TREE_TYPE (genop), op0, op1,
NULL_TREE);
return folded;
}
break;
case INDIRECT_REF:
{
tree op1 = TREE_OPERAND (genop, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (genop), TREE_TYPE (genop),
genop1);
return folded;
}
break;
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
case SSA_NAME:
case STRING_CST:
return genop;
default:
2006-07-04 23:23:03 +02:00
gcc_unreachable ();
}
return NULL_TREE;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Find a leader for an expression, or generate one using
create_expression_by_pieces if it's ANTIC but
2006-07-04 23:23:03 +02:00
complex.
BLOCK is the basic_block we are looking for leaders in.
2006-07-04 23:23:03 +02:00
EXPR is the expression to find a leader or generate for.
STMTS is the statement list to put the inserted expressions on.
Returns the SSA_NAME of the LHS of the generated expression or the
leader. */
static tree
find_or_generate_expression (basic_block block, tree expr, tree stmts)
{
tree genop = bitmap_find_leader (AVAIL_OUT (block), expr);
lambda.h (lambda_vector_min_nz): Likewise. * lambda.h (lambda_vector_min_nz): Likewise. * langhooks.h (struct lang_hooks_for_types, struct lang_hooks): Likewise. * output.h (assemble_integer, this_is_asm_operands): Likewise. * tree.h: Likewise. * vec.h: Likewise. * tree-flow-inline.h (relink_imm_use): Use gcc_assert. * optabs.c (prepare_cmp_insn, emit_cmp_and_jump_insns): Reword comments to avoid 'abort'. Use gcc_assert as necessary. * opts.c (common_handle_option): Likewise. * pretty-print.c (pp_base_format_text): Likewise. * print-rtl.c (print_rtx): Likewise. * read-rtl.c (read_rtx_filename, read_rtx_1): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_valid_class, find_reloads_toplev, find_equiv_reg): Likewise. * reload1.c (reload, forget_old_reloads_1, function_invariant_p, merge_assigned_reloads): Likewise. * tree-inline.c (inline_forbidden_p_1, estimate_num_insns_1): Likewise. * tree-optimize.c (execute_todo): Likewise. * tree-outof-ssa.c (eliminate_phi): Likewise. * tree-ssa-alias.c (add_pointed_to_expr): Likewise. * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Likewise. * tree-ssa-operands.c (parse_ssa_operands, get_indirect_ref_operands, create_ssa_artficial_load_stmt): Likewise. * tree-ssa-pre.c (find_or_generate_expression): Likewise. * tree-ssanames.c (release_ssa_name): Likewise. * tree.c (int_bit_position, int_byte_position, tree_low_cst, walk_tree): Likewise. * tree-ssa-operands.c (verify_abort): Fold into .. (verify_imm_links): ... here. From-SVN: r98519
2005-04-21 20:05:34 +02:00
/* If it's still NULL, it must be a complex expression, so generate
it recursively. */
if (genop == NULL)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (expr);
unsigned int firstbit = bitmap_first_set_bit (exprset->expressions);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
genop = expression_for_id (firstbit);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
gcc_assert (can_PRE_operation (genop));
genop = create_expression_by_pieces (block, genop, stmts);
}
return genop;
}
2006-07-04 23:23:03 +02:00
#define NECESSARY(stmt) stmt->common.asm_written_flag
/* Create an expression in pieces, so that we can handle very complex
2006-07-04 23:23:03 +02:00
expressions that may be ANTIC, but not necessary GIMPLE.
BLOCK is the basic block the expression will be inserted into,
EXPR is the expression to insert (in value form)
STMTS is a statement list to append the necessary insertions into.
lambda.h (lambda_vector_min_nz): Likewise. * lambda.h (lambda_vector_min_nz): Likewise. * langhooks.h (struct lang_hooks_for_types, struct lang_hooks): Likewise. * output.h (assemble_integer, this_is_asm_operands): Likewise. * tree.h: Likewise. * vec.h: Likewise. * tree-flow-inline.h (relink_imm_use): Use gcc_assert. * optabs.c (prepare_cmp_insn, emit_cmp_and_jump_insns): Reword comments to avoid 'abort'. Use gcc_assert as necessary. * opts.c (common_handle_option): Likewise. * pretty-print.c (pp_base_format_text): Likewise. * print-rtl.c (print_rtx): Likewise. * read-rtl.c (read_rtx_filename, read_rtx_1): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_valid_class, find_reloads_toplev, find_equiv_reg): Likewise. * reload1.c (reload, forget_old_reloads_1, function_invariant_p, merge_assigned_reloads): Likewise. * tree-inline.c (inline_forbidden_p_1, estimate_num_insns_1): Likewise. * tree-optimize.c (execute_todo): Likewise. * tree-outof-ssa.c (eliminate_phi): Likewise. * tree-ssa-alias.c (add_pointed_to_expr): Likewise. * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Likewise. * tree-ssa-operands.c (parse_ssa_operands, get_indirect_ref_operands, create_ssa_artficial_load_stmt): Likewise. * tree-ssa-pre.c (find_or_generate_expression): Likewise. * tree-ssanames.c (release_ssa_name): Likewise. * tree.c (int_bit_position, int_byte_position, tree_low_cst, walk_tree): Likewise. * tree-ssa-operands.c (verify_abort): Fold into .. (verify_imm_links): ... here. From-SVN: r98519
2005-04-21 20:05:34 +02:00
This function will die if we hit some value that shouldn't be
ANTIC but is (IE there is no leader for it, or its components).
This function may also generate expressions that are themselves
partially or fully redundant. Those that are will be either made
fully redundant during the next iteration of insert (for partially
redundant ones), or eliminated by eliminate (for fully redundant
ones). */
static tree
create_expression_by_pieces (basic_block block, tree expr, tree stmts)
{
tree temp, name;
tree folded, forced_stmts, newexpr;
tree v;
tree_stmt_iterator tsi;
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
{
tree op0, op2;
tree arglist;
tree genop0, genop2;
tree genarglist;
tree walker, genwalker;
2006-07-04 23:23:03 +02:00
gcc_assert (TREE_CODE (expr) == CALL_EXPR);
genop2 = NULL;
2006-07-04 23:23:03 +02:00
op0 = TREE_OPERAND (expr, 0);
arglist = TREE_OPERAND (expr, 1);
op2 = TREE_OPERAND (expr, 2);
2006-07-04 23:23:03 +02:00
genop0 = find_or_generate_expression (block, op0, stmts);
genarglist = copy_list (arglist);
for (walker = arglist, genwalker = genarglist;
genwalker && walker;
genwalker = TREE_CHAIN (genwalker), walker = TREE_CHAIN (walker))
{
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
TREE_VALUE (genwalker)
= find_or_generate_expression (block, TREE_VALUE (walker),
stmts);
}
2006-07-04 23:23:03 +02:00
if (op2)
genop2 = find_or_generate_expression (block, op2, stmts);
folded = fold_build3 (TREE_CODE (expr), TREE_TYPE (expr),
genop0, genarglist, genop2);
break;
2006-07-04 23:23:03 +02:00
}
break;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
case tcc_reference:
{
if (TREE_CODE (expr) == COMPONENT_REF
|| TREE_CODE (expr) == ARRAY_REF)
{
folded = create_component_ref_by_pieces (block, expr, stmts);
}
else
{
tree op1 = TREE_OPERAND (expr, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr),
genop1);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
break;
}
2006-07-04 23:23:03 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
tree genop1 = find_or_generate_expression (block, op1, stmts);
tree genop2 = find_or_generate_expression (block, op2, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build2 (TREE_CODE (expr), TREE_TYPE (expr),
genop1, genop2);
break;
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_unary:
{
tree op1 = TREE_OPERAND (expr, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr),
genop1);
break;
}
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
/* Force the generated expression to be a sequence of GIMPLE
statements.
We have to call unshare_expr because force_gimple_operand may
modify the tree we pass to it. */
2006-07-04 23:23:03 +02:00
newexpr = force_gimple_operand (unshare_expr (folded), &forced_stmts,
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
false, NULL);
/* If we have any intermediate expressions to the value sets, add them
to the value sets and chain them on in the instruction stream. */
if (forced_stmts)
{
tsi = tsi_start (forced_stmts);
for (; !tsi_end_p (tsi); tsi_next (&tsi))
{
tree stmt = tsi_stmt (tsi);
tree forcedname = TREE_OPERAND (stmt, 0);
tree forcedexpr = TREE_OPERAND (stmt, 1);
tree val = vn_lookup_or_add (forcedexpr, NULL);
2006-07-04 23:23:03 +02:00
VEC_safe_push (tree, heap, inserted_exprs, stmt);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (forcedname, val);
bitmap_value_replace_in_set (NEW_SETS (block), forcedname);
bitmap_value_replace_in_set (AVAIL_OUT (block), forcedname);
mark_new_vars_to_rename (stmt);
}
tsi = tsi_last (stmts);
tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
}
/* Build and insert the assignment of the end result to the temporary
that we will return. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!pretemp || TREE_TYPE (expr) != TREE_TYPE (pretemp))
{
pretemp = create_tmp_var (TREE_TYPE (expr), "pretmp");
get_var_ann (pretemp);
}
temp = pretemp;
re PR c++/26757 (C++ front-end producing two DECLs with the same UID) 2006-05-23 Andrew MacLeod <amacleod@redhat.com> PR c++/26757 * tree-ssa-loop-im.c (determine_invariantness_stmt): Use add_referenced_var instead of add_referenced_tmp_var. * tree-complex.c (create_one_component_var): Use add_referenced_var. * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use add_referenced_var. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value, tree_optimize_tail_calls_1): Use add_referenced_var. * tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var. * tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft): Use add_referenced_var. * tree-if-conv.c (ifc_temp_var): Use add_referenced_var. * gimplify.c (force_gimple_operand): Use add_referenced_var. * tree-ssa-phiopt.c (conditional_replacement, abs_replacement): Use add_referenced_var. * tree-dfa.c (struct walk_state): Remove. (find_referenced_vars): Remove walk state and vars_found hash table. (make_rename_temp): Use add_referenced_var. (find_vars_r): Pass less parameters to add_referenced_var. (referenced_var_p): New. Is var in referenced_var hash table. (referenced_var_insert): Assert var isn't already in hash table. (add_referenced_var): Don't need walk_state parameter. Add var if it isn't already in the hash table. (add_referenced_tmp_var): Remove. (find_new_referenced_vars_1): Use add_referenced_var. * tree-ssa-pre.c (create_expression_by_pieces, insert_into_preds_of_block, insert_extra_phis, realify_fake_stores): Use add_referenced_var. * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var. * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use add_referenced_var. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_create_destination_var, vect_init_vector, vect_build_loop_niters, vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks): Use add_referenced_var. * tree-outof-ssa.c (create_temp): Use add_referenced_var. * tree-flow.h (add_referenced_tmp_var): Remove prototype (add_referenced_var): Add prototype. * tree-ssa-structalias.c (get_constraint_for, intra_create_variable_infos): Use add_referenced_var. From-SVN: r114018
2006-05-23 16:07:21 +02:00
add_referenced_var (temp);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
DECL_COMPLEX_GIMPLE_REG_P (temp) = 1;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build. 2005-12-02 Richard Guenther <rguenther@suse.de> * tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build. * tree-complex.c (update_complex_assignment, expand_complex_div_wide): Likewise. * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref, maybe_fold_offset_to_component_ref): Likewise. * tree-ssa-dom.c (thread_across_edge, simplify_rhs_and_lookup_avail_expr, find_equivalent_equality_comparison, record_equivalences_from_stmt): Likewise. * gimple-low.c (lower_function_body, lower_return_expr): Likewise. * tree-eh.c (do_return_redirection, honor_protect_cleanup_actions, lower_try_finally_switch): Likewise. * tree-if-conv.c (add_to_dst_predicate_list, replace_phi_with_cond_modify_expr, ifc_temp_var): Likewise. * gimplify.c (internal_get_tmp_var, gimple_build_eh_filter, voidify_wrapper_expr, build_stack_save_restore, gimplify_bind_expr, gimplify_return_expr, gimplify_decl_expr, gimplify_switch_expr, gimplify_case_label_expr, gimplify_exit_expr, gimplify_self_mod_expr, shortcut_cond_r, shortcut_cond_expr, gimplify_cond_expr, gimplify_init_ctor_eval, gimplify_init_constructor, gimplify_variable_sized_compare, gimplify_boolean_expr, gimplify_cleanup_point_expr, gimple_push_cleanup, gimplify_target_expr, gimplify_expr, gimplify_body, gimplify_function_tree, force_gimple_operand): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Likewise. * tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for, mx_register_decls): Likewise. * tree-nested.c (init_tmp_var, save_tmp_var, get_static_chain, get_frame_field, finalize_nesting_tree_1): Likewise. * tree-inline.c (setup_one_parameter): Likewise. * tree-vect-transform.c (vectorizable_condition): Likewise. * tree-outof-ssa.c (insert_copy_on_edge, insert_backedge_copies): Likewise. * tree-profile.c (tree_gen_edge_profiler): Likewise. * tree-cfg.c (factor_computed_gotos, gimplify_val): Likewise. * c-parser.c (c_parser_if_body, c_parser_switch_statement): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. From-SVN: r107907
2005-12-02 18:09:40 +01:00
newexpr = build2 (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr);
name = make_ssa_name (temp, newexpr);
TREE_OPERAND (newexpr, 0) = name;
NECESSARY (newexpr) = 0;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tsi = tsi_last (stmts);
tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
VEC_safe_push (tree, heap, inserted_exprs, newexpr);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
mark_new_vars_to_rename (newexpr);
/* Add a value handle to the temporary.
The value may already exist in either NEW_SETS, or AVAIL_OUT, because
we are creating the expression by pieces, and this particular piece of
the expression may have been represented. There is no harm in replacing
here. */
v = get_value_handle (expr);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (name, v);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
get_or_alloc_expression_id (name);
2006-07-04 23:23:03 +02:00
bitmap_value_replace_in_set (NEW_SETS (block), name);
bitmap_value_replace_in_set (AVAIL_OUT (block), name);
pre_stats.insertions++;
if (dump_file && (dump_flags & TDF_DETAILS))
2006-07-04 23:23:03 +02:00
{
fprintf (dump_file, "Inserted ");
print_generic_expr (dump_file, newexpr, 0);
fprintf (dump_file, " in predecessor %d\n", block->index);
}
return name;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Insert the to-be-made-available values of expression EXPRNUM for each
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
predecessor, stored in AVAIL, into the predecessors of BLOCK, and
merge the result with a phi node, given the same value handle as
NODE. Return true if we have inserted new stuff. */
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
insert_into_preds_of_block (basic_block block, unsigned int exprnum,
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree *avail)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (exprnum);
tree val = get_value_handle (expr);
edge pred;
bool insertions = false;
bool nophi = false;
basic_block bprime;
tree eprime;
edge_iterator ei;
tree type = TREE_TYPE (avail[EDGE_PRED (block, 0)->src->index]);
tree temp;
2006-07-04 23:23:03 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found partial redundancy for expression ");
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (dump_file, expr, 0);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
fprintf (dump_file, " (");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, ")");
fprintf (dump_file, "\n");
}
/* Make sure we aren't creating an induction variable. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (block->loop_depth > 0 && EDGE_COUNT (block->preds) == 2
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& TREE_CODE_CLASS (TREE_CODE (expr)) != tcc_reference )
{
bool firstinsideloop = false;
bool secondinsideloop = false;
2006-07-04 23:23:03 +02:00
firstinsideloop = flow_bb_inside_loop_p (block->loop_father,
EDGE_PRED (block, 0)->src);
secondinsideloop = flow_bb_inside_loop_p (block->loop_father,
EDGE_PRED (block, 1)->src);
/* Induction variables only have one edge inside the loop. */
if (firstinsideloop ^ secondinsideloop)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Skipping insertion of phi for partial redundancy: Looks like an induction variable\n");
nophi = true;
}
}
2006-07-04 23:23:03 +02:00
/* Make the necessary insertions. */
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree stmts = alloc_stmt_list ();
tree builtexpr;
bprime = pred->src;
eprime = avail[bprime->index];
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (can_PRE_operation (eprime))
{
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
#ifdef ENABLE_CHECKING
tree vh;
/* eprime may be an invariant. */
2006-07-04 23:23:03 +02:00
vh = TREE_CODE (eprime) == VALUE_HANDLE
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
? eprime
: get_value_handle (eprime);
/* ensure that the virtual uses we need reach our block. */
if (TREE_CODE (vh) == VALUE_HANDLE)
{
int i;
tree vuse;
for (i = 0;
VEC_iterate (tree, VALUE_HANDLE_VUSES (vh), i, vuse);
i++)
{
size_t id = SSA_NAME_VERSION (vuse);
gcc_assert (bitmap_bit_p (RVUSE_OUT (bprime), id)
|| IS_EMPTY_STMT (SSA_NAME_DEF_STMT (vuse)));
}
}
#endif
builtexpr = create_expression_by_pieces (bprime,
eprime,
stmts);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
gcc_assert (!(pred->flags & EDGE_ABNORMAL));
bsi_insert_on_edge (pred, stmts);
avail[bprime->index] = builtexpr;
insertions = true;
2006-07-04 23:23:03 +02:00
}
}
/* If we didn't want a phi node, and we made insertions, we still have
inserted new stuff, and thus return true. If we didn't want a phi node,
and didn't make insertions, we haven't added anything new, so return
false. */
if (nophi && insertions)
return true;
else if (nophi && !insertions)
return false;
/* Now build a phi for the new variable. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!prephitemp || TREE_TYPE (prephitemp) != type)
{
prephitemp = create_tmp_var (type, "prephitmp");
get_var_ann (prephitemp);
}
temp = prephitemp;
re PR c++/26757 (C++ front-end producing two DECLs with the same UID) 2006-05-23 Andrew MacLeod <amacleod@redhat.com> PR c++/26757 * tree-ssa-loop-im.c (determine_invariantness_stmt): Use add_referenced_var instead of add_referenced_tmp_var. * tree-complex.c (create_one_component_var): Use add_referenced_var. * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use add_referenced_var. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value, tree_optimize_tail_calls_1): Use add_referenced_var. * tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var. * tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft): Use add_referenced_var. * tree-if-conv.c (ifc_temp_var): Use add_referenced_var. * gimplify.c (force_gimple_operand): Use add_referenced_var. * tree-ssa-phiopt.c (conditional_replacement, abs_replacement): Use add_referenced_var. * tree-dfa.c (struct walk_state): Remove. (find_referenced_vars): Remove walk state and vars_found hash table. (make_rename_temp): Use add_referenced_var. (find_vars_r): Pass less parameters to add_referenced_var. (referenced_var_p): New. Is var in referenced_var hash table. (referenced_var_insert): Assert var isn't already in hash table. (add_referenced_var): Don't need walk_state parameter. Add var if it isn't already in the hash table. (add_referenced_tmp_var): Remove. (find_new_referenced_vars_1): Use add_referenced_var. * tree-ssa-pre.c (create_expression_by_pieces, insert_into_preds_of_block, insert_extra_phis, realify_fake_stores): Use add_referenced_var. * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var. * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use add_referenced_var. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_create_destination_var, vect_init_vector, vect_build_loop_niters, vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks): Use add_referenced_var. * tree-outof-ssa.c (create_temp): Use add_referenced_var. * tree-flow.h (add_referenced_tmp_var): Remove prototype (add_referenced_var): Add prototype. * tree-ssa-structalias.c (get_constraint_for, intra_create_variable_infos): Use add_referenced_var. From-SVN: r114018
2006-05-23 16:07:21 +02:00
add_referenced_var (temp);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (type) == COMPLEX_TYPE)
DECL_COMPLEX_GIMPLE_REG_P (temp) = 1;
temp = create_phi_node (temp, block);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2006-07-04 23:23:03 +02:00
NECESSARY (temp) = 0;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_safe_push (tree, heap, inserted_exprs, temp);
FOR_EACH_EDGE (pred, ei, block->preds)
add_phi_arg (temp, avail[pred->src->index], pred);
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (PHI_RESULT (temp), val);
2006-07-04 23:23:03 +02:00
/* The value should *not* exist in PHI_GEN, or else we wouldn't be doing
this insertion, since we test for the existence of this value in PHI_GEN
before proceeding with the partial redundancy checks in insert_aux.
2006-07-04 23:23:03 +02:00
The value may exist in AVAIL_OUT, in particular, it could be represented
by the expression we are trying to eliminate, in which case we want the
replacement to occur. If it's not existing in AVAIL_OUT, we want it
inserted there.
2006-07-04 23:23:03 +02:00
Similarly, to the PHI_GEN case, the value should not exist in NEW_SETS of
this block, because if it did, it would have existed in our dominator's
AVAIL_OUT, and would have been skipped due to the full redundancy check.
*/
bitmap_insert_into_set (PHI_GEN (block),
PHI_RESULT (temp));
2006-07-04 23:23:03 +02:00
bitmap_value_replace_in_set (AVAIL_OUT (block),
PHI_RESULT (temp));
bitmap_insert_into_set (NEW_SETS (block),
PHI_RESULT (temp));
2006-07-04 23:23:03 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Created phi ");
print_generic_expr (dump_file, temp, 0);
fprintf (dump_file, " in block %d\n", block->index);
}
pre_stats.phis++;
return true;
}
2006-07-04 23:23:03 +02:00
/* Perform insertion of partially redundant values.
For BLOCK, do the following:
1. Propagate the NEW_SETS of the dominator into the current block.
2006-07-04 23:23:03 +02:00
If the block has multiple predecessors,
2a. Iterate over the ANTIC expressions for the block to see if
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
any of them are partially redundant.
2b. If so, insert them into the necessary predecessors to make
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
the expression fully redundant.
2c. Insert a new PHI merging the values of the predecessors.
2d. Insert the new PHI, and the new expressions, into the
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
NEW_SETS set.
3. Recursively call ourselves on the dominator children of BLOCK.
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
Steps 1, 2a, and 3 are done by insert_aux. 2b, 2c and 2d are done by
do_regular_insertion and do_partial_insertion.
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
*/
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bool
do_regular_insertion (basic_block block, basic_block dom)
{
bool new_stuff = false;
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (ANTIC_IN (block));
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (can_PRE_operation (expr) && !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
{
tree *avail;
tree val;
bool by_some = false;
bool cant_insert = false;
bool all_same = true;
tree first_s = NULL;
edge pred;
basic_block bprime;
tree eprime = NULL_TREE;
edge_iterator ei;
val = get_value_handle (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val))
continue;
if (bitmap_set_contains_value (AVAIL_OUT (dom), val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Found fully redundant value\n");
continue;
}
avail = XCNEWVEC (tree, last_basic_block);
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree vprime;
tree edoubleprime;
/* This can happen in the very weird case
that our fake infinite loop edges have caused a
critical edge to appear. */
if (EDGE_CRITICAL_P (pred))
{
cant_insert = true;
break;
}
bprime = pred->src;
eprime = phi_translate (expr, ANTIC_IN (block), NULL,
bprime, block);
/* eprime will generally only be NULL if the
value of the expression, translated
through the PHI for this predecessor, is
undefined. If that is the case, we can't
make the expression fully redundant,
because its value is undefined along a
predecessor path. We can thus break out
early because it doesn't matter what the
rest of the results are. */
if (eprime == NULL)
{
cant_insert = true;
break;
}
eprime = fully_constant_expression (eprime);
vprime = get_value_handle (eprime);
gcc_assert (vprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
vprime);
if (edoubleprime == NULL)
{
avail[bprime->index] = eprime;
all_same = false;
}
else
{
avail[bprime->index] = edoubleprime;
by_some = true;
if (first_s == NULL)
first_s = edoubleprime;
else if (!operand_equal_p (first_s, edoubleprime,
0))
all_same = false;
}
}
/* If we can insert it, it's not the same value
already existing along every predecessor, and
it's defined by some predecessor, it is
partially redundant. */
if (!cant_insert && !all_same && by_some)
{
if (insert_into_preds_of_block (block, get_expression_id (expr),
avail))
new_stuff = true;
}
/* If all edges produce the same value and that value is
an invariant, then the PHI has the same value on all
edges. Note this. */
else if (!cant_insert && all_same && eprime
&& is_gimple_min_invariant (eprime)
&& !is_gimple_min_invariant (val))
{
unsigned int j;
bitmap_iterator bi;
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (val);
FOR_EACH_EXPR_ID_IN_SET (exprset, j, bi)
{
tree expr = expression_for_id (j);
if (TREE_CODE (expr) == SSA_NAME)
{
vn_add (expr, eprime);
pre_stats.constified++;
}
}
}
free (avail);
}
}
VEC_free (tree, heap, exprs);
return new_stuff;
}
/* Perform insertion for partially anticipatable expressions. There
is only one case we will perform insertion for these. This case is
if the expression is partially anticipatable, and fully available.
In this case, we know that putting it earlier will enable us to
remove the later computation. */
static bool
do_partial_partial_insertion (basic_block block, basic_block dom)
{
bool new_stuff = false;
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (PA_IN (block));
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (can_PRE_operation (expr) && !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
{
tree *avail;
tree val;
bool by_all = true;
bool cant_insert = false;
edge pred;
basic_block bprime;
tree eprime = NULL_TREE;
edge_iterator ei;
val = get_value_handle (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val))
continue;
if (bitmap_set_contains_value (AVAIL_OUT (dom), val))
continue;
avail = XCNEWVEC (tree, last_basic_block);
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree vprime;
tree edoubleprime;
/* This can happen in the very weird case
that our fake infinite loop edges have caused a
critical edge to appear. */
if (EDGE_CRITICAL_P (pred))
{
cant_insert = true;
break;
}
bprime = pred->src;
eprime = phi_translate (expr, ANTIC_IN (block),
PA_IN (block),
bprime, block);
/* eprime will generally only be NULL if the
value of the expression, translated
through the PHI for this predecessor, is
undefined. If that is the case, we can't
make the expression fully redundant,
because its value is undefined along a
predecessor path. We can thus break out
early because it doesn't matter what the
rest of the results are. */
if (eprime == NULL)
{
cant_insert = true;
break;
}
eprime = fully_constant_expression (eprime);
vprime = get_value_handle (eprime);
gcc_assert (vprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
vprime);
if (edoubleprime == NULL)
{
by_all = false;
break;
}
else
avail[bprime->index] = edoubleprime;
}
/* If we can insert it, it's not the same value
already existing along every predecessor, and
it's defined by some predecessor, it is
partially redundant. */
if (!cant_insert && by_all)
{
pre_stats.pa_insert++;
if (insert_into_preds_of_block (block, get_expression_id (expr),
avail))
new_stuff = true;
}
free (avail);
}
}
VEC_free (tree, heap, exprs);
return new_stuff;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bool
insert_aux (basic_block block)
{
basic_block son;
bool new_stuff = false;
if (block)
{
basic_block dom;
dom = get_immediate_dominator (CDI_DOMINATORS, block);
if (dom)
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
{
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
bitmap_set_t newset = NEW_SETS (dom);
if (newset)
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
{
/* Note that we need to value_replace both NEW_SETS, and
AVAIL_OUT. For both the case of NEW_SETS, the value may be
represented by some non-simple expression here that we want
to replace it with. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (newset, i, bi)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (i);
bitmap_value_replace_in_set (NEW_SETS (block), expr);
bitmap_value_replace_in_set (AVAIL_OUT (block), expr);
}
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
}
basic-block.h (single_succ_p, [...]): New inline functions. * basic-block.h (single_succ_p, single_pred_p, single_succ_edge, single_pred_edge, single_succ, single_pred): New inline functions. * bb-reorder.c (rotate_loop, find_traces_1_round, add_labels_and_missing_jumps, fix_up_fall_thru_edges, duplicate_computed_gotos): Use the single_succ/pred functions. * cfganal.c (forwarder_block_p): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * cfgcleanup.c (try_simplify_condjump, try_forward_edges, outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg, merge_seq_blocks): Ditto. * cfghooks.c (split_edge, tidy_fallthru_edges): Ditto. * cfglayout.c (fixup_reorder_chain): Ditto. * cfgloop.c (mark_single_exit_loops, update_latch_info, canonicalize_loop_headers, verify_loop_structure): Ditto. * cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge, mfb_update_loops, create_preheader, force_single_succ_latches, create_loop_notes): Ditto. * cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump, force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge, commit_one_edge_insertion, purge_dead_edges, cfg_layout_can_merge_blocks_p): Ditto. * except.c (sjlj_emit_function_enter): Ditto. * flow.c (init_propagate_block_info): Ditto. * function.c (thread_prologue_and_epilogue_insns): Ditto. * gcse.c (find_implicit_sets, bypass_conditional_jumps, insert_insn_end_bb): Ditto. * ifcvt.c (merge_if_block, find_if_block, find_if_case_1, find_if_case_2): Ditto. * lambda-code.c (perfect_nestify): Ditto. * lcm.c (optimize_mode_switching): Ditto. * loop-doloop.c (doloop_modify): Ditto. * loop-init.c (loop_optimizer_init): Ditto. * loop-iv.c (simplify_using_initial_values): Ditto. * loop-unroll.c (unroll_loop_runtime_iterations): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * modulo-sched.c (generate_prolog_epilog): Ditto. * predict.c (combine_predictions_for_insn, estimate_probability, tree_estimate_probability, last_basic_block_p, estimate_bb_frequencies): Ditto. * profile.c (branch_prob): Ditto. * regrename.c (copyprop_hardreg_forward): Ditto. * sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto. * tracer.c (layout_superblocks): Ditto. * tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks, cfg_remove_useless_stmts_bb, cleanup_control_flow, cleanup_control_expr_graph, disband_implicit_edges, tree_find_edge_insert_loc, bsi_commit_edge_inserts, tree_verify_flow_info, tree_make_forwarder_block, tree_forwarder_block_p, remove_forwarder_block, remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. * tree-if-conv.c (tree_if_conversion): Ditto. * tree-mudflap.c (mf_build_check_statement_for): Ditto. * tree-ssa-dce.c (remove_dead_stmt): Ditto. * tree-ssa-dom.c (dom_opt_finalize_block): Ditto. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, copy_loop_headers): Ditto. * tree-ssa-loop-im.c (loop_commit_inserts): Ditto. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto. * tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos, lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto. * tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto. * tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto. * tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto. * tree-ssa-threadupdate.c (redirect_edges): Ditto. * tree-tailcall.c (independent_of_stmt_p, find_tail_calls, eliminate_tail_call, tree_optimize_tail_calls_1): Ditto. * tree-vect-analyze.c (vect_analyze_loop_form): Ditto. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard, slpeel_add_loop_guard): Ditto. From-SVN: r96292
2005-03-11 10:05:12 +01:00
if (!single_pred_p (block))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
new_stuff |= do_regular_insertion (block, dom);
if (do_partial_partial)
new_stuff |= do_partial_partial_insertion (block, dom);
}
}
}
for (son = first_dom_son (CDI_DOMINATORS, block);
son;
son = next_dom_son (CDI_DOMINATORS, son))
{
new_stuff |= insert_aux (son);
}
return new_stuff;
}
/* Perform insertion of partially redundant values. */
static void
insert (void)
{
bool new_stuff = true;
basic_block bb;
int num_iterations = 0;
2006-07-04 23:23:03 +02:00
FOR_ALL_BB (bb)
NEW_SETS (bb) = bitmap_set_new ();
2006-07-04 23:23:03 +02:00
while (new_stuff)
{
num_iterations++;
new_stuff = false;
new_stuff = insert_aux (ENTRY_BLOCK_PTR);
}
if (num_iterations > 2 && dump_file && (dump_flags & TDF_STATS))
fprintf (dump_file, "insert required %d iterations\n", num_iterations);
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Return true if VAR is an SSA variable with no defining statement in
this procedure, *AND* isn't a live-on-entry parameter. */
static bool
is_undefined_value (tree expr)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
return (TREE_CODE (expr) == SSA_NAME
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& IS_EMPTY_STMT (SSA_NAME_DEF_STMT (expr))
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* PARM_DECLs and hard registers are always defined. */
&& TREE_CODE (SSA_NAME_VAR (expr)) != PARM_DECL);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Given an SSA variable VAR and an expression EXPR, compute the value
number for EXPR and create a value handle (VAL) for it. If VAR and
EXPR are not the same, associate VAL with VAR. Finally, add VAR to
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
S1 and its value handle to S2, and to the maximal set if
ADD_TO_MAXIMAL is true.
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
VUSES represent the virtual use operands associated with EXPR (if
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
any). */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static inline void
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
add_to_sets (tree var, tree expr, tree stmt, bitmap_set_t s1,
bitmap_set_t s2)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
tree val = vn_lookup_or_add (expr, stmt);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* VAR and EXPR may be the same when processing statements for which
we are not computing value numbers (e.g., non-assignments, or
statements that make aliased stores). In those cases, we are
only interested in making VAR available as its own value. */
if (var != expr)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (var, val);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (s1)
bitmap_insert_into_set (s1, var);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* PHI nodes can't go in the maximal sets because they are not in
TMP_GEN, so it is possible to get into non-monotonic situations
during ANTIC calculation, because it will *add* bits. */
if (!in_fre && TREE_CODE (SSA_NAME_DEF_STMT (var)) != PHI_NODE)
bitmap_value_insert_into_set (maximal_set, var);
bitmap_value_insert_into_set (s2, var);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Find existing value expression that is the same as T,
and return it if it exists. */
static inline tree
find_existing_value_expr (tree t, tree stmt)
{
bitmap_iterator bi;
unsigned int bii;
tree vh;
bitmap_set_t exprset;
if (REFERENCE_CLASS_P (t))
vh = vn_lookup (t, stmt);
else
vh = vn_lookup (t, NULL);
if (!vh)
return NULL;
exprset = VALUE_HANDLE_EXPR_SET (vh);
FOR_EACH_EXPR_ID_IN_SET (exprset, bii, bi)
{
tree efi = expression_for_id (bii);
if (expressions_equal_p (t, efi))
return efi;
}
return NULL;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Given a unary or binary expression EXPR, create and return a new
expression with the same structure as EXPR but with its operands
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
replaced with the value handles of each of the operands of EXPR.
VUSES represent the virtual use operands associated with EXPR (if
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
any). Insert EXPR's operands into the EXP_GEN set for BLOCK. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static inline tree
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
create_value_expr_from (tree expr, basic_block block, tree stmt)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
int i;
enum tree_code code = TREE_CODE (expr);
tree vexpr;
alloc_pool pool;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree efi;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
gcc_assert (TREE_CODE_CLASS (code) == tcc_unary
|| TREE_CODE_CLASS (code) == tcc_binary
|| TREE_CODE_CLASS (code) == tcc_comparison
|| TREE_CODE_CLASS (code) == tcc_reference
|| TREE_CODE_CLASS (code) == tcc_expression
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
|| TREE_CODE_CLASS (code) == tcc_exceptional
|| TREE_CODE_CLASS (code) == tcc_declaration);
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
if (TREE_CODE_CLASS (code) == tcc_unary)
pool = unary_node_pool;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
else if (TREE_CODE_CLASS (code) == tcc_reference)
pool = reference_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_binary)
pool = binary_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_comparison)
pool = comparison_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_exceptional)
{
gcc_assert (code == TREE_LIST);
pool = list_node_pool;
}
2006-07-04 23:23:03 +02:00
else
{
gcc_assert (code == CALL_EXPR);
pool = expression_node_pool;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
vexpr = (tree) pool_alloc (pool);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
memcpy (vexpr, expr, tree_size (expr));
2006-07-04 23:23:03 +02:00
/* This case is only for TREE_LIST's that appear as part of
CALL_EXPR's. Anything else is a bug, but we can't easily verify
this, hence this comment. TREE_LIST is not handled by the
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
general case below because they don't have a fixed length, or
operands, so you can't access purpose/value/chain through
TREE_OPERAND macros. */
if (code == TREE_LIST)
{
tree op = NULL_TREE;
tree temp = NULL_TREE;
if (TREE_CHAIN (vexpr))
2006-07-04 23:23:03 +02:00
temp = create_value_expr_from (TREE_CHAIN (vexpr), block, stmt);
TREE_CHAIN (vexpr) = temp ? temp : TREE_CHAIN (vexpr);
2006-07-04 23:23:03 +02:00
/* Recursively value-numberize reference ops. */
if (REFERENCE_CLASS_P (TREE_VALUE (vexpr)))
{
tree tempop;
op = TREE_VALUE (vexpr);
tempop = create_value_expr_from (op, block, stmt);
op = tempop ? tempop : op;
2006-07-04 23:23:03 +02:00
TREE_VALUE (vexpr) = vn_lookup_or_add (op, stmt);
}
else
{
op = TREE_VALUE (vexpr);
TREE_VALUE (vexpr) = vn_lookup_or_add (TREE_VALUE (vexpr), NULL);
}
/* This is the equivalent of inserting op into EXP_GEN like we
do below */
if (!is_undefined_value (op))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (EXP_GEN (block), op);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
efi = find_existing_value_expr (vexpr, stmt);
if (efi)
return efi;
get_or_alloc_expression_id (vexpr);
return vexpr;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
for (i = 0; i < TREE_CODE_LENGTH (code); i++)
{
tree val, op;
2006-07-04 23:23:03 +02:00
op = TREE_OPERAND (expr, i);
if (op == NULL_TREE)
continue;
/* Recursively value-numberize reference ops and tree lists. */
if (REFERENCE_CLASS_P (op))
{
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
tree tempop = create_value_expr_from (op, block, stmt);
op = tempop ? tempop : op;
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
val = vn_lookup_or_add (op, stmt);
}
else if (TREE_CODE (op) == TREE_LIST)
{
tree tempop;
2006-07-04 23:23:03 +02:00
gcc_assert (TREE_CODE (expr) == CALL_EXPR);
tempop = create_value_expr_from (op, block, stmt);
2006-07-04 23:23:03 +02:00
op = tempop ? tempop : op;
vn_lookup_or_add (op, NULL);
/* Unlike everywhere else, we do *not* want to replace the
TREE_LIST itself with a value number, because support
functions we call will blow up. */
val = op;
}
2006-07-04 23:23:03 +02:00
else
/* Create a value handle for OP and add it to VEXPR. */
val = vn_lookup_or_add (op, NULL);
if (!is_undefined_value (op) && TREE_CODE (op) != TREE_LIST)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (EXP_GEN (block), op);
if (TREE_CODE (val) == VALUE_HANDLE)
TREE_TYPE (val) = TREE_TYPE (TREE_OPERAND (vexpr, i));
TREE_OPERAND (vexpr, i) = val;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
efi = find_existing_value_expr (vexpr, stmt);
if (efi)
return efi;
get_or_alloc_expression_id (vexpr);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
return vexpr;
}
/* Given a statement STMT and its right hand side which is a load, try
to look for the expression stored in the location for the load, and
return true if a useful equivalence was recorded for LHS. */
static bool
try_look_through_load (tree lhs, tree mem_ref, tree stmt, basic_block block)
{
tree store_stmt = NULL;
tree rhs;
ssa_op_iter i;
tree vuse;
FOR_EACH_SSA_TREE_OPERAND (vuse, stmt, i, SSA_OP_VIRTUAL_USES)
{
tree def_stmt;
gcc_assert (TREE_CODE (vuse) == SSA_NAME);
def_stmt = SSA_NAME_DEF_STMT (vuse);
/* If there is no useful statement for this VUSE, we'll not find a
useful expression to return either. Likewise, if there is a
statement but it is not a simple assignment or it has virtual
uses, we can stop right here. Note that this means we do
not look through PHI nodes, which is intentional. */
if (!def_stmt
|| TREE_CODE (def_stmt) != MODIFY_EXPR
|| !ZERO_SSA_OPERANDS (def_stmt, SSA_OP_VIRTUAL_USES))
return false;
/* If this is not the same statement as one we have looked at for
another VUSE of STMT already, we have two statements producing
something that reaches our STMT. */
if (store_stmt && store_stmt != def_stmt)
return false;
else
{
/* Is this a store to the exact same location as the one we are
loading from in STMT? */
if (!operand_equal_p (TREE_OPERAND (def_stmt, 0), mem_ref, 0))
return false;
/* Otherwise remember this statement and see if all other VUSEs
come from the same statement. */
store_stmt = def_stmt;
}
}
/* Alright then, we have visited all VUSEs of STMT and we've determined
that all of them come from the same statement STORE_STMT. See if there
is a useful expression we can deduce from STORE_STMT. */
rhs = TREE_OPERAND (store_stmt, 1);
if ((TREE_CODE (rhs) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
|| TREE_INVARIANT (rhs))
{
2006-07-04 23:23:03 +02:00
/* Yay! Compute a value number for the RHS of the statement and
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
add its value to the AVAIL_OUT set for the block. Add the LHS
to TMP_GEN. */
add_to_sets (lhs, rhs, store_stmt, TMP_GEN (block), AVAIL_OUT (block));
if (TREE_CODE (rhs) == SSA_NAME
&& !is_undefined_value (rhs))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (EXP_GEN (block), rhs);
return true;
}
return false;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Return a copy of NODE that is stored in the temporary alloc_pool's.
This is made recursively true, so that the operands are stored in
the pool as well. */
static tree
poolify_tree (tree node)
{
switch (TREE_CODE (node))
{
case INDIRECT_REF:
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree temp = (tree) pool_alloc (reference_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (temp, node, tree_size (node));
TREE_OPERAND (temp, 0) = poolify_tree (TREE_OPERAND (temp, 0));
return temp;
}
break;
case MODIFY_EXPR:
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree temp = (tree) pool_alloc (modify_expr_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (temp, node, tree_size (node));
TREE_OPERAND (temp, 0) = poolify_tree (TREE_OPERAND (temp, 0));
TREE_OPERAND (temp, 1) = poolify_tree (TREE_OPERAND (temp, 1));
return temp;
}
break;
case SSA_NAME:
case INTEGER_CST:
case STRING_CST:
case REAL_CST:
case PARM_DECL:
case VAR_DECL:
case RESULT_DECL:
return node;
default:
gcc_unreachable ();
}
}
static tree modify_expr_template;
/* Allocate a MODIFY_EXPR with TYPE, and operands OP1, OP2 in the
alloc pools and return it. */
static tree
poolify_modify_expr (tree type, tree op1, tree op2)
{
if (modify_expr_template == NULL)
modify_expr_template = build2 (MODIFY_EXPR, type, op1, op2);
TREE_OPERAND (modify_expr_template, 0) = op1;
TREE_OPERAND (modify_expr_template, 1) = op2;
TREE_TYPE (modify_expr_template) = type;
return poolify_tree (modify_expr_template);
}
/* For each real store operation of the form
*a = <value> that we see, create a corresponding fake store of the
form storetmp_<version> = *a.
This enables AVAIL computation to mark the results of stores as
available. Without this, you'd need to do some computation to
mark the result of stores as ANTIC and AVAIL at all the right
points.
To save memory, we keep the store
statements pool allocated until we decide whether they are
necessary or not. */
static void
insert_fake_stores (void)
{
basic_block block;
FOR_ALL_BB (block)
{
block_stmt_iterator bsi;
for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
/* We can't generate SSA names for stores that are complex
or aggregate. We also want to ignore things whose
virtual uses occur in abnormal phis. */
if (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == INDIRECT_REF
&& !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 0)))
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (stmt, 0))) != COMPLEX_TYPE)
{
ssa_op_iter iter;
def_operand_p defp;
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
tree new;
bool notokay = false;
FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_VIRTUAL_DEFS)
{
tree defvar = DEF_FROM_PTR (defp);
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (defvar))
{
notokay = true;
break;
}
}
if (notokay)
continue;
if (!storetemp || TREE_TYPE (rhs) != TREE_TYPE (storetemp))
{
storetemp = create_tmp_var (TREE_TYPE (rhs), "storetmp");
get_var_ann (storetemp);
}
new = poolify_modify_expr (TREE_TYPE (stmt), storetemp, lhs);
lhs = make_ssa_name (storetemp, new);
TREE_OPERAND (new, 0) = lhs;
create_ssa_artficial_load_stmt (new, stmt);
NECESSARY (new) = 0;
VEC_safe_push (tree, heap, inserted_exprs, new);
VEC_safe_push (tree, heap, need_creation, new);
bsi_insert_after (&bsi, new, BSI_NEW_STMT);
}
}
}
}
/* Turn the pool allocated fake stores that we created back into real
GC allocated ones if they turned out to be necessary to PRE some
expressions. */
static void
realify_fake_stores (void)
{
unsigned int i;
tree stmt;
for (i = 0; VEC_iterate (tree, need_creation, i, stmt); i++)
{
if (NECESSARY (stmt))
{
block_stmt_iterator bsi;
tree newstmt;
/* Mark the temp variable as referenced */
re PR c++/26757 (C++ front-end producing two DECLs with the same UID) 2006-05-23 Andrew MacLeod <amacleod@redhat.com> PR c++/26757 * tree-ssa-loop-im.c (determine_invariantness_stmt): Use add_referenced_var instead of add_referenced_tmp_var. * tree-complex.c (create_one_component_var): Use add_referenced_var. * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use add_referenced_var. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value, tree_optimize_tail_calls_1): Use add_referenced_var. * tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var. * tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft): Use add_referenced_var. * tree-if-conv.c (ifc_temp_var): Use add_referenced_var. * gimplify.c (force_gimple_operand): Use add_referenced_var. * tree-ssa-phiopt.c (conditional_replacement, abs_replacement): Use add_referenced_var. * tree-dfa.c (struct walk_state): Remove. (find_referenced_vars): Remove walk state and vars_found hash table. (make_rename_temp): Use add_referenced_var. (find_vars_r): Pass less parameters to add_referenced_var. (referenced_var_p): New. Is var in referenced_var hash table. (referenced_var_insert): Assert var isn't already in hash table. (add_referenced_var): Don't need walk_state parameter. Add var if it isn't already in the hash table. (add_referenced_tmp_var): Remove. (find_new_referenced_vars_1): Use add_referenced_var. * tree-ssa-pre.c (create_expression_by_pieces, insert_into_preds_of_block, insert_extra_phis, realify_fake_stores): Use add_referenced_var. * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var. * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use add_referenced_var. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_create_destination_var, vect_init_vector, vect_build_loop_niters, vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks): Use add_referenced_var. * tree-outof-ssa.c (create_temp): Use add_referenced_var. * tree-flow.h (add_referenced_tmp_var): Remove prototype (add_referenced_var): Add prototype. * tree-ssa-structalias.c (get_constraint_for, intra_create_variable_infos): Use add_referenced_var. From-SVN: r114018
2006-05-23 16:07:21 +02:00
add_referenced_var (SSA_NAME_VAR (TREE_OPERAND (stmt, 0)));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2006-07-04 23:23:03 +02:00
/* Put the new statement in GC memory, fix up the
SSA_NAME_DEF_STMT on it, and then put it in place of
the old statement before the store in the IR stream
as a plain ssa name copy. */
bsi = bsi_for_stmt (stmt);
bsi_prev (&bsi);
newstmt = build2 (MODIFY_EXPR, void_type_node,
TREE_OPERAND (stmt, 0),
TREE_OPERAND (bsi_stmt (bsi), 1));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
SSA_NAME_DEF_STMT (TREE_OPERAND (newstmt, 0)) = newstmt;
bsi_insert_before (&bsi, newstmt, BSI_SAME_STMT);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
bsi = bsi_for_stmt (stmt);
bsi_remove (&bsi, true);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
else
release_defs (stmt);
}
}
/* Tree-combine a value number expression *EXPR_P that does a type
conversion with the value number expression of its operand.
Returns true, if *EXPR_P simplifies to a value number or
gimple min-invariant expression different from EXPR_P and
sets *EXPR_P to the simplified expression value number.
Otherwise returns false and does not change *EXPR_P. */
static bool
try_combine_conversion (tree *expr_p)
{
tree expr = *expr_p;
tree t;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset;
unsigned int firstbit;
if (!((TREE_CODE (expr) == NOP_EXPR
|| TREE_CODE (expr) == CONVERT_EXPR)
&& TREE_CODE (TREE_OPERAND (expr, 0)) == VALUE_HANDLE
&& !VALUE_HANDLE_VUSES (TREE_OPERAND (expr, 0))))
return false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
exprset = VALUE_HANDLE_EXPR_SET (TREE_OPERAND (expr, 0));
firstbit = bitmap_first_set_bit (exprset->expressions);
t = fold_unary (TREE_CODE (expr), TREE_TYPE (expr),
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
expression_for_id (firstbit));
if (!t)
return false;
/* Strip useless type conversions, which is safe in the optimizers but
not generally in fold. */
STRIP_USELESS_TYPE_CONVERSION (t);
/* Disallow value expressions we have no value number for already, as
we would miss a leader for it here. */
if (!(TREE_CODE (t) == VALUE_HANDLE
|| is_gimple_min_invariant (t)))
t = vn_lookup (t, NULL);
if (t && t != expr)
{
*expr_p = t;
return true;
}
return false;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Compute the AVAIL set for all basic blocks.
This function performs value numbering of the statements in each basic
block. The AVAIL sets are built from information we glean while doing
this value numbering, since the AVAIL sets contain only one entry per
value.
2006-07-04 23:23:03 +02:00
AVAIL_IN[BLOCK] = AVAIL_OUT[dom(BLOCK)].
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
AVAIL_OUT[BLOCK] = AVAIL_IN[BLOCK] U PHI_GEN[BLOCK] U TMP_GEN[BLOCK]. */
static void
compute_avail (void)
{
basic_block block, son;
basic_block *worklist;
size_t sp = 0;
tree param;
/* For arguments with default definitions, we pretend they are
defined in the entry block. */
for (param = DECL_ARGUMENTS (current_function_decl);
param;
param = TREE_CHAIN (param))
{
if (default_def (param) != NULL)
{
tree def = default_def (param);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
vn_lookup_or_add (def, NULL);
bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), def);
if (!in_fre)
bitmap_value_insert_into_set (maximal_set, def);
bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), def);
}
}
/* Likewise for the static chain decl. */
if (cfun->static_chain_decl)
{
param = cfun->static_chain_decl;
if (default_def (param) != NULL)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
tree def = default_def (param);
vn_lookup_or_add (def, NULL);
bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), def);
if (!in_fre)
bitmap_value_insert_into_set (maximal_set, def);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), def);
}
}
/* Allocate the worklist. */
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
worklist = XNEWVEC (basic_block, n_basic_blocks);
/* Seed the algorithm by putting the dominator children of the entry
block on the worklist. */
for (son = first_dom_son (CDI_DOMINATORS, ENTRY_BLOCK_PTR);
son;
son = next_dom_son (CDI_DOMINATORS, son))
worklist[sp++] = son;
/* Loop until the worklist is empty. */
while (sp)
{
block_stmt_iterator bsi;
tree stmt, phi;
basic_block dom;
unsigned int stmt_uid = 1;
/* Pick a block from the worklist. */
block = worklist[--sp];
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Initially, the set of available values in BLOCK is that of
its immediate dominator. */
dom = get_immediate_dominator (CDI_DOMINATORS, block);
if (dom)
bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Generate values for PHI nodes. */
for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
/* We have no need for virtual phis, as they don't represent
actual computations. */
if (is_gimple_reg (PHI_RESULT (phi)))
{
add_to_sets (PHI_RESULT (phi), PHI_RESULT (phi), NULL,
PHI_GEN (block), AVAIL_OUT (block));
}
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Now compute value numbers and populate value sets with all
the expressions computed in BLOCK. */
for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
{
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
stmt_ann_t ann;
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
ssa_op_iter iter;
tree op;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
stmt = bsi_stmt (bsi);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
ann = stmt_ann (stmt);
2006-07-04 23:23:03 +02:00
ann->uid = stmt_uid++;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* For regular value numbering, we are only interested in
assignments of the form X_i = EXPR, where EXPR represents
an "interesting" computation, it has no volatile operands
and X_i doesn't flow through an abnormal edge. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (TREE_CODE (stmt) == RETURN_EXPR
&& !ann->has_volatile_ops)
{
tree realstmt = stmt;
tree lhs;
tree rhs;
stmt = TREE_OPERAND (stmt, 0);
if (stmt && TREE_CODE (stmt) == MODIFY_EXPR)
{
lhs = TREE_OPERAND (stmt, 0);
rhs = TREE_OPERAND (stmt, 1);
if (TREE_CODE (rhs) == SSA_NAME
&& !is_undefined_value (rhs))
bitmap_value_insert_into_set (EXP_GEN (block), rhs);
FOR_EACH_SSA_TREE_OPERAND (op, realstmt, iter, SSA_OP_DEF)
add_to_sets (op, op, NULL, TMP_GEN (block),
AVAIL_OUT (block));
}
continue;
}
else if (TREE_CODE (stmt) == MODIFY_EXPR
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
&& !ann->has_volatile_ops
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (stmt, 0)))
{
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
/* Try to look through loads. */
if (TREE_CODE (lhs) == SSA_NAME
&& !ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_USES)
&& try_look_through_load (lhs, rhs, stmt, block))
continue;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
STRIP_USELESS_TYPE_CONVERSION (rhs);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (can_value_number_operation (rhs))
{
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* For value numberable operation, create a
duplicate expression with the operands replaced
with the value handles of the original RHS. */
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
tree newt = create_value_expr_from (rhs, block, stmt);
if (newt)
{
/* If we can combine a conversion expression
with the expression for its operand just
record the value number for it. */
if (try_combine_conversion (&newt))
vn_add (lhs, newt);
else
{
tree val = vn_lookup_or_add (newt, stmt);
vn_add (lhs, val);
if (!in_fre)
bitmap_value_insert_into_set (maximal_set, newt);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (EXP_GEN (block), newt);
}
bitmap_insert_into_set (TMP_GEN (block), lhs);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
continue;
}
}
else if ((TREE_CODE (rhs) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
|| TREE_INVARIANT (rhs)
|| DECL_P (rhs))
{
/* Compute a value number for the RHS of the statement
and add its value to the AVAIL_OUT set for the block.
Add the LHS to TMP_GEN. */
2006-07-04 23:23:03 +02:00
add_to_sets (lhs, rhs, stmt, TMP_GEN (block),
AVAIL_OUT (block));
2006-07-04 23:23:03 +02:00
if (TREE_CODE (rhs) == SSA_NAME
&& !is_undefined_value (rhs))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (EXP_GEN (block), rhs);
continue;
2006-07-04 23:23:03 +02:00
}
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* For any other statement that we don't recognize, simply
make the names generated by the statement available in
AVAIL_OUT and TMP_GEN. */
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
add_to_sets (op, op, NULL, TMP_GEN (block), AVAIL_OUT (block));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
add_to_sets (op, op, NULL, NULL , AVAIL_OUT (block));
}
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
son;
son = next_dom_son (CDI_DOMINATORS, son))
worklist[sp++] = son;
}
free (worklist);
}
/* Eliminate fully redundant computations. */
static void
eliminate (void)
{
basic_block b;
FOR_EACH_BB (b)
{
block_stmt_iterator i;
2006-07-04 23:23:03 +02:00
for (i = bsi_start (b); !bsi_end_p (i); bsi_next (&i))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
tree stmt = bsi_stmt (i);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Lookup the RHS of the expression, see if we have an
available computation for it. If so, replace the RHS with
the available computation. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == SSA_NAME
&& TREE_CODE (TREE_OPERAND (stmt ,1)) != SSA_NAME
&& !is_gimple_min_invariant (TREE_OPERAND (stmt, 1))
&& !stmt_ann (stmt)->has_volatile_ops)
{
tree lhs = TREE_OPERAND (stmt, 0);
tree *rhs_p = &TREE_OPERAND (stmt, 1);
tree sprime;
sprime = bitmap_find_leader (AVAIL_OUT (b),
vn_lookup (lhs, NULL));
2006-07-04 23:23:03 +02:00
if (sprime
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
&& sprime != lhs
&& (TREE_CODE (*rhs_p) != SSA_NAME
|| may_propagate_copy (*rhs_p, sprime)))
{
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (sprime != *rhs_p);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Replaced ");
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
print_generic_expr (dump_file, *rhs_p, 0);
fprintf (dump_file, " with ");
print_generic_expr (dump_file, sprime, 0);
fprintf (dump_file, " in ");
print_generic_stmt (dump_file, stmt, 0);
}
2006-07-04 23:23:03 +02:00
if (TREE_CODE (sprime) == SSA_NAME)
NECESSARY (SSA_NAME_DEF_STMT (sprime)) = 1;
/* We need to make sure the new and old types actually match,
which may require adding a simple cast, which fold_convert
will do for us. */
if (TREE_CODE (*rhs_p) != SSA_NAME
&& !tree_ssa_useless_type_conversion_1 (TREE_TYPE (*rhs_p),
TREE_TYPE (sprime)))
sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
2006-07-04 23:23:03 +02:00
pre_stats.eliminations++;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
propagate_tree_value (rhs_p, sprime);
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt. 2005-04-05 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt. Use immediate use iterator. (stmt_is_bumper_for_loop): Use immediate use iterator. * predict.c (strip_builtin_expect): Use update_stmt. * tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified on all elements of a STATEMENT_LIST. (bsi_insert_before, bsi_insert_after): Call update_modified_stmts. (bsi_remove): Remove imm_use links and mark the stmt as modified. (bsi_replace): Mark stmt as modified and the update it. * tree-complex.c (update_complex_assignment): Call mark_stmt_modified. (expand_complex_libcal): Call update_stmt. (expand_complex_comparison): Call mark_stmt_modified. (expand_complex_operations_1): Call update_stmt_if_modified. (expand_vector_operations_1): Call mark_stmt_modified. * tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df, compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, add_immediate_use, redirect_immediate_use, redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses, dump_immediate_uses_for, debug_immediate_uses_for): Delete. (mark_new_vars_to_rename): Call update_stmt. * tree-dump.c (dump_option_value_in): Add "stmtaddr". * tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified. Ignore PHI nodes. (unmodify_stmt): Delete. (update_stmt): New. Force an update of a stmt. (update_stmt_if_modified): update a stmt if it is out of date. (get_stmt_operands): Verify stmt is NOT modified. (stmt_modified_p): Update comment. (delink_imm_use): Remove a use node from its immuse list. (link_imm_use_to_list): Link a use node to a specific list. (link_imm_use): Link a node to the correct list. (set_ssa_use_from_ptr): Set a use node to a specific value, and insert it in the correct list, if appropriate. (link_imm_use_stmt): Link a use node, and set the stmt pointer. (relink_imm_use): Link a use node in place of another node in a list. (relink_imm_use_stmt): LInk a node in place of another node, and set the stmt pointer. (end_safe_imm_use_traverse): New. Terminate a safe immuse iterator. (end_safe_imm_use_p): New. Check for the end of a safe immuse iterator. (first_safe_imm_use): New. Initialize a safe immuse iterator. (next_safe_imm_use): New. Proceed to next safe immuse iterator value. (end_readonly_imm_use_p): New. Check for end of a fast immuse iterator. (first_readonly_imm_use): New. Initialize a fast immuse iterator. (next_readonly_imm_use): New. Get the next fast immuse iterator value. (has_zero_uses): New. Return true if there are no uses of a var. (has_single_use): New. Return true if there is only a single use of a variable. (single_imm_use): New. Return the simgle immediate use. (num_imm_uses): New. Return the number of immediate uses. (get_v_must_def_ops): Use is now a pointer. (use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of the use node. (get_immediate_uses, num_immediate_uses, immediate_use): Delete. (delink_stmt_imm_use): Delink all immuses from a stmt. (phi_arg_index_from_use): New. Return a phi arg index for a use. * tree-flow.h (struct dataflow_d): Delete. (immediate_use_iterator_d): New. Immediate use iterator struct. (FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration. (FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration. (BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe iteration. (struct stmt_ann_d): Remove dataflow_t from struct. * tree-if-conv.c (tree_if_conversion). Don't call free_df. (if_convertible_phi_p): Use FAST immuse iterator. (if_convertible_loop_p): Don't call compute_immediate_uses. (replace_phi_with_cond_modify_expr): Call update_stmt. * tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call update_stmt_if_modified. (rewrite_all_into_ssa): Initialize ssa operands. * tree-loop-linear.c (linear_transform_loops): Don't call free_df or compute_immediate_uses. * tree-optimize.c (execute_todo): Call verify_ssa whenever the ssa_property is available. (execute_one_pass): Change parameters passed to execute_todo. * tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt. (remove_ssa_form): Call fini_ssa_operands. (insert_backedge_copies): Delete call to modify_stmt. * tree-phinodes.c (make_phi_node): Initialize use nodes. (release_phi_node): Delink any use nodes before releasing. (resize_phi_node): Relink any use nodes. (remove_phi_arg_num): Delink the use node. (remove_phi_node): Release the ssa_name AFTER releasing the phi node. (remove_all_phi_nodes_for): Release phi node first. * tree-pretty-print.c (dump_generic_node): Print stmt address. * tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified. (scalarize_use, scalarize_copy): Call update_stmt. * tree-ssa-alias.c (compute_may_aliases): Update all modified stmts. (compute_points_to_and_addr_escape): Call mark_stmt_modified. * tree-ssa-cpp.c (need_imm_uses_for): Delete. (ccp_initialize): Remove call to compute_immediate_uses. (substitute_and_fold, execute_fold_all_builtins): Call update_stmt. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified stmts. (simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified. (simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified. (eliminate_redundant_computations): Call mark_stmt_modified. (cprop_operand): Call mark_stmt_modified. (optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified. * tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete. (dse_optimize_stmt): Use new immuse interface. (tree_ssa_dse): Remove calls to compute_immediate_uses and free_df. * tree-ssa-forwprop.c (need_imm_uses_for): Delete. (substitute_single_use_vars): Use new immuse interface. (tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df and compute_immediate_uses. * tree-ssa-loop-im.c (single_reachable_address): Use new immuse interface. (rewrite_mem_refs): Call update_stmt. (determine_lsm): Remove call to compute_imm_uses and free_df. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt. (try_unroll_loop_completely): Call update_stmt. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt. (rewrite_use_compare): Call update_stmt. (compute_phi_arg_on_exit): Insert each stmt before trying to process. (rewrite_use) : Call update_stmt. * tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call update_stmt. * tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration. (allocate_use_optype, allocate_vuse_optype): Adjust allocation size. (free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink use nodes. (initialize_vuse_operand): New. Initialize a vuse operand. (initialize_v_may_def_operand): New. Initialize a maydef operand. (initialize_v_must_def_operand): New. Initialize a mustdef operand. (finalize_ssa_defs): Use stmt parameter. (correct_use_link): Ensure a use node is in the correct list, and has the correct stmt pointer. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): Also initialize use nodes. (finalize_ssa_stmt_operands): Pass extra stmt operands. (build_ssa_operands): Seperate parsing from final operand construction. (parse_ssa_operands): New. Parse entry point for operand building. (swap_tree_operands): New. Swap 2 tree operands. (update_stmt_operands): Ranamed from get_stmt_operands. Always builds operands. (get_expr_operands): Call swap_tree_operands when needed. (copy_virtual_operands): Use initialize routines for virtual use ops. (create_ssa_artficial_load_stmt): Add extra stmt parameter. (verify_abort): New. Issue imm_use error. (verify_imm_links): New Verify imm_use links for a var. (dump_immediate_uses_for): New. Dump imm_uses for a var to file. (dump_immediate_uses): New. Dump imm_uses for all vars to file. (debug_immediate_uses): New. Dump imm_uses for all vars to stderr. (debug_immediate_uses_for): New. Dump imm_uses for a var to stderr. * tree-ssa-operands.h (struct use_operand_ptr): Delete. (NULL_USE_OPERAND_P) Define. (use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate use node. (struct vuse_operand_type): New struct. (SET_USE): Call set_ssa_use_from_ptr. (USE_STMT): Define. (PHI_ARG_INDEX_FROM_USE): Define. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi argument via SET_USE, not PHI_ARG_DEF_TREE. * tree-ssa-pre.c (eliminate): Call update_stmt. * tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't call free_df. * tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator. (nearest_common_dominator_of_uses): Use imm_use iterator. (statement_sink_location): Use imm_use iterator and interface. (execute_sink_code): Don't call compute_immediate_uses or free-df. * tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use PHI_ARG_DEF, not PHI_ARG_DEF_TREE. * tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info. (verify_ssa): Ensure no stmt is marked modify after optimization pass if new parameter is true. (init_tree_ssa): Don't initialize operand cache here. (delete_tree_ssa): Don't destroy operand cache here. (propagate_into_addr): Pass in a use pointer, return true if anything was changed. (replace_immediate_uses): Use imm_use iterator, call update_stmt. (check_phi_redundancy): Use imm_use iterator. (kill_redundant_phi_nodes): Don't call compute_immediate_uses or free_df. * tree-ssanames.c (make_ssa_name): Initialize imm_use node. (release_ssa_name): Delink node and all elements in its imm_use list. * tree-tailcall.c (adjust_return_value): Call update_stmt. * tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator. * tree-vectorizer.c (need_imm_uses_for): Delete. (vectorize_loops): Dont call compute_immediate_uses or free_df. * tree.h (struct ssa_imm_use_d): Define. (SSA_NAME_IMM_USE_NODE): Define. (struct tree_ssa_name): Add imm_use node. (PHI_DF): Delete. (PHI_ARG_IMM_USE_NODE): Define. (struct phi_arg_d): Add imm_use node. (struct tree_phi_node): Remove struct dataflow_d element. (TDF_STMTADDR): Define. From-SVN: r97648
2005-04-05 21:05:20 +02:00
update_stmt (stmt);
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
/* If we removed EH side effects from the statement, clean
its EH information. */
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
{
bitmap_set_bit (need_eh_cleanup,
bb_for_stmt (stmt)->index);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Removed EH side effects.\n");
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
}
}
/* Borrow a bit of tree-ssa-dce.c for the moment.
XXX: In 4.1, we should be able to just run a DCE pass after PRE, though
this may be a bit faster, and we may want critical edges kept split. */
/* If OP's defining statement has not already been determined to be necessary,
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
mark that statement necessary. Return the stmt, if it is newly
2006-07-04 23:23:03 +02:00
necessary. */
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
static inline tree
mark_operand_necessary (tree op)
{
tree stmt;
gcc_assert (op);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (op) != SSA_NAME)
return NULL;
stmt = SSA_NAME_DEF_STMT (op);
gcc_assert (stmt);
if (NECESSARY (stmt)
|| IS_EMPTY_STMT (stmt))
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
return NULL;
NECESSARY (stmt) = 1;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
return stmt;
}
/* Because we don't follow exactly the standard PRE algorithm, and decide not
to insert PHI nodes sometimes, and because value numbering of casts isn't
perfect, we sometimes end up inserting dead code. This simple DCE-like
pass removes any insertions we made that weren't actually used. */
static void
remove_dead_inserted_code (void)
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC(tree,heap) *worklist = NULL;
int i;
tree t;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
worklist = VEC_alloc (tree, heap, VEC_length (tree, inserted_exprs));
for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (NECESSARY (t))
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_quick_push (tree, worklist, t);
}
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
while (VEC_length (tree, worklist) > 0)
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
t = VEC_pop (tree, worklist);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* PHI nodes are somewhat special in that each PHI alternative has
data and control dependencies. All the statements feeding the
PHI node's arguments are always necessary. */
if (TREE_CODE (t) == PHI_NODE)
{
int k;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_reserve (tree, heap, worklist, PHI_NUM_ARGS (t));
for (k = 0; k < PHI_NUM_ARGS (t); k++)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
tree arg = PHI_ARG_DEF (t, k);
if (TREE_CODE (arg) == SSA_NAME)
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
{
arg = mark_operand_necessary (arg);
if (arg)
VEC_quick_push (tree, worklist, arg);
}
}
}
else
{
/* Propagate through the operands. Examine all the USE, VUSE and
2006-07-04 23:23:03 +02:00
V_MAY_DEF operands in this statement. Mark all the statements
which feed this statement's uses as necessary. */
ssa_op_iter iter;
tree use;
/* The operands of V_MAY_DEF expressions are also needed as they
represent potential definitions that may reach this
2006-07-04 23:23:03 +02:00
statement (V_MAY_DEF operands allow us to follow def-def
links). */
FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
{
tree n = mark_operand_necessary (use);
if (n)
VEC_safe_push (tree, heap, worklist, n);
}
}
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (!NECESSARY (t))
{
block_stmt_iterator bsi;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Removing unnecessary insertion:");
print_generic_stmt (dump_file, t, 0);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (t) == PHI_NODE)
{
remove_phi_node (t, NULL);
}
else
{
bsi = bsi_for_stmt (t);
tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. * tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last change (stmt -> orig_stmt). * tree-eh.c (verify_eh_throw_stmt_node): New function. (bsi_remove): Add new argument. Remove EH information if requested. (verify_eh_throw_table_statements): New function. (bsi_remove): Add new argument REMOVE_EH_INFO. All callers updated. * tree-optimize.c (execute_free_cfg_annotations): Verify the EH throw statement table after removing annotations. * except.h (verify_eh_throw_table_statements): Prototype. * tree-flow.h (bsi_remove): Update prototype. * tree-vrp.c (remove_range_assertions): Add new argument to bsi_remove call. * tree-ssa-loop-im.c (move_computations_stmt): Likewise. * tree-complex.c (expand_complex_div_wide): Likewise. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise * tree-tailcall.c (eliminate_tailcall): Likewise. * tree-ssa-dse.c (dse_optimize_stmt): Likewise. * tree-ssa-loop-ivopts.c (remove_statement): Likewise. * tree-nrv.c (tree_nrv): Likewise. * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise. * tree-if-conv.c (tree_if_convert_cond_expr): Likewise. (combine_blocks): Likewise. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise. * tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise. (cleanup_control_flow): Likewise. (remove_forwarder_block): Likewise. * tree-ssa-pre.c (remove_dead_inserted_code): Likewise. * tree-sra.c (sra_replace): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise. (forward_propagate_single_use_vars): Likewise. * tree-ssa-dce.c (remove_dead_stmt): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-vect-transform.c (vect_transform_loop): Likewise. * tree-outof-ssa.c (rewrite_trees): Likewise. * tree-cfg.c (make_goto_expr_edges): Likewise. (cleanup_dead_labels): Likewise. (tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise. (bsi_move_before, bsi_move_after): Likewise. (bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise (tree_redirect_edge_and_branch, tree_split_block): Likewise. From-SVN: r109421
2006-01-06 18:50:26 +01:00
bsi_remove (&bsi, true);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
release_defs (t);
}
}
}
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_free (tree, heap, worklist);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Initialize data structures used by PRE. */
static void
init_pre (bool do_fre)
{
basic_block bb;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
next_expression_id = 0;
expressions = NULL;
in_fre = do_fre;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
inserted_exprs = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
need_creation = NULL;
pretemp = NULL_TREE;
storetemp = NULL_TREE;
mergephitemp = NULL_TREE;
prephitemp = NULL_TREE;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
vn_init ();
if (!do_fre)
tree-vrp.c (execute_vrp): Do not update current_loops. * tree-vrp.c (execute_vrp): Do not update current_loops. * loop-unswitch.c (unswitch_loop): Do not use loop_split_edge_with. * doc/loop.texi: Remove documentation for cancelled functions. * tree-ssa-loop-im.c (loop_commit_inserts): Removed. (move_computations, determine_lsm): Use bsi_commit_edge_inserts instead. * cfgloopmanip.c (remove_bbs): Do not update loops explicitly. (remove_path): Ensure that in delete_basic_blocks, the loops are still allocated. (add_loop): Work on valid loop structures. (loopify): Modify call of add_loop. (mfb_update_loops): Removed. (create_preheader): Do not update loops explicitly. (force_single_succ_latches, loop_version): Do not use loop_split_edge_with. (loop_split_edge_with): Removed. * tree-ssa-loop-manip.c (create_iv, determine_exit_conditions): Do not use bsi_insert_on_edge_immediate_loop. (split_loop_exit_edge, tree_unroll_loop): Do not use loop_split_edge_with. (bsi_insert_on_edge_immediate_loop): Removed. * tree-ssa-loop-ch.c (copy_loop_headers): Use current_loops. Do not use loop_split_edge_with. * cfghooks.c: Include cfgloop.h. (verify_flow_info): Verify that loop_father is filled iff current_loops are available. (redirect_edge_and_branch_force, split_block, delete_basic_block, split_edge, merge_blocks, make_forwarder_block, duplicate_block): Update cfg. * cfgloopanal.c (mark_irreducible_loops): Work if the function contains no loops. * modulo-sched.c (generate_prolog_epilog, canon_loop): Do not use loop_split_edge_with. (sms_schedule): Use current_loops. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Use current_loops. * loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Set current_loops. (rtl_loop_init, rtl_loop_done): Do not set current_loops. * tree-ssa-sink.c (execute_sink_code): Use current_loops. * ifcvt.c (if_convert): Ditto. * predict.c (predict_loops): Do not clear current_loops. (tree_estimate_probability): Use current_loops. (propagate_freq): Receive head of the region to propagate instead of loop. (estimate_loops_at_level): Do not use shared to_visit bitmap. (estimate_loops): New function. Handle case current_loops == NULL. (estimate_bb_frequencies): Do not allocate tovisit. Use estimate_loops. * tree-ssa-loop.c (current_loops): Removed. (tree_loop_optimizer_init): Do not return loops. (tree_ssa_loop_init, tree_ssa_loop_done): Do not set current_loops. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge): Do not update loops explicitly. * function.h (struct function): Add x_current_loops field. (current_loops): New macro. * tree-if-conv.c (combine_blocks): Do not update loops explicitly. * loop-unroll.c (split_edge_and_insert): New function. (unroll_loop_runtime_iterations, analyze_insns_in_loop): Do not use loop_split_edge_with. * loop-doloop.c (add_test, doloop_modify): Ditto. * tree-ssa-pre.c (init_pre, fini_pre): Do not set current_loops. * cfglayout.c (copy_bbs): Do not update loops explicitly. * lambda-code.c (perfect_nestify): Do not use loop_split_edge_with. * tree-vect-transform.c (vect_transform_loop): Do not update loops explicitly. * cfgloop.c (flow_loops_cfg_dump): Do not dump dfs_order and rc_order. (flow_loops_free): Do not free dfs_order and rc_order. (flow_loops_find): Do not set dfs_order and rc_order in loops structure. Do not call loops and flow info verification. (add_bb_to_loop, remove_bb_from_loops): Check whether the block already belongs to some loop. * cfgloop.h (struct loops): Remove struct cfg. (current_loops, loop_split_edge_with): Declaration removed. (loop_optimizer_init, loop_optimizer_finalize): Declaration changed. * tree-flow.h (loop_commit_inserts, bsi_insert_on_edge_immediate_loop): Declaration removed. * Makefile.in (cfghooks.o): Add CFGLOOP_H dependency. * basic-block.h (split_edge_and_insert): Declare. * tree-cfg.c (remove_bb): Do not update loops explicitly. From-SVN: r118931
2006-11-17 12:29:17 +01:00
loop_optimizer_init (LOOPS_NORMAL);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
connect_infinite_loops_to_exit ();
memset (&pre_stats, 0, sizeof (pre_stats));
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
post_order_compute (postorder, false);
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
FOR_ALL_BB (bb)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bb->aux = xcalloc (1, sizeof (struct bb_bitmap_sets));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
calculate_dominance_info (CDI_POST_DOMINATORS);
calculate_dominance_info (CDI_DOMINATORS);
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
bitmap_obstack_initialize (&grand_bitmap_obstack);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_translate_table = htab_create (5110, expr_pred_trans_hash,
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
expr_pred_trans_eq, free);
bitmap_set_pool = create_alloc_pool ("Bitmap sets",
sizeof (struct bitmap_set), 30);
binary_node_pool = create_alloc_pool ("Binary tree nodes",
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree_code_size (PLUS_EXPR), 30);
unary_node_pool = create_alloc_pool ("Unary tree nodes",
tree_code_size (NEGATE_EXPR), 30);
reference_node_pool = create_alloc_pool ("Reference tree nodes",
tree_code_size (ARRAY_REF), 30);
expression_node_pool = create_alloc_pool ("Expression tree nodes",
tree_code_size (CALL_EXPR), 30);
list_node_pool = create_alloc_pool ("List tree nodes",
2006-07-04 23:23:03 +02:00
tree_code_size (TREE_LIST), 30);
comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree_code_size (EQ_EXPR), 30);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
modify_expr_node_pool = create_alloc_pool ("MODIFY_EXPR nodes",
tree_code_size (MODIFY_EXPR),
30);
modify_expr_template = NULL;
FOR_ALL_BB (bb)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
EXP_GEN (bb) = bitmap_set_new ();
PHI_GEN (bb) = bitmap_set_new ();
TMP_GEN (bb) = bitmap_set_new ();
AVAIL_OUT (bb) = bitmap_set_new ();
}
maximal_set = in_fre ? NULL : bitmap_set_new ();
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
need_eh_cleanup = BITMAP_ALLOC (NULL);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Deallocate data structures used by PRE. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static void
fini_pre (bool do_fre)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
basic_block bb;
unsigned int i;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
free (postorder);
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_free (tree, heap, inserted_exprs);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
VEC_free (tree, heap, need_creation);
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
bitmap_obstack_release (&grand_bitmap_obstack);
free_alloc_pool (bitmap_set_pool);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
free_alloc_pool (binary_node_pool);
free_alloc_pool (reference_node_pool);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
free_alloc_pool (unary_node_pool);
free_alloc_pool (list_node_pool);
free_alloc_pool (expression_node_pool);
free_alloc_pool (comparison_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
free_alloc_pool (modify_expr_node_pool);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
htab_delete (phi_translate_table);
remove_fake_exit_edges ();
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
FOR_ALL_BB (bb)
{
free (bb->aux);
bb->aux = NULL;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
free_dominance_info (CDI_POST_DOMINATORS);
vn_delete ();
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
bitmap.h (bitmap_empty_p): New. * bitmap.h (bitmap_empty_p): New. (bitmap_and, bitmap_and_into, bitmap_and_compl, bitmap_and_compl_into, bitmap_ior, bitmap_ior_into, bitmap_ior_compl, bitmap_xor, bitmap_xor_into): New bitmap operation macros. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. * bitmap.c (bitmap_equal_p): Use bitmap_xor. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. Adjust. Return changed flag. (bitmap_union_of_diff): Use renamed bitmap functions. * basic-block.h (AND_REG_SET, AND_COMPL_REG_SET, IOR_REG_SET, XOR_REG_SET, IOR_AND_COMPL_REG_SET): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * df.c (df_bb_rd_local_compute) * flow.c (calculate_global_regs_live, init_propagate_block_info): Likewise. * ifcvt.c (find_if_case_1, find_if_case_2, dead_or_predicable): Likewise. * ra-build.c (union_web_part_roots, livethrough_conflicts_bb, reset_conflicts, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. * tree-int-ssa.c (insert_phi_nodes_for, rewrite_into_ssa): Likewise. * tree-sra.c (decide_instantiations): Likewise. * tree-ssa-alias.c (create_name_tags, merge_pointed_to_info): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-loop-im.c (move_computations): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Likewise. * tree-ssa-pre.c (fini_pre): Likewise. * tree-ssa.c (verify_flow_sensitive_alias_info): Likewise. * tree-ssanames.c (any_marked_for_rewrite_p): Likewise. * tree-vectorizer.c (vectorize_loops): Likewise. From-SVN: r89827
2004-10-29 10:41:10 +02:00
if (!bitmap_empty_p (need_eh_cleanup))
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
{
tree_purge_all_dead_eh_edges (need_eh_cleanup);
cleanup_tree_cfg ();
}
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
BITMAP_FREE (need_eh_cleanup);
/* Wipe out pointers to VALUE_HANDLEs. In the not terribly distant
future we will want them to be persistent though. */
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (!name)
continue;
if (SSA_NAME_VALUE (name)
&& TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
SSA_NAME_VALUE (name) = NULL;
}
if (!do_fre && current_loops)
tree-vrp.c (execute_vrp): Do not update current_loops. * tree-vrp.c (execute_vrp): Do not update current_loops. * loop-unswitch.c (unswitch_loop): Do not use loop_split_edge_with. * doc/loop.texi: Remove documentation for cancelled functions. * tree-ssa-loop-im.c (loop_commit_inserts): Removed. (move_computations, determine_lsm): Use bsi_commit_edge_inserts instead. * cfgloopmanip.c (remove_bbs): Do not update loops explicitly. (remove_path): Ensure that in delete_basic_blocks, the loops are still allocated. (add_loop): Work on valid loop structures. (loopify): Modify call of add_loop. (mfb_update_loops): Removed. (create_preheader): Do not update loops explicitly. (force_single_succ_latches, loop_version): Do not use loop_split_edge_with. (loop_split_edge_with): Removed. * tree-ssa-loop-manip.c (create_iv, determine_exit_conditions): Do not use bsi_insert_on_edge_immediate_loop. (split_loop_exit_edge, tree_unroll_loop): Do not use loop_split_edge_with. (bsi_insert_on_edge_immediate_loop): Removed. * tree-ssa-loop-ch.c (copy_loop_headers): Use current_loops. Do not use loop_split_edge_with. * cfghooks.c: Include cfgloop.h. (verify_flow_info): Verify that loop_father is filled iff current_loops are available. (redirect_edge_and_branch_force, split_block, delete_basic_block, split_edge, merge_blocks, make_forwarder_block, duplicate_block): Update cfg. * cfgloopanal.c (mark_irreducible_loops): Work if the function contains no loops. * modulo-sched.c (generate_prolog_epilog, canon_loop): Do not use loop_split_edge_with. (sms_schedule): Use current_loops. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Use current_loops. * loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Set current_loops. (rtl_loop_init, rtl_loop_done): Do not set current_loops. * tree-ssa-sink.c (execute_sink_code): Use current_loops. * ifcvt.c (if_convert): Ditto. * predict.c (predict_loops): Do not clear current_loops. (tree_estimate_probability): Use current_loops. (propagate_freq): Receive head of the region to propagate instead of loop. (estimate_loops_at_level): Do not use shared to_visit bitmap. (estimate_loops): New function. Handle case current_loops == NULL. (estimate_bb_frequencies): Do not allocate tovisit. Use estimate_loops. * tree-ssa-loop.c (current_loops): Removed. (tree_loop_optimizer_init): Do not return loops. (tree_ssa_loop_init, tree_ssa_loop_done): Do not set current_loops. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge): Do not update loops explicitly. * function.h (struct function): Add x_current_loops field. (current_loops): New macro. * tree-if-conv.c (combine_blocks): Do not update loops explicitly. * loop-unroll.c (split_edge_and_insert): New function. (unroll_loop_runtime_iterations, analyze_insns_in_loop): Do not use loop_split_edge_with. * loop-doloop.c (add_test, doloop_modify): Ditto. * tree-ssa-pre.c (init_pre, fini_pre): Do not set current_loops. * cfglayout.c (copy_bbs): Do not update loops explicitly. * lambda-code.c (perfect_nestify): Do not use loop_split_edge_with. * tree-vect-transform.c (vect_transform_loop): Do not update loops explicitly. * cfgloop.c (flow_loops_cfg_dump): Do not dump dfs_order and rc_order. (flow_loops_free): Do not free dfs_order and rc_order. (flow_loops_find): Do not set dfs_order and rc_order in loops structure. Do not call loops and flow info verification. (add_bb_to_loop, remove_bb_from_loops): Check whether the block already belongs to some loop. * cfgloop.h (struct loops): Remove struct cfg. (current_loops, loop_split_edge_with): Declaration removed. (loop_optimizer_init, loop_optimizer_finalize): Declaration changed. * tree-flow.h (loop_commit_inserts, bsi_insert_on_edge_immediate_loop): Declaration removed. * Makefile.in (cfghooks.o): Add CFGLOOP_H dependency. * basic-block.h (split_edge_and_insert): Declare. * tree-cfg.c (remove_bb): Do not update loops explicitly. From-SVN: r118931
2006-11-17 12:29:17 +01:00
loop_optimizer_finalize ();
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Main entry point to the SSA-PRE pass. DO_FRE is true if the caller
only wants to do full redundancy elimination. */
static void
execute_pre (bool do_fre)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
do_partial_partial = optimize > 2;
init_pre (do_fre);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!do_fre)
insert_fake_stores ();
/* Collect and value number expressions computed in each basic block. */
compute_avail ();
if (dump_file && (dump_flags & TDF_DETAILS))
{
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
basic_block bb;
FOR_ALL_BB (bb)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (dump_file, EXP_GEN (bb), "exp_gen", bb->index);
print_bitmap_set (dump_file, TMP_GEN (bb), "tmp_gen",
bb->index);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (dump_file, AVAIL_OUT (bb), "avail_out",
bb->index);
}
}
/* Insert can get quite slow on an incredibly large number of basic
blocks due to some quadratic behavior. Until this behavior is
fixed, don't run it when he have an incredibly large number of
bb's. If we aren't going to run insert, there is no point in
computing ANTIC, either, even though it's plenty fast. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (!do_fre && n_basic_blocks < 4000)
{
tree-vrp.c: Use XNEW/XCNEW allocation wrappers. 2006-01-31 Marcin Dalecki <martin@dalecki.de> * tree-vrp.c: Use XNEW/XCNEW allocation wrappers. * regrename.c: Ditto. * tree-ssa-loop-im.c: Ditto. * tree-dump.c: Ditto. * tree-complex.c: Ditto. * genrecog.c: Ditto. * tree-ssa-threadupdate.c: Ditto. * tracer.c: Ditto. * java/class.c: Ditto. * java/jcf-parse.c: Ditto. * java/resource.c: Ditto. * java/except.c: Ditto. * java/jvspec.c: Ditto. * java/jcf-write.c: Ditto. * java/jcf-path.c: Ditto. * java/gjavah.c: Ditto. * java/zextract.c: Ditto. * java/jcf-io.c: Ditto. * java/jcf.h: Ditto. * java/buffer.c: Ditto. * java/lang.c: Ditto. * java/parse-scan.y: Ditto. * java/lex.c: Ditto. * java/lex.h: Ditto. * cfgloopmanip.c: Ditto. * postreload-gcse.c: Ditto. * tree-ssa-loop-manip.c: Ditto. * postreload.c: Ditto. * tree-ssa-loop-ch.c: Ditto. * loop.c: Ditto. * ipa-cp.c: Ditto. * cppspec.c: Ditto. * diagnostic.c: Ditto. * final.c: Ditto. * genoutput.c: Ditto. * gcc.c: Ditto. * cfghooks.c: Ditto. * cfgloopanal.c: Ditto. * objc/objc-act.c: Ditto. * gcov.c: Ditto. * genextract.c: Ditto. * genautomata.c: Ditto. * pretty-print.c: Ditto. * genemit.c: Ditto. * cgraphunit.c: Ditto. * flow.c: Ditto. * df-scan.c: Ditto. * haifa-sched.c: Ditto. * dominance.c: Ditto. * dbxout.c: Ditto. * tree-ssa-loop-ivopts.c: Ditto. * df-core.c: Ditto. * mode-switching.c: Ditto. * modulo-sched.c: Ditto. * graph.c: Ditto. * ipa-pure-const.c: Ditto. * cse.c: Ditto. * fix-header.c: Ditto. * web.c: Ditto. * tree-stdarg.c: Ditto. * ipa-utils.c: Ditto. * loop-init.c: Ditto. * ipa-inline.c: Ditto. * cfganal.c: Ditto. * global.c: Ditto. * alloc-pool.c: Ditto. * dwarf2out.c: Ditto. * opts.c: Ditto. * genattrtab.c: Ditto. * tree-ssa-loop-ivcanon.c: Ditto. * predict.c: Ditto. * timevar.c: Ditto. * lcm.c: Ditto. * fortran/gfortranspec.c: Ditto. * regmove.c: Ditto. * local-alloc.c: Ditto. * langhooks.c: Ditto. * function.c: Ditto. * tree-vectorizer.c: Ditto. * gcse.c: Ditto. * ipa-type-escape.c: Ditto. * alias.c: Ditto. * tree-if-conv.c: Ditto. * profile.c: Ditto. * ipa.c: Ditto. * tree-data-ref.c: Ditto. * loop-unroll.c: Ditto. * treelang/treetree.c: Ditto. * calls.c: Ditto. * bt-load.c: Ditto. * ggc-common.c: Ditto. * except.c: Ditto. * coverage.c: Ditto. * cselib.c: Ditto. * tree-cfgcleanup.c: Ditto. * tree-ssa-pre.c: Ditto. * cfgcleanup.c: Ditto. * loop-invariant.c: Ditto. * loop-iv.c: Ditto. * ipa-prop.c: Ditto. * print-tree.c: Ditto. * conflict.c: Ditto. * ggc-page.c: Ditto. * sched-deps.c: Ditto. * regclass.c: Ditto. * tree-object-size.c: Ditto. * combine.c: Ditto. * bb-reorder.c: Ditto. * resource.c: Ditto. * var-tracking.c: Ditto. * cfgloop.c: Ditto. * df-problems.c: Ditto. * reg-stack.c: Ditto. * tlink.c: Ditto. * gccspec.c: Ditto. * sched-rgn.c: Ditto. * tree-ssa-structalias.c: Ditto. * tree-ssa-reassoc.c: Ditto. * config/darwin-c.c: Ditto. * config/darwin.c: Ditto. * config/arm/arm.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * reload1.c: Ditto. From-SVN: r110446
2006-01-31 20:56:55 +01:00
vuse_names = XCNEWVEC (bitmap, num_ssa_names);
compute_rvuse_and_antic_safe ();
compute_antic ();
insert ();
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
free (vuse_names);
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Remove all the redundant expressions. */
eliminate ();
if (dump_file && (dump_flags & TDF_STATS))
{
fprintf (dump_file, "Insertions: %d\n", pre_stats.insertions);
fprintf (dump_file, "PA inserted: %d\n", pre_stats.pa_insert);
fprintf (dump_file, "New PHIs: %d\n", pre_stats.phis);
fprintf (dump_file, "Eliminated: %d\n", pre_stats.eliminations);
fprintf (dump_file, "Constified: %d\n", pre_stats.constified);
}
bsi_commit_edge_inserts ();
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
clear_expression_ids ();
if (!do_fre)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
remove_dead_inserted_code ();
realify_fake_stores ();
}
fini_pre (do_fre);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Gate and execute functions for PRE. */
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
static unsigned int
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
do_pre (void)
{
execute_pre (false);
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
return 0;
}
static bool
gate_pre (void)
{
return flag_tree_pre != 0;
}
struct tree_opt_pass pass_pre =
{
"pre", /* name */
gate_pre, /* gate */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
do_pre, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_PRE, /* tv_id */
PROP_no_crit_edges | PROP_cfg
| PROP_ssa | PROP_alias, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
2006-07-04 23:23:03 +02:00
TODO_update_ssa_only_virtuals | TODO_dump_func | TODO_ggc_collect
| TODO_verify_ssa, /* todo_flags_finish */
Unify the management of RTL and tree-level dump files. 2004-09-06 Paolo Bonzini <bonzini@gnu.org> Unify the management of RTL and tree-level dump files. * cfgexpand.c (tree_expand_cfg): Fix incorrect comment. Don't print function name to the dump file, the pass manager would do this for us. Add code from the top of rest_of_compilation, up to the initial RTL dump. * passes.c (rest_of_handle_jump): Call fixup_tail_calls and close the DFI_sibling dump file. (rest_of_compilation): Don't do that here. Remove code up to the initial RTL dump. (init_optimization_passes): Remove. (pass_rest_of_compilation): Change pass name to NULL. * toplev.c (lang_dependent_init): Do not use an empty dump file prefix. Do not call init_optimization_passes. * toplev.h (init_optimization_passes): Remove. * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Remove SUFFIX parameter. * graph.h (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Likewise. * tree-pass.h (struct tree_opt_pass): Add `letter' field. * cfgexpand.c (pass_expand): Adjust. * gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust. * passes.c (pass_rest_of_compilation): Adjust. * predict.c (pass_profile): Adjust. * tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust. * tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts, pass_split_crit_edges, pass_warn_function_return): Adjust. * tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust. * tree-dfa.c (pass_referenced_vars): Adjust. * tree-eh.c (pass_lower_eh): Adjust. * tree-if-conv.c (pass_build_ssa): Adjust. * tree-into-ssa.c (pass_build_ssa): Adjust. * tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nrv.c (pass_nrv): Adjust. * tree-optimize.c (pass_gimple, pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures): Adjust. * tree-outof-ssa.c (pass_del_ssa): Adjust. * tree-profile.c (pass_tree_profile): Adjust. * tree-sra.c (pass_sra): Adjust. * tree-ssa-alias.c (pass_may_alias): Adjust. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust. * tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust. * tree-ssa-dom.c (pass_dominator): Adjust. * tree-ssa-dse.c (pass_dse): Adjust. * tree-ssa-forwprop.c (pass_forwprop): Adjust. * tree-ssa-if-conv.c (pass_if_conversion): Adjust. * tree-ssa-loop-ch.c (pass_ch): Adjust. * tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim, pass_loop_done, pass_complete_unroll, pass_iv_canon, pass_iv_optimize, pass_vectorize): Adjust. * tree-ssa-phiopt.c (pass_phiopt): Adjust. * tree-ssa-pre.c (pass_pre, pass_fre): Adjust. * tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized, pass_late_warn_uninnitialized): Adjust. * tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust. * Makefile.in (tree-dump.o): Add new dependencies. * cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all. * cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize): Likewise. * toplev.c (dump_file_name): New. * tree-dump.c (dump_enable_all): Add LETTER parameter. (struct dump_file_info): Add NUM and LETTER fields. (dump_files): Adjust and add RTL dump files. (dump_register): Add NUM and LETTER fields. (get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New. (dump_begin): Use get_dump_file_name. (dump_switch_p_1): Adjust call to dump_enable_all. * tree-dump.h (dump_register): Adjust prototype. * tree-optimize.c (register_one_dump_file): Take dump file index. Support flags for RTL dumps. (register_dump_files): Fill in NUM field of struct dump_file_info. Track properties both when the gate is executed and when it is not. (execute_todo): Dump RTL. Add PROPERTIES parameter. (execute_one_pass): Pass properties to execute_todo. Handle VCG dumps of RTL. * tree-pass.h (dump_file_name): New. * tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p): New. * Makefile.in (passes.o): Add new dependencies. * passes.c (struct dump_file_info, enum dump_file_index, dump_file_tbl, init_optimization_passes): Remove. (open_dump_file, close_dump_file): Use tree-dumping infrastructure. (rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use dump_enabled_p. (finish_optimization_passes): Update finish_graph_dump_file loop. (enable_rtl_dump_file): Remove. * tree-dump.c (dump_files): Adjust and add RTL dump files. (enable_rtl_dump_file): Add here. * tree.h (enum tree_dump_index): Add RTL dump file indices. * doc/invoke.texi (Debugging options): Document new RTL debugging options. Update. From-SVN: r87113
2004-09-06 12:08:17 +02:00
0 /* letter */
};
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Gate and execute functions for FRE. */
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
static unsigned int
execute_fre (void)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
execute_pre (true);
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
return 0;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
static bool
gate_fre (void)
{
return flag_tree_fre != 0;
}
struct tree_opt_pass pass_fre =
{
"fre", /* name */
gate_fre, /* gate */
execute_fre, /* execute */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_FRE, /* tv_id */
PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
Unify the management of RTL and tree-level dump files. 2004-09-06 Paolo Bonzini <bonzini@gnu.org> Unify the management of RTL and tree-level dump files. * cfgexpand.c (tree_expand_cfg): Fix incorrect comment. Don't print function name to the dump file, the pass manager would do this for us. Add code from the top of rest_of_compilation, up to the initial RTL dump. * passes.c (rest_of_handle_jump): Call fixup_tail_calls and close the DFI_sibling dump file. (rest_of_compilation): Don't do that here. Remove code up to the initial RTL dump. (init_optimization_passes): Remove. (pass_rest_of_compilation): Change pass name to NULL. * toplev.c (lang_dependent_init): Do not use an empty dump file prefix. Do not call init_optimization_passes. * toplev.h (init_optimization_passes): Remove. * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Remove SUFFIX parameter. * graph.h (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Likewise. * tree-pass.h (struct tree_opt_pass): Add `letter' field. * cfgexpand.c (pass_expand): Adjust. * gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust. * passes.c (pass_rest_of_compilation): Adjust. * predict.c (pass_profile): Adjust. * tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust. * tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts, pass_split_crit_edges, pass_warn_function_return): Adjust. * tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust. * tree-dfa.c (pass_referenced_vars): Adjust. * tree-eh.c (pass_lower_eh): Adjust. * tree-if-conv.c (pass_build_ssa): Adjust. * tree-into-ssa.c (pass_build_ssa): Adjust. * tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nrv.c (pass_nrv): Adjust. * tree-optimize.c (pass_gimple, pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures): Adjust. * tree-outof-ssa.c (pass_del_ssa): Adjust. * tree-profile.c (pass_tree_profile): Adjust. * tree-sra.c (pass_sra): Adjust. * tree-ssa-alias.c (pass_may_alias): Adjust. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust. * tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust. * tree-ssa-dom.c (pass_dominator): Adjust. * tree-ssa-dse.c (pass_dse): Adjust. * tree-ssa-forwprop.c (pass_forwprop): Adjust. * tree-ssa-if-conv.c (pass_if_conversion): Adjust. * tree-ssa-loop-ch.c (pass_ch): Adjust. * tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim, pass_loop_done, pass_complete_unroll, pass_iv_canon, pass_iv_optimize, pass_vectorize): Adjust. * tree-ssa-phiopt.c (pass_phiopt): Adjust. * tree-ssa-pre.c (pass_pre, pass_fre): Adjust. * tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized, pass_late_warn_uninnitialized): Adjust. * tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust. * Makefile.in (tree-dump.o): Add new dependencies. * cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all. * cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize): Likewise. * toplev.c (dump_file_name): New. * tree-dump.c (dump_enable_all): Add LETTER parameter. (struct dump_file_info): Add NUM and LETTER fields. (dump_files): Adjust and add RTL dump files. (dump_register): Add NUM and LETTER fields. (get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New. (dump_begin): Use get_dump_file_name. (dump_switch_p_1): Adjust call to dump_enable_all. * tree-dump.h (dump_register): Adjust prototype. * tree-optimize.c (register_one_dump_file): Take dump file index. Support flags for RTL dumps. (register_dump_files): Fill in NUM field of struct dump_file_info. Track properties both when the gate is executed and when it is not. (execute_todo): Dump RTL. Add PROPERTIES parameter. (execute_one_pass): Pass properties to execute_todo. Handle VCG dumps of RTL. * tree-pass.h (dump_file_name): New. * tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p): New. * Makefile.in (passes.o): Add new dependencies. * passes.c (struct dump_file_info, enum dump_file_index, dump_file_tbl, init_optimization_passes): Remove. (open_dump_file, close_dump_file): Use tree-dumping infrastructure. (rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use dump_enabled_p. (finish_optimization_passes): Update finish_graph_dump_file loop. (enable_rtl_dump_file): Remove. * tree-dump.c (dump_files): Adjust and add RTL dump files. (enable_rtl_dump_file): Add here. * tree.h (enum tree_dump_index): Add RTL dump file indices. * doc/invoke.texi (Debugging options): Document new RTL debugging options. Update. From-SVN: r87113
2004-09-06 12:08:17 +02:00
TODO_dump_func | TODO_ggc_collect | TODO_verify_ssa, /* todo_flags_finish */
0 /* letter */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
};