I noticed that gimple.h::phi_ssa_name_p is used in exactly one location,
tree-outof-ssa.c. Its used in an expression, and the name isn't really
very clear.
I renamed it and rolled the rest of the expression into the new
function, and made it static within tree-outof-ssa.c.
Bootstraps on x86_64-unknown-linux-gnu with no new regressions. OK?
Andrew
* tree-outof-ssa.c (queue_phi_copy_p): Combine phi_ssa_name_p from
gimple.h and the rest of the condition in eliminate_build.
(eliminate_build): Call new routine.
* gimple.h (phi_ssa_name_p): Delete.
Index: tree-outof-ssa.c
===================================================================
*** tree-outof-ssa.c (revision 204355)
--- tree-outof-ssa.c (working copy)
*************** eliminate_name (elim_graph g, int T)
*** 548,553 ****
--- 548,570 ----
elim_graph_add_node (g, T);
}
+ /* Return true if this phi argument T should have a copy queued when using
+ var_map MAP. PHI nodes should contain only ssa_names and invariants. A
+ test for ssa_name is definitely simpler, but don't let invalid contents
+ slip through in the meantime. */
+
+ static inline bool
+ queue_phi_copy_p (var_map map, tree t)
+ {
+ if (TREE_CODE (t) == SSA_NAME)
+ {
+ if (var_to_partition (map, t) == NO_PARTITION)
+ return true;
+ return false;
+ }
+ gcc_checking_assert (is_gimple_min_invariant (t));
+ return true;
+ }
/* Build elimination graph G for basic block BB on incoming PHI edge
G->e. */
*************** eliminate_build (elim_graph g)
*** 577,585 ****
/* If this argument is a constant, or a SSA_NAME which is being
left in SSA form, just queue a copy to be emitted on this
edge. */
! if (!phi_ssa_name_p (Ti)
! || (TREE_CODE (Ti) == SSA_NAME
! && var_to_partition (g->map, Ti) == NO_PARTITION))
{
/* Save constant copies until all other copies have been emitted
on this edge. */
--- 594,600 ----
/* If this argument is a constant, or a SSA_NAME which is being
left in SSA form, just queue a copy to be emitted on this
edge. */
! if (queue_phi_copy_p (g->map, Ti))
{
/* Save constant copies until all other copies have been emitted
on this edge. */
Index: gimple.h
===================================================================
*** gimple.h (revision 204355)
--- gimple.h (working copy)
*************** gimple_phi_set_arg (gimple gs, unsigned
*** 3633,3651 ****
gs->gimple_phi.args[index] = *phiarg;
}
- /* PHI nodes should contain only ssa_names and invariants. A test
- for ssa_name is definitely simpler; don't let invalid contents
- slip in in the meantime. */
-
- static inline bool
- phi_ssa_name_p (const_tree t)
- {
- if (TREE_CODE (t) == SSA_NAME)
- return true;
- gcc_checking_assert (is_gimple_min_invariant (t));
- return false;
- }
-
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
--- 3633,3638 ----