This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Post-register-allocation opportunitistic optimizer?
- From: tm <tm at mail dot kloo dot net>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, kazu at cs dot umass dot edu, joern dot rennecke at superh dot com
- Date: Fri, 3 May 2002 15:49:58 -0700 (PDT)
- Subject: Re: Post-register-allocation opportunitistic optimizer?
On Fri, 3 May 2002, Richard Henderson wrote:
> On Fri, May 03, 2002 at 02:42:02PM -0700, tm wrote:
> > If I understand correctly, define_peephole2 will optimize the first two
> > sequences (assuming they both use one hard reg apiece) and fail to
> > optimize the rest of the cases.
>
> Why do you think this? The set of live registers is recomputed
> for every independent peep2 optimization. Thus they should all
> be optimized.
Maybe I didn't communicate well.
Imagine a situation in a basic block with two hard registers free.
An analysis of the code reveals the following possible optimizations:
optimization scratch hard regs RTX_COST
opportunity required benefit
-----------------------------------------------
#1 1 3
#2 1 5
#3 2 11
In this case, if you perform optimization #1 first, then there is only
one hard register free, and only optimization #2 can be performed for a
total benefit of 3 + 5 = 8.
However, better heuristics should decide to spend the two hard registers
on optimization #3 which yields a net benefit of 11, which is better than
optimizations #1 and #2 combined.
Toshi