verify_local_live_at_start cleanup

Richard Henderson rth@redhat.com
Tue Jan 29 14:20:00 GMT 2002


I hit the one case in which we still aborted without
dumping anything to the file, was annoyed, and fixed it.

In addition, we now only dump the one miscompiled block
instead of the whole function.  Which, at least for the
case I was looking at, was more useful.


r~


        * flow.c (print_rtl_and_abort): Remove.
        (print_rtl_and_abort_fcn): Remove.
        (verify_local_live_at_start): Use dump_bb instead.
        (verify_wide_reg): Likewise. Take a basic_block, not rtl endpoints.
        (verify_wide_reg_1): Return 2 on mode test failure.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.503
diff -c -p -d -r1.503 flow.c
*** flow.c	2002/01/25 19:46:43	1.503
--- flow.c	2002/01/29 17:43:07
*************** struct propagate_block_info
*** 280,293 ****
     new elements on the floor.  */
  #define MAX_MEM_SET_LIST_LEN	100
  
- /* Have print_rtl_and_abort give the same information that fancy_abort
-    does.  */
- #define print_rtl_and_abort() \
-   print_rtl_and_abort_fcn (__FILE__, __LINE__, __FUNCTION__)
- 
  /* Forward declarations */
  static int verify_wide_reg_1		PARAMS ((rtx *, void *));
! static void verify_wide_reg		PARAMS ((int, rtx, rtx));
  static void verify_local_live_at_start	PARAMS ((regset, basic_block));
  static void notice_stack_pointer_modification_1 PARAMS ((rtx, rtx, void *));
  static void notice_stack_pointer_modification PARAMS ((rtx));
--- 280,288 ----
     new elements on the floor.  */
  #define MAX_MEM_SET_LIST_LEN	100
  
  /* Forward declarations */
  static int verify_wide_reg_1		PARAMS ((rtx *, void *));
! static void verify_wide_reg		PARAMS ((int, basic_block));
  static void verify_local_live_at_start	PARAMS ((regset, basic_block));
  static void notice_stack_pointer_modification_1 PARAMS ((rtx, rtx, void *));
  static void notice_stack_pointer_modification PARAMS ((rtx));
*************** static void mark_used_regs		PARAMS ((str
*** 335,344 ****
  						 rtx, rtx, rtx));
  void dump_flow_info			PARAMS ((FILE *));
  void debug_flow_info			PARAMS ((void));
- static void print_rtl_and_abort_fcn	PARAMS ((const char *, int,
- 						 const char *))
- 					ATTRIBUTE_NORETURN;
- 
  static void add_to_mem_set_list		PARAMS ((struct propagate_block_info *,
  						 rtx));
  static void invalidate_mems_from_autoinc PARAMS ((struct propagate_block_info *,
--- 330,335 ----
*************** life_analysis (f, file, flags)
*** 510,516 ****
  }
  
  /* A subroutine of verify_wide_reg, called through for_each_rtx.
!    Search for REGNO.  If found, abort if it is not wider than word_mode.  */
  
  static int
  verify_wide_reg_1 (px, pregno)
--- 501,508 ----
  }
  
  /* A subroutine of verify_wide_reg, called through for_each_rtx.
!    Search for REGNO.  If found, return 2 if it is not wider than
!    word_mode.  */
  
  static int
  verify_wide_reg_1 (px, pregno)
*************** verify_wide_reg_1 (px, pregno)
*** 523,556 ****
    if (GET_CODE (x) == REG && REGNO (x) == regno)
      {
        if (GET_MODE_BITSIZE (GET_MODE (x)) <= BITS_PER_WORD)
! 	abort ();
        return 1;
      }
    return 0;
  }
  
  /* A subroutine of verify_local_live_at_start.  Search through insns
!    between HEAD and END looking for register REGNO.  */
  
  static void
! verify_wide_reg (regno, head, end)
       int regno;
!      rtx head, end;
  {
    while (1)
      {
!       if (INSN_P (head)
! 	  && for_each_rtx (&PATTERN (head), verify_wide_reg_1, &regno))
! 	return;
        if (head == end)
  	break;
        head = NEXT_INSN (head);
      }
  
-   /* We didn't find the register at all.  Something's way screwy.  */
    if (rtl_dump_file)
!     fprintf (rtl_dump_file, "Aborting in verify_wide_reg; reg %d\n", regno);
!   print_rtl_and_abort ();
  }
  
  /* A subroutine of update_life_info.  Verify that there are no untoward
--- 515,557 ----
    if (GET_CODE (x) == REG && REGNO (x) == regno)
      {
        if (GET_MODE_BITSIZE (GET_MODE (x)) <= BITS_PER_WORD)
! 	return 2;
        return 1;
      }
    return 0;
  }
  
  /* A subroutine of verify_local_live_at_start.  Search through insns
!    of BB looking for register REGNO.  */
  
  static void
! verify_wide_reg (regno, bb)
       int regno;
!      basic_block bb;
  {
+   rtx head = bb->head, end = bb->end;
+ 
    while (1)
      {
!       if (INSN_P (head))
! 	{
! 	  int r = for_each_rtx (&PATTERN (head), verify_wide_reg_1, &regno);
! 	  if (r == 1)
! 	    return;
! 	  if (r == 2)
! 	    break;
! 	}
        if (head == end)
  	break;
        head = NEXT_INSN (head);
      }
  
    if (rtl_dump_file)
!     {
!       fprintf (rtl_dump_file, "Register %d died unexpectedly.\n", regno);
!       dump_bb (bb, rtl_dump_file);
!     }
!   abort ();
  }
  
  /* A subroutine of update_life_info.  Verify that there are no untoward
*************** verify_local_live_at_start (new_live_at_
*** 570,581 ****
  	  if (rtl_dump_file)
  	    {
  	      fprintf (rtl_dump_file,
! 		       "live_at_start mismatch in bb %d, aborting\n",
  		       bb->index);
- 	      debug_bitmap_file (rtl_dump_file, bb->global_live_at_start);
  	      debug_bitmap_file (rtl_dump_file, new_live_at_start);
  	    }
! 	  print_rtl_and_abort ();
  	}
      }
    else
--- 571,583 ----
  	  if (rtl_dump_file)
  	    {
  	      fprintf (rtl_dump_file,
! 		       "live_at_start mismatch in bb %d, aborting\nNew:\n",
  		       bb->index);
  	      debug_bitmap_file (rtl_dump_file, new_live_at_start);
+ 	      fputs ("Old:\n", rtl_dump_file);
+ 	      dump_bb (bb, rtl_dump_file);
  	    }
! 	  abort ();
  	}
      }
    else
*************** verify_local_live_at_start (new_live_at_
*** 591,604 ****
  	  if (REGNO_REG_SET_P (bb->global_live_at_start, i))
  	    {
  	      if (rtl_dump_file)
! 		fprintf (rtl_dump_file,
! 			 "Register %d died unexpectedly in block %d\n", i,
! 			 bb->index);
! 	      print_rtl_and_abort ();
  	    }
  
            /* Verify that the now-live register is wider than word_mode.  */
! 	  verify_wide_reg (i, bb->head, bb->end);
  	});
      }
  }
--- 593,608 ----
  	  if (REGNO_REG_SET_P (bb->global_live_at_start, i))
  	    {
  	      if (rtl_dump_file)
! 		{
! 		  fprintf (rtl_dump_file,
! 			   "Register %d died unexpectedly.\n", i);
! 		  dump_bb (bb, rtl_dump_file);
! 		}
! 	      abort ();
  	    }
  
            /* Verify that the now-live register is wider than word_mode.  */
! 	  verify_wide_reg (i, bb);
  	});
      }
  }
*************** debug_regset (r)
*** 4110,4132 ****
  {
    dump_regset (r, stderr);
    putc ('\n', stderr);
- }
- 
- /* Dump the rtl into the current debugging dump file, then abort.  */
- 
- static void
- print_rtl_and_abort_fcn (file, line, function)
-      const char *file;
-      int line;
-      const char *function;
- {
-   if (rtl_dump_file)
-     {
-       print_rtl_with_bb (rtl_dump_file, get_insns ());
-       fclose (rtl_dump_file);
-     }
- 
-   fancy_abort (file, line, function);
  }
  
  /* Recompute register set/reference counts immediately prior to register
--- 4114,4119 ----



More information about the Gcc-patches mailing list