This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Dropping of old loop optimizer
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- Cc: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>,tm_gccmail at mail dot kloo dot net,gcc at gcc dot gnu dot org,m dot hayes at elec dot canterbury dot ac dot nz,rth at redhat dot com,law at redhat dot com,dan at dberlin dot org,jh at suse dot cz
- Date: Thu, 27 Feb 2003 14:43:23 -0500
- Subject: Re: Dropping of old loop optimizer
On Thursday, February 27, 2003, at 12:13 PM, Pop Sébastian wrote:
On Thu, Feb 27, 2003 at 05:39:17PM +0100, Zdenek Dvorak wrote:
The problem I see is that rtl ssa is broken (or never worked?); but
Last time I had a close look at rtl was about two years ago :-)
Dan is the expert to ask about the status of SSA at rtl level (he
adapted
the CCP code from rtl to tree-ssa).
The problem with RTL SSA is hard registers and subregs.
There are hard registers assigned in certain cases during initial RTL
generation.
These can't be renamed, obviously.
You run into difficulties with subregs as well (in relation to liveness
and renaming).
Thus, one has the following options:
1. Ignore them while creating SSA, and make sure optimizers don't touch
them. (not clean)
2. Perform magic to save and restore the pieces of code using them.
(not clean, not easy)
3. Don't generate hard registers until after SSA is done with (not all
that easy, but could be done), and don't ever generate subregs (not
really possible without severely rearchitecting RTL).
The reason we need subregs is because of how we do registers.
Most compilers do the reverse of what we do in relation to registers.
We have a single operator, like SET, and multiple register modes/sizes
that can be operands.
So to get a full register copy, one simply does something like
(set (reg:SI 50) (reg:SI 52))
And to get a piece of a register, one needs a subregister operator.
like
(set (reg:SI 50) (subreg:SI (reg:DI 51) 0))
Most compilers have multiple operators (one for each size), and no
register sizes.
So to get a full register copy, they do:
(set:DIDI (reg 50) (reg 51))
and to get a piece of a register, they do
(set:SIDI (reg 50) (reg 51))
Now consider trying to set a piece of a register
we would do:
(set (subreg:SI (reg:DI 51)) (reg:SI 50))
which is very hard to think about how to rename into SSA (because it's
a partial assignment, and the subreg itself has no name)
while they would do:
(set:DISI (reg 51) (reg 50))
which is still a full def, and easy to rename.
Get it?
perhaps we could do this kind of optimizations just on trees (that
unfortunately also aren't ready for serious usage yet, right?)?
CCP (Conditional constant propagation) and
DCE (Dead code elimination)
seem to work fine on tree-SSA.
and PRE *will* work fine just as soon as Andrew finishes and posts the
insertion code.
--Dan