[Compiler-sig] merging branches

Jeremy Hylton jeremy at alum.mit.edu
Thu Oct 20 00:00:22 CEST 2005


On 10/19/05, Neil Schemenauer <nas at arctrix.com> wrote:
> On Wed, Oct 19, 2005 at 05:08:11PM -0400, Jeremy Hylton wrote:
> > I think you're right that there is no way to treat nodes generically.
> > Perhaps we should generate some generic traversal code-- something
> > that takes an AST node and a function pointer of visitor functions.
> > It walks the AST and calls each visitor function as the node is
> > encountered (the function could be NULL in which case nothing is
> > done).  Then it would be easy to write little analyses like the one
> > for if 0:.
>
> Yes, I was thinking of doing that but worried that I might be
> overdesigning things.  Do you think that it's okay to have each
> little analysis do its own traversal or should we try to group them?
> Maybe that's premature optimization.  However, I wonder how much
> slower the new compiler is vs the old.

We're thinking the same way :-).  I share all your concerns.  Let's
try to have each do its own analysis for now, since that requires us
to write less code.  If we need to combine passes later, we can figure
it out then.

We will need to be some benchmarking at some point.  I think it's okay
if the compiler is a little slower (it's got to be just with the ast.c
pass), but I don't want it to be ridiculously slow :-).

Jeremy


More information about the Compiler-sig mailing list