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]

[new-regalloc-branch] bugfix for `get_free_reg'



Few times ago I'm already fix similar bug.
It was:
http://gcc.gnu.org/ml/gcc-patches/2001-02/msg00063.html


If we test hard reg `c' for mode `mode' in:

    if (!TEST_HARD_REG_BIT (dont_begin_colors, c)
        && TEST_HARD_REG_BIT (free_colors, c)
        && HARD_REGNO_MODE_OK (c, mode))

then we needn't test `c' for mode `mode' anymore.

- 	if (i != size)
- 	  {
- 	    c += i;
- 	    continue;
- 	  }
- 	for (i = 1; i < size && HARD_REGNO_MODE_OK (c + i, mode); i++);
--------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We alredy have tested `c' for mode `mode'.
Test a hardreg `c+1' for mode `mode' is wrong.



Mon Jul 30 20:21:07 2001  Denis Chertykov  <denisc@overta.ru>

	* ra.c (get_free_reg): Wrong test removed.
	(reg_alloc): Fix formatting.

Index: ra.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/ra.c,v
retrieving revision 1.1.2.25
diff -c -3 -p -r1.1.2.25 ra.c
*** ra.c	2001/07/29 18:35:42	1.1.2.25
--- ra.c	2001/07/30 16:20:41
*************** get_free_reg (dont_begin_colors, free_co
*** 3124,3135 ****
  	int i, size;
  	size = HARD_REGNO_NREGS (c, mode);
  	for (i = 1; i < size && TEST_HARD_REG_BIT (free_colors, c + i); i++);
- 	if (i != size)
- 	  {
- 	    c += i;
- 	    continue;
- 	  }
- 	for (i = 1; i < size && HARD_REGNO_MODE_OK (c + i, mode); i++);
  	if (i == size)
  	  {
  	    if (size < 2 || (c & 1) == 0)
--- 3124,3129 ----
*************** reg_alloc (void)
*** 4135,4141 ****
        else
  	{
  	  allocate_reg_info (max_reg_num (), FALSE, TRUE);
! 	  reg_scan_update (get_insns(), BLOCK_END (n_basic_blocks - 1), max_regno);
  	  regclass (get_insns (), max_reg_num (), rtl_dump_file);
  	}
        dump_ra (df);
--- 4129,4136 ----
        else
  	{
  	  allocate_reg_info (max_reg_num (), FALSE, TRUE);
! 	  reg_scan_update (get_insns(), BLOCK_END (n_basic_blocks - 1),
! 			   max_regno);
  	  regclass (get_insns (), max_reg_num (), rtl_dump_file);
  	}
        dump_ra (df);


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