This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove duplicated functions.


This removes the duplicates of has_single_use and has_zero_use and it's
two uses.

Bootstrapped and tested on i686-pc-linux-gnu.

Applied.

Richard.


2007-02-15  Richard Guenther  <rguenther@suse.de>

	* tree-flow-inline.h (single_imm_use_p): Remove.
	(zero_imm_uses_p): Likewise.
	* tree-ssa-coalesce.c (create_outofssa_var_map): Use has_single_use
	instead of single_imm_use_p.
	* tree-cfg.c (replace_uses_by): Use has_zero_use instead of
	zero_imm_uses_p.


Index: tree-flow-inline.h
===================================================================
*** tree-flow-inline.h	(revision 121992)
--- tree-flow-inline.h	(working copy)
*************** has_single_use (tree var)
*** 560,576 ****
  }
  
  
- /* If VAR has only a single immediate use, return true.  */
- static inline bool
- single_imm_use_p (tree var)
- {
-   ssa_use_operand_t *ptr;
- 
-   ptr = &(SSA_NAME_IMM_USE_NODE (var));
-   return (ptr != ptr->next && ptr == ptr->next->next);
- }
- 
- 
  /* If VAR has only a single immediate use, return true, and set USE_P and STMT
     to the use pointer and stmt of occurrence.  */
  static inline bool
--- 560,565 ----
*************** num_imm_uses (tree var)
*** 605,618 ****
    return num;
  }
  
- /* Return true if VAR has no immediate uses.  */
- static inline bool
- zero_imm_uses_p (tree var)
- {
-   ssa_use_operand_t *ptr = &(SSA_NAME_IMM_USE_NODE (var));
-   return (ptr == ptr->next);
- }
- 
  /* Return the tree pointer to by USE.  */ 
  static inline tree
  get_use_from_ptr (use_operand_p use)
--- 594,599 ----
Index: tree-ssa-coalesce.c
===================================================================
*** tree-ssa-coalesce.c	(revision 121992)
--- tree-ssa-coalesce.c	(working copy)
*************** create_outofssa_var_map (coalesce_list_p
*** 976,982 ****
  		  if ((e->flags & EDGE_ABNORMAL) == 0)
  		    {
  		      int cost = coalesce_cost_edge (e);
! 		      if (cost == 1 && single_imm_use_p (arg))
  		        add_cost_one_coalesce (cl, ver, SSA_NAME_VERSION (arg));
  		      else
  			add_coalesce (cl, ver, SSA_NAME_VERSION (arg), cost);
--- 976,982 ----
  		  if ((e->flags & EDGE_ABNORMAL) == 0)
  		    {
  		      int cost = coalesce_cost_edge (e);
! 		      if (cost == 1 && has_single_use (arg))
  		        add_cost_one_coalesce (cl, ver, SSA_NAME_VERSION (arg));
  		      else
  			add_coalesce (cl, ver, SSA_NAME_VERSION (arg), cost);
Index: tree-cfg.c
===================================================================
*** tree-cfg.c	(revision 121992)
--- tree-cfg.c	(working copy)
*************** replace_uses_by (tree name, tree val)
*** 1208,1214 ****
  	}
      }
  
!   gcc_assert (zero_imm_uses_p (name));
  
    /* Also update the trees stored in loop structures.  */
    if (current_loops)
--- 1208,1214 ----
  	}
      }
  
!   gcc_assert (has_zero_uses (name));
  
    /* Also update the trees stored in loop structures.  */
    if (current_loops)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]