diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-09 19:13:07 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-09 19:13:07 +0000 |
commit | a8046f6028a5b566796bea8409ceea78b0c9c5f2 (patch) | |
tree | 43d76704cc977318946377c4bb267eca1f611d0e /gcc/tree-outof-ssa.c | |
parent | d7ecac2ed2227fc3db9e50e13aab98bf92bd0e26 (diff) | |
download | gcc-a8046f6028a5b566796bea8409ceea78b0c9c5f2.tar.gz |
* Makefile.in (OBJC-common): Add tree-ssa-threadupdate.c
(tree-ssa-threadupdate.o): Add dependencies.
* tree-ssa-threadupdate.c: New file.
* tree-flow.h (incoming_edge_threaded): New flag in block annotation.
(rewrite_vars_out_of_ssa): Remove prototype.
(cleanup_tree_cfg): Returns a bool.
* tree.h (thread_through_all_blocks): Prototype.
* tree-outof-ssa.c (SSANORM_*): Move into here.
(remove_ssa_form): Now static.
(rewrite_vars_out_of_ssa): Kill.
* tree-ssa-live.c (register_ssa_partitions_for_vars): Kill.
* tree-ssa-live.h (SSANORM_*): Moved into tree-outof-ssa.c.
(remove_ssa_form, register_partitions_for_vars): Kill declarations.
* tree-cfg.c (cleanup_tree_cfg): Return a value indicating if
anything was changed.
* tree-phinodes.c (add_phi_arg): Get the block for the PHI
from the PHI's annotation rather than the edge associated with
the new argument.
* tree-ssa-dom.c (redirection_edges): Kill.
(redirect_edges_and_update_ssa_graph): Kill.
(tree_ssa_dominator_optimize): Do not reset forwardable flag
for blocks anymore. Do not initialize redirection_edges.
Call thread_through_all_blocks. Simplify code for cleanup
of the CFG and iterating. No longer call cleanup_tree_cfg
outside the iteration loop.
(thread_across_edge): No longer mess with forwardable blocks.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85721 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r-- | gcc/tree-outof-ssa.c | 126 |
1 files changed, 9 insertions, 117 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 1fef266646d..33a927e14ae 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -48,6 +48,14 @@ Boston, MA 02111-1307, USA. */ #include "tree-ssa-live.h" #include "tree-pass.h" +/* Flags to pass to remove_ssa_form. */ + +#define SSANORM_PERFORM_TER 0x1 +#define SSANORM_COMBINE_TEMPS 0x2 +#define SSANORM_REMOVE_ALL_PHIS 0x4 +#define SSANORM_COALESCE_PARTITIONS 0x8 +#define SSANORM_USE_COALESCE_LIST 0x10 + /* Used to hold all the components required to do SSA PHI elimination. The node and pred/succ list is a simple linear list of nodes and edges represented as pairs of nodes. @@ -1956,7 +1964,7 @@ rewrite_trees (var_map map, tree *values) /* Remove the variables specified in MAP from SSA form. Any debug information is sent to DUMP. FLAGS indicate what options should be used. */ -void +static void remove_ssa_form (FILE *dump, var_map map, int flags) { tree_live_info_p liveinfo; @@ -2039,122 +2047,6 @@ remove_ssa_form (FILE *dump, var_map map, int flags) dump_file = save; } - -/* Take a subset of the variables VARS in the current function out of SSA - form. */ - -void -rewrite_vars_out_of_ssa (bitmap vars) -{ - if (bitmap_first_set_bit (vars) >= 0) - { - var_map map; - basic_block bb; - tree phi; - int i; - int ssa_flags; - - /* Search for PHIs in which one of the PHI arguments is marked for - translation out of SSA form, but for which the PHI result is not - marked for translation out of SSA form. - - Our per-variable out of SSA translation can not handle that case; - however we can easily handle it here by creating a new instance - of the PHI result's underlying variable and initializing it to - the offending PHI argument on the edge associated with the - PHI argument. We then change the PHI argument to use our new - instead of the PHI's underlying variable. - - You might think we could register partitions for the out-of-ssa - translation here and avoid a second walk of the PHI nodes. No - such luck since the size of the var map will change if we have - to manually take variables out of SSA form here. */ - FOR_EACH_BB (bb) - { - for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) - { - tree result = SSA_NAME_VAR (PHI_RESULT (phi)); - - /* If the definition is marked for renaming, then we need - to do nothing more for this PHI node. */ - if (bitmap_bit_p (vars, var_ann (result)->uid)) - continue; - - /* Look at all the arguments and see if any of them are - marked for renaming. If so, we need to handle them - specially. */ - for (i = 0; i < PHI_NUM_ARGS (phi); i++) - { - tree arg = PHI_ARG_DEF (phi, i); - - /* If the argument is not an SSA_NAME, then we can ignore - this argument. */ - if (TREE_CODE (arg) != SSA_NAME) - continue; - - /* If this argument is marked for renaming, then we need - to undo the copy propagation so that we can take - the argument out of SSA form without taking the - result out of SSA form. */ - arg = SSA_NAME_VAR (arg); - if (bitmap_bit_p (vars, var_ann (arg)->uid)) - { - tree new_name, copy; - - /* Get a new SSA_NAME for the copy, it is based on - the result, not the argument! We use the PHI - as the definition since we haven't created the - definition statement yet. */ - new_name = make_ssa_name (result, phi); - - /* Now create the copy statement. */ - copy = build (MODIFY_EXPR, TREE_TYPE (arg), - new_name, PHI_ARG_DEF (phi, i)); - - /* Now update SSA_NAME_DEF_STMT to point to the - newly created statement. */ - SSA_NAME_DEF_STMT (new_name) = copy; - - /* Now make the argument reference our new SSA_NAME. */ - SET_PHI_ARG_DEF (phi, i, new_name); - - /* Queue the statement for insertion. */ - bsi_insert_on_edge (PHI_ARG_EDGE (phi, i), copy); - modify_stmt (copy); - } - } - } - } - - /* If any copies were inserted on edges, actually insert them now. */ - bsi_commit_edge_inserts (NULL); - - /* Now register partitions for all instances of the variables we - are taking out of SSA form. */ - map = init_var_map (num_ssa_names + 1); - register_ssa_partitions_for_vars (vars, map); - - /* Now that we have all the partitions registered, translate the - appropriate variables out of SSA form. */ - ssa_flags = SSANORM_COALESCE_PARTITIONS; - if (flag_tree_combine_temps) - ssa_flags |= SSANORM_COMBINE_TEMPS; - remove_ssa_form (dump_file, map, ssa_flags); - - /* And finally, reset the out_of_ssa flag for each of the vars - we just took out of SSA form. */ - EXECUTE_IF_SET_IN_BITMAP (vars, 0, i, - { - var_ann (referenced_var (i))->out_of_ssa_tag = 0; - }); - - /* Free the map as we are done with it. */ - delete_var_map (map); - - } -} - - /* Take the current function out of SSA form, as described in R. Morgan, ``Building an Optimizing Compiler'', Butterworth-Heinemann, Boston, MA, 1998. pp 176-186. */ |