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] conflict.c: Remove unused functions.


Hi,

Attached is a patch to remove mark_reg and conflict_graph_compute as
they are unused.

Bootstrapped on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-11-07  Kazu Hirata  <kazu@cs.umass.edu>

	* conflict.c (mark_reg, conflict_graph_compute): Remove.
	* basic-block.h: Remove the prototype for
	conflict_graph_compute.

Index: basic-block.h
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/basic-block.h,v
retrieving revision 1.223
diff -u -d -p -r1.223 basic-block.h
--- basic-block.h	29 Oct 2004 08:40:51 -0000	1.223
+++ basic-block.h	7 Nov 2004 06:46:45 -0000
@@ -797,7 +797,6 @@ extern void conflict_graph_enum (conflic
 				 void *);
 extern void conflict_graph_merge_regs (conflict_graph, int, int);
 extern void conflict_graph_print (conflict_graph, FILE*);
-extern conflict_graph conflict_graph_compute (regset, partition);
 extern bool mark_dfs_back_edges (void);
 extern void set_edge_can_fallthru_flag (void);
 extern void update_br_prob_note (basic_block);
Index: conflict.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/conflict.c,v
retrieving revision 1.27
diff -u -d -p -r1.27 conflict.c
--- conflict.c	4 Nov 2004 08:40:58 -0000	1.27
+++ conflict.c	7 Nov 2004 06:46:45 -0000
@@ -117,7 +117,6 @@ struct conflict_graph_def
 static hashval_t arc_hash (const void *);
 static int arc_eq (const void *, const void *);
 static int print_conflict (int, int, void *);
-static void mark_reg (rtx, rtx, void *);
 
 /* Callback function to compute the hash value of an arc.  Uses
    current_graph to locate the graph to which the arc belongs.  */
@@ -364,138 +363,3 @@ conflict_graph_print (conflict_graph gra
 	fputc ('\n', fp);
     }
 }
-
-/* Callback function for note_stores.  */
-
-static void
-mark_reg (rtx reg, rtx setter ATTRIBUTE_UNUSED, void *data)
-{
-  regset set = (regset) data;
-
-  if (GET_CODE (reg) == SUBREG)
-    reg = SUBREG_REG (reg);
-
-  /* We're only interested in regs.  */
-  if (!REG_P (reg))
-    return;
-
-  SET_REGNO_REG_SET (set, REGNO (reg));
-}
-
-/* Allocates a conflict graph and computes conflicts over the current
-   function for the registers set in REGS.  The caller is responsible
-   for deallocating the return value.  
-
-   Preconditions: the flow graph must be in SSA form, and life
-   analysis (specifically, regs live at exit from each block) must be
-   up-to-date.  
-
-   This algorithm determines conflicts by walking the insns in each
-   block backwards.  We maintain the set of live regs at each insn,
-   starting with the regs live on exit from the block.  For each insn:
- 
-     1. If a reg is set in this insns, it must be born here, since
-        we're in SSA.  Therefore, it was not live before this insns,
-	so remove it from the set of live regs.  
-
-     2. For each reg born in this insn, record a conflict between it
-	and every other reg live coming into this insn.  For each
-	existing conflict, one of the two regs must be born while the
-	other is alive.  See Morgan or elsewhere for a proof of this.
-
-     3. Regs clobbered by this insn must have been live coming into
-        it, so record them as such.  
-
-   The resulting conflict graph is not built for regs in REGS
-   themselves; rather, partition P is used to obtain the canonical reg
-   for each of these.  The nodes of the conflict graph are these
-   canonical regs instead.  */
-
-conflict_graph
-conflict_graph_compute (regset regs, partition p)
-{
-  conflict_graph graph = conflict_graph_new (max_reg_num ());
-  regset_head live_head;
-  regset live = &live_head;
-  regset_head born_head;
-  regset born = &born_head;
-  basic_block bb;
-
-  INIT_REG_SET (live);
-  INIT_REG_SET (born);
-
-  FOR_EACH_BB_REVERSE (bb)
-    {
-      rtx insn;
-      rtx head;
-
-      /* Start with the regs that are live on exit, limited to those
-	 we're interested in.  */
-      COPY_REG_SET (live, bb->global_live_at_end);
-      AND_REG_SET (live, regs);
-
-      /* Walk the instruction stream backwards.  */
-      head = BB_HEAD (bb);
-      insn = BB_END (bb);
-      for (insn = BB_END (bb); insn != head; insn = PREV_INSN (insn))
-	{
-	  unsigned born_reg;
-	  unsigned live_reg;
-	  rtx link;
-
-	  /* Are we interested in this insn? */
-	  if (INSN_P (insn))
-	    {
-	      reg_set_iterator rsi;
-
-	      /* Determine which regs are set in this insn.  Since
-  	         we're in SSA form, if a reg is set here it isn't set
-  	         anywhere else, so this insn is where the reg is born.  */
-	      CLEAR_REG_SET (born);
-	      note_stores (PATTERN (insn), mark_reg, born);
-	      AND_REG_SET (born, regs);
-	  
-	      /* Regs born here were not live before this insn.  */
-	      AND_COMPL_REG_SET (live, born);
-
-	      /* For every reg born here, add a conflict with every other
-  	         reg live coming into this insn.  */
-	      EXECUTE_IF_SET_IN_REG_SET
-		(born, FIRST_PSEUDO_REGISTER, born_reg, rsi)
-		{
-		  reg_set_iterator rsj;
-
-		  EXECUTE_IF_SET_IN_REG_SET
-		    (live, FIRST_PSEUDO_REGISTER, live_reg, rsj)
-		    {
-		      /* Build the conflict graph in terms of canonical
-			 regnos.  */
-		      int b = partition_find (p, born_reg);
-		      int l = partition_find (p, live_reg);
-
-		      if (b != l)
-			conflict_graph_add (graph, b, l);
-		    }
-		}
-
-	      /* Morgan's algorithm checks the operands of the insn
-	         and adds them to the set of live regs.  Instead, we
-	         use death information added by life analysis.  Regs
-	         dead after this instruction were live before it.  */
-	      for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
-		if (REG_NOTE_KIND (link) == REG_DEAD)
-		  {
-		    unsigned int regno = REGNO (XEXP (link, 0));
-
-		    if (REGNO_REG_SET_P (regs, regno))
-		      SET_REGNO_REG_SET (live, regno);
-		  }
-	    }
-	}
-    }
-
-  FREE_REG_SET (live);
-  FREE_REG_SET (born);
-
-  return graph;
-}


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