This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC -- update_equiv_regs and friends
- To: law at redhat dot com
- Subject: Re: RFC -- update_equiv_regs and friends
- From: Joern Rennecke <amylaar at cambridge dot redhat dot com>
- Date: Wed, 28 Feb 2001 13:09:46 +0000 (GMT)
- Cc: gcc at gcc dot gnu dot org
> My time is very limited, so I can't take on any large scale development
> work to solve this problem. Thus, I'm thinking seriously about A, C, D,
> E & f.
I vote for G: prune the equivalences while they are made in a
machine-dependent manner. That can then also takew care of situations
where a constant is more expensive to rematerialize on a particular target
than it is in general.
Something like:
Index: local-alloc.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/local-alloc.c,v
retrieving revision 1.114
retrieving revision 1.114.6.2
diff -p -r1.114 -r1.114.6.2
*** local-alloc.c 2000/12/29 21:07:17 1.114
--- local-alloc.c 2001/02/03 04:31:03 1.114.6.2
*************** function_invariant_p (x)
*** 798,803 ****
--- 798,807 ----
into the using insn. If it succeeds, we can eliminate the register
completely. */
+ #ifndef LEGITIMATE_EQUIVALENCE
+ #define LEGITIMATE_EQUIVALENCE(X) (! rtx_varies_p (X))
+ #endif
+
static void
update_equiv_regs ()
{
*************** update_equiv_regs ()
*** 944,950 ****
if (REG_N_SETS (regno) != 1
&& (! note
! || rtx_varies_p (XEXP (note, 0))
|| (reg_equiv[regno].replacement
&& ! rtx_equal_p (XEXP (note, 0),
reg_equiv[regno].replacement))))
--- 948,954 ----
if (REG_N_SETS (regno) != 1
&& (! note
! || ! LEGITIMATE_EQUIVALENCE (XEXP (note, 0))
|| (reg_equiv[regno].replacement
&& ! rtx_equal_p (XEXP (note, 0),
reg_equiv[regno].replacement))))
*************** update_equiv_regs ()
*** 958,964 ****
/* If this register is known to be equal to a constant, record that
it is always equivalent to the constant. */
! if (note && ! rtx_varies_p (XEXP (note, 0)))
PUT_MODE (note, (enum machine_mode) REG_EQUIV);
/* If this insn introduces a "constant" register, decrease the priority
--- 962,968 ----
/* If this register is known to be equal to a constant, record that
it is always equivalent to the constant. */
! if (note && LEGITIMATE_EQUIVALENCE (XEXP (note, 0)))
PUT_MODE (note, (enum machine_mode) REG_EQUIV);
/* If this insn introduces a "constant" register, decrease the priority
Only the first punk would probably go into defaults.h, and we'd document
the stuff in tm.texi.