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]

[patch] mark_jump_label and labels in MEMs


This is split out from my ppc patch.  It makes mark_jump_label do a better job
of finding labels referenced in MEMs, even if they are not of the form (mem
(symbol_ref)).  This patch makes jump keep a flag as it recurses to indicate
that we are in a MEM, and thus catch any constant_pool_reference in this case.

Ok?
			-Clint

2000-02-03  Clinton Popetz  <cpopetz@cygnus.com>

	* jump.c (mark_jump_label): Add in_mem param, check SYMBOL_REFs
	when in_mem is set.  Update all callers.

Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.105
diff -c -2 -p -r1.105 jump.c
*** jump.c	2000/02/02 09:41:03	1.105
--- jump.c	2000/02/03 22:11:43
*************** static void do_cross_jump		PARAMS ((rtx,
*** 119,123 ****
  static int jump_back_p			PARAMS ((rtx, rtx));
  static int tension_vector_labels	PARAMS ((rtx, int));
! static void mark_jump_label		PARAMS ((rtx, rtx, int));
  static void delete_computation		PARAMS ((rtx));
  static void delete_from_jump_chain	PARAMS ((rtx));
--- 119,123 ----
  static int jump_back_p			PARAMS ((rtx, rtx));
  static int tension_vector_labels	PARAMS ((rtx, int));
! static void mark_jump_label		PARAMS ((rtx, rtx, int, int));
  static void delete_computation		PARAMS ((rtx));
  static void delete_from_jump_chain	PARAMS ((rtx));
*************** mark_all_labels (f, cross_jump)
*** 2273,2277 ****
      if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
        {
! 	mark_jump_label (PATTERN (insn), insn, cross_jump);
  	if (! INSN_DELETED_P (insn) && GET_CODE (insn) == JUMP_INSN)
  	  {
--- 2273,2277 ----
      if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
        {
! 	mark_jump_label (PATTERN (insn), insn, cross_jump, 0);
  	if (! INSN_DELETED_P (insn) && GET_CODE (insn) == JUMP_INSN)
  	  {
*************** duplicate_loop_exit_test (loop_start)
*** 2772,2776 ****
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
  	  
! 	  mark_jump_label (PATTERN (copy), copy, 0);
  	  
  	  /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
--- 2772,2776 ----
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
  	  
! 	  mark_jump_label (PATTERN (copy), copy, 0, 0);
  	  
  	  /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
*************** duplicate_loop_exit_test (loop_start)
*** 2790,2794 ****
  	  if (reg_map)
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
! 	  mark_jump_label (PATTERN (copy), copy, 0);
  	  if (REG_NOTES (insn))
  	    {
--- 2790,2794 ----
  	  if (reg_map)
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
! 	  mark_jump_label (PATTERN (copy), copy, 0, 0);
  	  if (REG_NOTES (insn))
  	    {
*************** duplicate_loop_exit_test (loop_start)
*** 2833,2837 ****
  	first_copy = copy;
  
!       mark_jump_label (PATTERN (copy), copy, 0);
        if (INSN_UID (copy) < max_jump_chain
  	  && INSN_UID (JUMP_LABEL (copy)) < max_jump_chain)
--- 2833,2837 ----
  	first_copy = copy;
  
!       mark_jump_label (PATTERN (copy), copy, 0, 0);
        if (INSN_UID (copy) < max_jump_chain
  	  && INSN_UID (JUMP_LABEL (copy)) < max_jump_chain)
*************** tension_vector_labels (x, idx)
*** 3863,3870 ****
  
  static void
! mark_jump_label (x, insn, cross_jump)
       register rtx x;
       rtx insn;
       int cross_jump;
  {
    register RTX_CODE code = GET_CODE (x);
--- 3863,3871 ----
  
  static void
! mark_jump_label (x, insn, cross_jump, in_mem)
       register rtx x;
       rtx insn;
       int cross_jump;
+      int in_mem;
  {
    register RTX_CODE code = GET_CODE (x);
*************** mark_jump_label (x, insn, cross_jump)
*** 3879,3883 ****
      case SUBREG:
      case CONST_INT:
-     case SYMBOL_REF:
      case CONST_DOUBLE:
      case CLOBBER:
--- 3880,3883 ----
*************** mark_jump_label (x, insn, cross_jump)
*** 3886,3893 ****
  
      case MEM:
        /* If this is a constant-pool reference, see if it is a label.  */
!       if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
! 	  && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
! 	mark_jump_label (get_pool_constant (XEXP (x, 0)), insn, cross_jump);
        break;
  
--- 3886,3899 ----
  
      case MEM:
+       in_mem = 1;
+       break;
+ 
+     case SYMBOL_REF:
+       if (!in_mem)
+         return;
+ 
        /* If this is a constant-pool reference, see if it is a label.  */
!       if (CONSTANT_POOL_ADDRESS_P (x))
!         mark_jump_label (get_pool_constant (x), insn, cross_jump, in_mem);
        break;
  
*************** mark_jump_label (x, insn, cross_jump)
*** 3975,3979 ****
  
  	  for (i = 0; i < XVECLEN (x, eltnum); i++)
! 	    mark_jump_label (XVECEXP (x, eltnum, i), NULL_RTX, cross_jump);
  	}
        return;
--- 3981,3986 ----
  
  	  for (i = 0; i < XVECLEN (x, eltnum); i++)
! 	    mark_jump_label (XVECEXP (x, eltnum, i), NULL_RTX, 
!                     cross_jump, in_mem);
  	}
        return;
*************** mark_jump_label (x, insn, cross_jump)
*** 3987,3996 ****
      {
        if (fmt[i] == 'e')
! 	mark_jump_label (XEXP (x, i), insn, cross_jump);
        else if (fmt[i] == 'E')
  	{
  	  register int j;
  	  for (j = 0; j < XVECLEN (x, i); j++)
! 	    mark_jump_label (XVECEXP (x, i, j), insn, cross_jump);
  	}
      }
--- 3994,4003 ----
      {
        if (fmt[i] == 'e')
! 	mark_jump_label (XEXP (x, i), insn, cross_jump, in_mem);
        else if (fmt[i] == 'E')
  	{
  	  register int j;
  	  for (j = 0; j < XVECLEN (x, i); j++)
! 	    mark_jump_label (XVECEXP (x, i, j), insn, cross_jump, in_mem);
  	}
      }


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