Patch to fix calculation of first_index_reg and last_index_reg inreload_combine ()

Matthew Hiller hiller@redhat.com
Thu Nov 9 17:21:00 GMT 2000


	This fixes a bug in a loop that appears early in reload_combine.
Presently, the architecture's last_index_reg will be set appropriately,
but its first_index_reg will remain set at its initial value of 1 no
matter what is in fact appropriate.

2000-11-09  Matthew Hiller <hiller@redhat.com>

	* reload1.c (reload_combine): Fixed calculation of
	first_index_reg, last_index_reg.

Index: reload1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload1.c,v
retrieving revision 1.236
diff -c -3 -p -r1.236 reload1.c
*** reload1.c	2000/11/07 22:49:53	1.236
--- reload1.c	2000/11/10 01:12:37
*************** static void
*** 8363,8369 ****
  reload_combine ()
  {
    rtx insn, set;
!   int first_index_reg = 1, last_index_reg = 0;
    int i;
    unsigned int r;
    int last_label_ruid;
--- 8363,8369 ----
  reload_combine ()
  {
    rtx insn, set;
!   int first_index_reg = -1, last_index_reg;
    int i;
    unsigned int r;
    int last_label_ruid;
*************** reload_combine ()
*** 8381,8394 ****
    for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
      if (TEST_HARD_REG_BIT (reg_class_contents[INDEX_REG_CLASS], r))
        {
! 	if (! first_index_reg)
  	  first_index_reg = r;
  
  	last_index_reg = r;
        }
  
    /* If no index register is available, we can quit now.  */
!   if (first_index_reg > last_index_reg)
      return;
  
    /* Set up LABEL_LIVE and EVER_LIVE_AT_START.  The register lifetime
--- 8381,8394 ----
    for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
      if (TEST_HARD_REG_BIT (reg_class_contents[INDEX_REG_CLASS], r))
        {
! 	if (first_index_reg == -1)
  	  first_index_reg = r;
  
  	last_index_reg = r;
        }
  
    /* If no index register is available, we can quit now.  */
!   if (first_index_reg == -1)
      return;
  
    /* Set up LABEL_LIVE and EVER_LIVE_AT_START.  The register lifetime



More information about the Gcc-patches mailing list