aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2004-09-11 22:42:06 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2004-09-11 20:42:06 +0000
commit30d396e3d52c70f69387301c2d4d161e18a697f8 (patch)
tree6e2f5dd6980def0575a618d307ba60b022d28ef0 /gcc/tree-ssa-dse.c
parentf4a6d54edd0ad80bcad9573d1cba9ded7f7e995c (diff)
downloadgcc-30d396e3d52c70f69387301c2d4d161e18a697f8.zip
gcc-30d396e3d52c70f69387301c2d4d161e18a697f8.tar.gz
gcc-30d396e3d52c70f69387301c2d4d161e18a697f8.tar.bz2
tree-cfg.c (set_bb_for_stmt): Use PHI_BB.
* tree-cfg.c (set_bb_for_stmt): Use PHI_BB. * tree-dfa.c (compute_immediate_uses, add_immediate_use, redirect_immediate_use): Use PHI_DF. * tree-flow-inline.h (stmt_ann): Abort on phi nodes. (bb_for_stmt): Use PHI_BB. (get_immediate_uses): Use PHI_DF. * tree-ssa-dse.c (max_stmt_uid): New variable. (get_stmt_uid): New function. (dse_optimize_stmt, dse_record_phis, tree_ssa_dse): Do not use phi node annotations. * tree-ssa-loop-im.c (LIM_DATA): Do not use phi statement annotations. (max_uid): Renamed to max_stmt_uid. (get_stmt_uid): New function. (maybe_queue_var, single_reachable_address, determine_lsm): Do not use phi node annotations. * tree-ssa.c (replace_immediate_uses): Do not use phi node annotations. * tree.h (PHI_BB, PHI_DF): New accessor functions. (struct tree_phi_node): Add bb and df fields. From-SVN: r87369
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 820b2c6..4cc136b 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -98,6 +98,21 @@ static void fix_phi_uses (tree, tree);
static void fix_stmt_v_may_defs (tree, tree);
static void record_voperand_set (bitmap, bitmap *, unsigned int);
+static unsigned max_stmt_uid; /* Maximal uid of a statement. Uids to phi
+ nodes are assigned using the versions of
+ ssa names they define. */
+
+/* Returns uid of statement STMT. */
+
+static unsigned
+get_stmt_uid (tree stmt)
+{
+ if (TREE_CODE (stmt) == PHI_NODE)
+ return SSA_NAME_VERSION (PHI_RESULT (stmt)) + max_stmt_uid;
+
+ return stmt_ann (stmt)->uid;
+}
+
/* Function indicating whether we ought to include information for 'var'
when calculating immediate uses. For this pass we only want use
information for virtual variables. */
@@ -270,7 +285,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
same block. */
while (num_uses == 1
&& TREE_CODE (use) == PHI_NODE
- && bitmap_bit_p (dse_gd->stores, stmt_ann (use)->uid))
+ && bitmap_bit_p (dse_gd->stores, get_stmt_uid (use)))
{
/* Record the first PHI we skip so that we can fix its
uses if we find that STMT is a dead store. */
@@ -287,7 +302,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
/* If we have precisely one immediate use at this point, then we may
have found redundant store. */
if (num_uses == 1
- && bitmap_bit_p (dse_gd->stores, stmt_ann (use)->uid)
+ && bitmap_bit_p (dse_gd->stores, get_stmt_uid (use))
&& operand_equal_p (TREE_OPERAND (stmt, 0),
TREE_OPERAND (use, 0), 0))
{
@@ -333,7 +348,7 @@ dse_record_phis (struct dom_walk_data *walk_data, basic_block bb)
if (need_imm_uses_for (PHI_RESULT (phi)))
record_voperand_set (dse_gd->stores,
&bd->stores,
- get_stmt_ann (phi)->uid);
+ get_stmt_uid (phi));
}
static void
@@ -356,21 +371,17 @@ tree_ssa_dse (void)
{
struct dom_walk_data walk_data;
struct dse_global_data dse_gd;
- unsigned int uid = 0;
basic_block bb;
/* Create a UID for each statement in the function. Ordering of the
UIDs is not important for this pass. */
+ max_stmt_uid = 0;
FOR_EACH_BB (bb)
{
block_stmt_iterator bsi;
- tree phi;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- stmt_ann (bsi_stmt (bsi))->uid = uid++;
-
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- stmt_ann (phi)->uid = uid++;
+ stmt_ann (bsi_stmt (bsi))->uid = max_stmt_uid++;
}
/* We might consider making this a property of each pass so that it