> On Wed, Sep 25, 2002 at 10:28:58PM +0200, Edi Weitz wrote:
> >
> > Wouldn't that be also an option for CL compilers? Are there any CL
> > implementations out there which do "peephole" optimizations?
I know that at least GCL does indirectly, because it compiles to C and
then use gcc, which does peephole optimizations and a lot of other
things.
They have been thinking on using the back end of gcc directly (without
going through C) as do the other compilers of the gcc family, most
notably the java compiler gcj.
See
http://mail.gnu.org/pipermail/gcl-devel/2002-June/000685.html
and
http://gcc.gnu.org/java/
Matthew Danish <[EMAIL PROTECTED]> writes:
> Example: (this is a very common and simple sequence, occurring along
> VOP boundaries)
>
> As the code is being emitted, it might look like this:
>
> L1: MOV EBX, ESP
> L2: MOV ESP, EBX
>
> Right now, nothing can be optimized here, due to the possible branch to
> L2.
>
> But later on, when labels are resolved and unnecessary ones eliminated,
> it might look like this:
>
> L1: MOV EBX, ESP
> MOV ESP, EBX
>
> Now, clearly, the second instruction is extraneous.
...and looks pretty embarrassing in a disassemble :-) I don't think
such an extraneous instruction can slow down much, BTW (since it does
not access memory).
> In any case I haven't had much time lately to work on it, but I do mean
> to get around to it sometime. Been hacking around with the SBCL
> sources, but this should be transferable back to CMUCL. I'm not a
> Python expert, so if someone who knows better than me thinks this
> approach is wrong, please let me know.
I don't know that much about Python either, but I would cautiously
guess that it might be better to first get it to gather the assembly,
so that you can do peepholing and all the other things that can be
done at this level. See for example
http://www.dmst.aueb.gr/dds/pubs/jrnl/1999-SIGPLAN-Optim/html/patop.html
Regards,
Mario.
P.S : I wonder: is this list still the right place for this
discussion?