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 traces of RTL-level VRP.


Hi,

Attached is a patch to remove traces of RTL-level value range
propagation.

AFAIK, several VRP support routines made it into CVS, but the VRP
proper didn't.  These rountines have been unused for more than two
years.  If there is no near-future plan to support VRP at RTL-level,
we should remove them.

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

Kazu Hirata

2004-03-15  Kazu Hirata  <kazu@cs.umass.edu>

	* basic-block.h: Remove the prototype for
	flow_preorder_transversal_compute.
	* cfganal.c (dfst_node): Remove.
	(flow_preorder_transversal_compute): Likewise.
	* rtl.h: Remove the prototype for get_jump_table_offset.
	* rtlanal.c (get_jump_table_offset): Remove.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.192
diff -u -r1.192 basic-block.h
--- basic-block.h	25 Feb 2004 20:00:00 -0000	1.192
+++ basic-block.h	15 Mar 2004 15:10:57 -0000
@@ -376,7 +376,6 @@
 extern void clear_bb_flags (void);
 extern void flow_reverse_top_sort_order_compute (int *);
 extern int flow_depth_first_order_compute (int *, int *);
-extern void flow_preorder_transversal_compute (int *);
 extern int dfs_enumerate_from (basic_block, int,
 			       bool (*)(basic_block, void *),
 			       basic_block *, int, void *);
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.41
diff -u -r1.41 cfganal.c
--- cfganal.c	7 Feb 2004 14:14:51 -0000	1.41
+++ cfganal.c	15 Mar 2004 15:10:58 -0000
@@ -889,130 +889,6 @@
   return dfsnum;
 }
 
-struct dfst_node
-{
-    unsigned nnodes;
-    struct dfst_node **node;
-    struct dfst_node *up;
-};
-
-/* Compute a preorder transversal ordering such that a sub-tree which
-   is the source of a cross edge appears before the sub-tree which is
-   the destination of the cross edge.  This allows for easy detection
-   of all the entry blocks for a loop.
-
-   The ordering is compute by:
-
-     1) Generating a depth first spanning tree.
-
-     2) Walking the resulting tree from right to left.  */
-
-void
-flow_preorder_transversal_compute (int *pot_order)
-{
-  edge e;
-  edge *stack;
-  int i;
-  int max_successors;
-  int sp;
-  sbitmap visited;
-  struct dfst_node *node;
-  struct dfst_node *dfst;
-  basic_block bb;
-
-  /* Allocate stack for back-tracking up CFG.  */
-  stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge));
-  sp = 0;
-
-  /* Allocate the tree.  */
-  dfst = xcalloc (last_basic_block, sizeof (struct dfst_node));
-
-  FOR_EACH_BB (bb)
-    {
-      max_successors = 0;
-      for (e = bb->succ; e; e = e->succ_next)
-	max_successors++;
-
-      dfst[bb->index].node
-	= (max_successors
-	   ? xcalloc (max_successors, sizeof (struct dfst_node *)) : NULL);
-    }
-
-  /* Allocate bitmap to track nodes that have been visited.  */
-  visited = sbitmap_alloc (last_basic_block);
-
-  /* None of the nodes in the CFG have been visited yet.  */
-  sbitmap_zero (visited);
-
-  /* Push the first edge on to the stack.  */
-  stack[sp++] = ENTRY_BLOCK_PTR->succ;
-
-  while (sp)
-    {
-      basic_block src;
-      basic_block dest;
-
-      /* Look at the edge on the top of the stack.  */
-      e = stack[sp - 1];
-      src = e->src;
-      dest = e->dest;
-
-      /* Check if the edge destination has been visited yet.  */
-      if (dest != EXIT_BLOCK_PTR && ! TEST_BIT (visited, dest->index))
-	{
-	  /* Mark that we have visited the destination.  */
-	  SET_BIT (visited, dest->index);
-
-	  /* Add the destination to the preorder tree.  */
-	  if (src != ENTRY_BLOCK_PTR)
-	    {
-	      dfst[src->index].node[dfst[src->index].nnodes++]
-		= &dfst[dest->index];
-	      dfst[dest->index].up = &dfst[src->index];
-	    }
-
-	  if (dest->succ)
-	    /* Since the DEST node has been visited for the first
-	       time, check its successors.  */
-	    stack[sp++] = dest->succ;
-	}
-
-      else if (e->succ_next)
-	stack[sp - 1] = e->succ_next;
-      else
-	sp--;
-    }
-
-  free (stack);
-  sbitmap_free (visited);
-
-  /* Record the preorder transversal order by
-     walking the tree from right to left.  */
-
-  i = 0;
-  node = &dfst[ENTRY_BLOCK_PTR->next_bb->index];
-  pot_order[i++] = 0;
-
-  while (node)
-    {
-      if (node->nnodes)
-	{
-	  node = node->node[--node->nnodes];
-	  pot_order[i++] = node - dfst;
-	}
-      else
-	node = node->up;
-    }
-
-  /* Free the tree.  */
-
-  for (i = 0; i < last_basic_block; i++)
-    if (dfst[i].node)
-      free (dfst[i].node);
-
-  free (dfst);
-}
-
 /* Compute the depth first search order on the _reverse_ graph and
    store in the array DFS_ORDER, marking the nodes visited in VISITED.
    Returns the number of nodes visited.
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.465
diff -u -r1.465 rtl.h
--- rtl.h	9 Mar 2004 17:06:21 -0000	1.465
+++ rtl.h	15 Mar 2004 15:10:59 -0000
@@ -1804,7 +1804,6 @@
 extern int rtx_addr_varies_p (rtx, int);
 extern HOST_WIDE_INT get_integer_term (rtx);
 extern rtx get_related_value (rtx);
-extern rtx get_jump_table_offset (rtx, rtx *);
 extern int global_reg_mentioned_p (rtx);
 extern int reg_mentioned_p (rtx, rtx);
 extern int count_occurrences (rtx, rtx, int);
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtlanal.c,v
retrieving revision 1.184
diff -u -r1.184 rtlanal.c
--- rtlanal.c	5 Mar 2004 10:32:54 -0000	1.184
+++ rtlanal.c	15 Mar 2004 15:11:01 -0000
@@ -442,138 +442,6 @@
   return 0;
 }
 
-/* Given a tablejump insn INSN, return the RTL expression for the offset
-   into the jump table.  If the offset cannot be determined, then return
-   NULL_RTX.
-
-   If EARLIEST is nonzero, it is a pointer to a place where the earliest
-   insn used in locating the offset was found.  */
-
-rtx
-get_jump_table_offset (rtx insn, rtx *earliest)
-{
-  rtx label;
-  rtx table;
-  rtx set;
-  rtx old_insn;
-  rtx x;
-  rtx old_x;
-  rtx y;
-  rtx old_y;
-  int i;
-
-  if (!tablejump_p (insn, &label, &table) || !(set = single_set (insn)))
-    return NULL_RTX;
-
-  x = SET_SRC (set);
-
-  /* Some targets (eg, ARM) emit a tablejump that also
-     contains the out-of-range target.  */
-  if (GET_CODE (x) == IF_THEN_ELSE
-      && GET_CODE (XEXP (x, 2)) == LABEL_REF)
-    x = XEXP (x, 1);
-
-  /* Search backwards and locate the expression stored in X.  */
-  for (old_x = NULL_RTX; GET_CODE (x) == REG && x != old_x;
-       old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0))
-    ;
-
-  /* If X is an expression using a relative address then strip
-     off the addition / subtraction of PC, PIC_OFFSET_TABLE_REGNUM,
-     or the jump table label.  */
-  if (GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC
-      && (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS))
-    {
-      for (i = 0; i < 2; i++)
-	{
-	  old_insn = insn;
-	  y = XEXP (x, i);
-
-	  if (y == pc_rtx || y == pic_offset_table_rtx)
-	    break;
-
-	  for (old_y = NULL_RTX; GET_CODE (y) == REG && y != old_y;
-	       old_y = y, y = find_last_value (y, &old_insn, NULL_RTX, 0))
-	    ;
-
-	  if ((GET_CODE (y) == LABEL_REF && XEXP (y, 0) == label))
-	    break;
-	}
-
-      if (i >= 2)
-	return NULL_RTX;
-
-      x = XEXP (x, 1 - i);
-
-      for (old_x = NULL_RTX; GET_CODE (x) == REG && x != old_x;
-	   old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0))
-	;
-    }
-
-  /* Strip off any sign or zero extension.  */
-  if (GET_CODE (x) == SIGN_EXTEND || GET_CODE (x) == ZERO_EXTEND)
-    {
-      x = XEXP (x, 0);
-
-      for (old_x = NULL_RTX; GET_CODE (x) == REG && x != old_x;
-	   old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0))
-	;
-    }
-
-  /* If X isn't a MEM then this isn't a tablejump we understand.  */
-  if (GET_CODE (x) != MEM)
-    return NULL_RTX;
-
-  /* Strip off the MEM.  */
-  x = XEXP (x, 0);
-
-  for (old_x = NULL_RTX; GET_CODE (x) == REG && x != old_x;
-       old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0))
-    ;
-
-  /* If X isn't a PLUS than this isn't a tablejump we understand.  */
-  if (GET_CODE (x) != PLUS)
-    return NULL_RTX;
-
-  /* At this point we should have an expression representing the jump table
-     plus an offset.  Examine each operand in order to determine which one
-     represents the jump table.  Knowing that tells us that the other operand
-     must represent the offset.  */
-  for (i = 0; i < 2; i++)
-    {
-      old_insn = insn;
-      y = XEXP (x, i);
-
-      for (old_y = NULL_RTX; GET_CODE (y) == REG && y != old_y;
-	   old_y = y, y = find_last_value (y, &old_insn, NULL_RTX, 0))
-	;
-
-      if ((GET_CODE (y) == CONST || GET_CODE (y) == LABEL_REF)
-	  && reg_mentioned_p (label, y))
-	break;
-    }
-
-  if (i >= 2)
-    return NULL_RTX;
-
-  x = XEXP (x, 1 - i);
-
-  /* Strip off the addition / subtraction of PIC_OFFSET_TABLE_REGNUM.  */
-  if (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS)
-    for (i = 0; i < 2; i++)
-      if (XEXP (x, i) == pic_offset_table_rtx)
-	{
-	  x = XEXP (x, 1 - i);
-	  break;
-	}
-
-  if (earliest)
-    *earliest = insn;
-
-  /* Return the RTL expression representing the offset.  */
-  return x;
-}
-
 /* A subroutine of global_reg_mentioned_p, returns 1 if *LOC mentions
    a global register.  */
 


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