aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.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-loop-im.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-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index c0d2c00..bc606e6 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -76,7 +76,9 @@ struct lim_aux_data
MAX_LOOP loop. */
};
-#define LIM_DATA(STMT) ((struct lim_aux_data *) (stmt_ann (STMT)->common.aux))
+#define LIM_DATA(STMT) (TREE_CODE (STMT) == PHI_NODE \
+ ? NULL \
+ : (struct lim_aux_data *) (stmt_ann (STMT)->common.aux))
/* Description of a memory reference for store motion. */
@@ -94,9 +96,20 @@ struct mem_ref
block will be executed. */
#define ALWAYS_EXECUTED_IN(BB) ((struct loop *) (BB)->aux)
-/* Maximum uid in the statement in the function. */
+static unsigned max_stmt_uid; /* Maximal uid of a statement. Uids to phi
+ nodes are assigned using the versions of
+ ssa names they define. */
-static unsigned max_uid;
+/* 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;
+}
/* Calls CBCK for each index in memory reference ADDR_P. There are two
kinds situations handled; in each of these cases, the memory reference
@@ -805,10 +818,10 @@ maybe_queue_var (tree var, struct loop *loop,
if (!def_bb
|| !flow_bb_inside_loop_p (loop, def_bb)
- || TEST_BIT (seen, stmt_ann (stmt)->uid))
+ || TEST_BIT (seen, get_stmt_uid (stmt)))
return;
- SET_BIT (seen, stmt_ann (stmt)->uid);
+ SET_BIT (seen, get_stmt_uid (stmt));
queue[(*in_queue)++] = stmt;
}
@@ -900,6 +913,7 @@ single_reachable_address (struct loop *loop, tree stmt,
struct mem_ref **mem_refs,
bool *seen_call_stmt)
{
+ unsigned max_uid = max_stmt_uid + num_ssa_names;
tree *queue = xmalloc (sizeof (tree) * max_uid);
sbitmap seen = sbitmap_alloc (max_uid);
unsigned in_queue = 1;
@@ -917,7 +931,7 @@ single_reachable_address (struct loop *loop, tree stmt,
sra_data.common_ref = NULL_TREE;
queue[0] = stmt;
- SET_BIT (seen, stmt_ann (stmt)->uid);
+ SET_BIT (seen, get_stmt_uid (stmt));
*seen_call_stmt = false;
while (in_queue)
@@ -975,9 +989,9 @@ single_reachable_address (struct loop *loop, tree stmt,
if (!flow_bb_inside_loop_p (loop, bb_for_stmt (stmt)))
continue;
- if (TEST_BIT (seen, stmt_ann (stmt)->uid))
+ if (TEST_BIT (seen, get_stmt_uid (stmt)))
continue;
- SET_BIT (seen, stmt_ann (stmt)->uid);
+ SET_BIT (seen, get_stmt_uid (stmt));
queue[in_queue++] = stmt;
}
@@ -1230,17 +1244,13 @@ determine_lsm (struct loops *loops)
/* Create a UID for each statement in the function. Ordering of the
UIDs is not important for this pass. */
- max_uid = 0;
+ 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 = max_uid++;
-
- for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
- stmt_ann (phi)->uid = max_uid++;
+ stmt_ann (bsi_stmt (bsi))->uid = max_stmt_uid++;
}
compute_immediate_uses (TDFA_USE_VOPS, NULL);