This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to find_reg
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch to find_reg
- From: Chandra Chavva <cchavva at cygnus dot com>
- Date: Mon, 9 Jul 2001 16:18:03 -0700 (PDT)
While running PH on Hitachi processor i noticed that SFmode uses odd
register and later for DF mode the compiler uses even register which
destroys the previous odd register value resulting in wrong value when
used the odd register later.
/* If we haven't succeeded yet,
see if some hard reg that conflicts with us
was utilized poorly by local-alloc.
If so, kick out the regs that were put there by local-alloc
so we can use it instead. */
if (best_reg < 0 && !retrying
/* Let's not bother with multi-reg allocnos. */
&& allocno[num].size == 1)
This checks if only one register is sufficent but allocno[num].size is
initailized using PSEUDO_REGNO_SIZE which is really an approximation. I
have added the following patch to double check we need only one register.
Please let me know the patch is okay to apply.
Thanks
Chandra
* global.c (find_reg): Register sizes might vary, so double-check
we only need one register.
Index: global.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/global.c,v
retrieving revision 1.68
diff -p -r1.68 global.c
*** global.c 2001/06/22 17:18:20 1.68
--- global.c 2001/07/09 23:05:37
*************** find_reg (num, losers, alt_regs_p, accep
*** 1201,1206 ****
--- 1201,1209 ----
/* Don't use a reg no good for this pseudo. */
&& ! TEST_HARD_REG_BIT (used2, regno)
&& HARD_REGNO_MODE_OK (regno, mode)
+ /* Register sizes might vary, so
+ double-check we only need one register. */
+ && HARD_REGNO_NREGS (regno, mode) == 1
#ifdef CLASS_CANNOT_CHANGE_MODE
&& ! (REG_CHANGES_MODE (allocno[num].reg)
&& (TEST_HARD_REG_BIT