diff mbox

[4/8] Remove tree-ssa-dom.h from the tree-ssa.h include list.

Message ID 52613A26.9040703@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod Oct. 18, 2013, 1:39 p.m. UTC
degenerate_phi_result was defined in tree-ssa-dom.c, I moved it to 
tree-phinodes since all it does is determine whether the arguements of 
the phi which are not the same as the result are all the same. This 
reduced by half the number fo files which required tree-ssa-dom.h.

bootstraps on x86_64-unknown-linux-gnu with no new regressions. OK?

Andrew

Comments

Jeff Law Oct. 18, 2013, 3:59 p.m. UTC | #1
On 10/18/13 07:39, Andrew MacLeod wrote:
> degenerate_phi_result was defined in tree-ssa-dom.c, I moved it to
> tree-phinodes since all it does is determine whether the arguements of
> the phi which are not the same as the result are all the same. This
> reduced by half the number fo files which required tree-ssa-dom.h.
>
> bootstraps on x86_64-unknown-linux-gnu with no new regressions. OK?
OK.

FWIW, the original purpose of tree-phinodes.[ch] was just management of 
a list of free PHI nodes for recycling.  If it's a good place to put 
various support routines of this nature, that's fine by me.

jeff
Andrew MacLeod Oct. 18, 2013, 6:41 p.m. UTC | #2
On 10/18/2013 11:59 AM, Jeff Law wrote:
> On 10/18/13 07:39, Andrew MacLeod wrote:
>> degenerate_phi_result was defined in tree-ssa-dom.c, I moved it to
>> tree-phinodes since all it does is determine whether the arguements of
>> the phi which are not the same as the result are all the same. This
>> reduced by half the number fo files which required tree-ssa-dom.h.
>>
>> bootstraps on x86_64-unknown-linux-gnu with no new regressions. OK?
> OK.
>
> FWIW, the original purpose of tree-phinodes.[ch] was just management 
> of a list of free PHI nodes for recycling.  If it's a good place to 
> put various support routines of this nature, that's fine by me.
>
I had/have hopes of pushing other phi utility things into here as 
well...  it seems like a reasonable place.

Andrew
diff mbox

Patch


	* tree-ssa.h: Don't include tree-ssa-dom.h.
	* tree-ssa-dom.c: Include tree-ssa-dom.h.
	(degenerate_phi_result): Move to tree-phinodes.c.
	* tree-phinodes.c (degenerate_phi_result): Relocate here.
	* tree-ssa-dom.h: Remove Prototype.
	* tree-phinodes.h: Add prototype.
	* tree-ssa-copy.c: Include tree-ssa-dom.h.
	* tree-ssa-forwprop.c: Likewise.

*** T5/tree-ssa.h	2013-10-17 13:05:11.372947947 -0400
--- tree-ssa.h	2013-10-17 13:05:32.445945346 -0400
*************** along with GCC; see the file COPYING3.
*** 31,37 ****
  #include "tree-phinodes.h"
  #include "ssa-iterators.h"
  #include "tree-ssanames.h"
- #include "tree-ssa-dom.h"
  #include "tree-ssa-loop.h"
  #include "tree-into-ssa.h"
  #include "tree-dfa.h"
--- 31,36 ----
*** T5/tree-ssa-dom.c	2013-10-17 13:05:11.368947948 -0400
--- tree-ssa-dom.c	2013-10-17 13:14:26.712902297 -0400
*************** along with GCC; see the file COPYING3.
*** 38,43 ****
--- 38,44 ----
  #include "langhooks.h"
  #include "params.h"
  #include "tree-ssa-threadedge.h"
+ #include "tree-ssa-dom.h"
  
  /* This file implements optimizations on the dominator tree.  */
  
*************** avail_expr_hash (const void *p)
*** 2589,2630 ****
  /* PHI-ONLY copy and constant propagation.  This pass is meant to clean
     up degenerate PHIs created by or exposed by jump threading.  */
  
- /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
-    NULL.  */
- 
- tree
- degenerate_phi_result (gimple phi)
- {
-   tree lhs = gimple_phi_result (phi);
-   tree val = NULL;
-   size_t i;
- 
-   /* Ignoring arguments which are the same as LHS, if all the remaining
-      arguments are the same, then the PHI is a degenerate and has the
-      value of that common argument.  */
-   for (i = 0; i < gimple_phi_num_args (phi); i++)
-     {
-       tree arg = gimple_phi_arg_def (phi, i);
- 
-       if (arg == lhs)
- 	continue;
-       else if (!arg)
- 	break;
-       else if (!val)
- 	val = arg;
-       else if (arg == val)
- 	continue;
-       /* We bring in some of operand_equal_p not only to speed things
- 	 up, but also to avoid crashing when dereferencing the type of
- 	 a released SSA name.  */
-       else if (TREE_CODE (val) != TREE_CODE (arg)
- 	       || TREE_CODE (val) == SSA_NAME
- 	       || !operand_equal_p (arg, val, 0))
- 	break;
-     }
-   return (i == gimple_phi_num_args (phi) ? val : NULL);
- }
- 
  /* Given a statement STMT, which is either a PHI node or an assignment,
     remove it from the IL.  */
  
--- 2590,2595 ----
*** T5/tree-phinodes.c	2013-10-17 13:05:11.366947948 -0400
--- tree-phinodes.c	2013-10-17 13:10:14.281917669 -0400
*************** remove_phi_nodes (basic_block bb)
*** 464,467 ****
--- 464,504 ----
    set_phi_nodes (bb, NULL);
  }
  
+ /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
+    NULL.  */
+ 
+ tree
+ degenerate_phi_result (gimple phi)
+ {
+   tree lhs = gimple_phi_result (phi);
+   tree val = NULL;
+   size_t i;
+ 
+   /* Ignoring arguments which are the same as LHS, if all the remaining
+      arguments are the same, then the PHI is a degenerate and has the
+      value of that common argument.  */
+   for (i = 0; i < gimple_phi_num_args (phi); i++)
+     {
+       tree arg = gimple_phi_arg_def (phi, i);
+ 
+       if (arg == lhs)
+ 	continue;
+       else if (!arg)
+ 	break;
+       else if (!val)
+ 	val = arg;
+       else if (arg == val)
+ 	continue;
+       /* We bring in some of operand_equal_p not only to speed things
+ 	 up, but also to avoid crashing when dereferencing the type of
+ 	 a released SSA name.  */
+       else if (TREE_CODE (val) != TREE_CODE (arg)
+ 	       || TREE_CODE (val) == SSA_NAME
+ 	       || !operand_equal_p (arg, val, 0))
+ 	break;
+     }
+   return (i == gimple_phi_num_args (phi) ? val : NULL);
+ }
+ 
+ 
  #include "gt-tree-phinodes.h"
*** T5/tree-ssa-dom.h	2013-10-17 13:05:11.368947948 -0400
--- tree-ssa-dom.h	2013-10-17 13:11:27.636912389 -0400
*************** extern void dump_dominator_optimization_
*** 24,29 ****
  extern void debug_dominator_optimization_stats (void);
  extern int loop_depth_of_name (tree);
  extern bool simple_iv_increment_p (gimple);
- extern tree degenerate_phi_result (gimple);
  
  #endif /* GCC_TREE_SSA_DOM_H */
--- 24,28 ----
*** T5/tree-phinodes.h	2013-10-17 13:05:11.366947948 -0400
--- tree-phinodes.h	2013-10-17 13:11:25.245912550 -0400
*************** extern void add_phi_arg (gimple, tree, e
*** 29,35 ****
  extern void remove_phi_args (edge);
  extern void remove_phi_node (gimple_stmt_iterator *, bool);
  extern void remove_phi_nodes (basic_block);
! /* Return a use_operand_p pointer for argument I of PHI node GS.  */
  
  /* Set PHI nodes of a basic block BB to SEQ.  */
  
--- 29,35 ----
  extern void remove_phi_args (edge);
  extern void remove_phi_node (gimple_stmt_iterator *, bool);
  extern void remove_phi_nodes (basic_block);
! extern tree degenerate_phi_result (gimple);
  
  /* Set PHI nodes of a basic block BB to SEQ.  */
  
*** T5/tree-ssa-copy.c	2013-10-17 13:05:11.368947948 -0400
--- tree-ssa-copy.c	2013-10-17 13:14:19.934902613 -0400
*************** along with GCC; see the file COPYING3.
*** 33,38 ****
--- 33,39 ----
  #include "langhooks.h"
  #include "cfgloop.h"
  #include "tree-scalar-evolution.h"
+ #include "tree-ssa-dom.h"
  
  /* This file implements the copy propagation pass and provides a
     handful of interfaces for performing const/copy propagation and
*** T5/tree-ssa-forwprop.c	2013-10-17 13:05:11.368947948 -0400
--- tree-ssa-forwprop.c	2013-10-17 13:14:30.945902103 -0400
*************** along with GCC; see the file COPYING3.
*** 34,39 ****
--- 34,40 ----
  #include "cfgloop.h"
  #include "optabs.h"
  #include "tree-ssa-propagate.h"
+ #include "tree-ssa-dom.h"
  
  /* This pass propagates the RHS of assignment statements into use
     sites of the LHS of the assignment.  It's basically a specialized