Language-independent functions-as-trees representation

Daniel Berlin dberlin@dberlin.org
Sun Jul 21 15:07:00 GMT 2002


On Sun, 21 Jul 2002, Richard Henderson wrote:

> On Sun, Jul 21, 2002 at 10:32:03AM +0200, Steven Bosscher wrote:
> > Because at that point:
> > - we have already created the temporary arrays and the code to copy 
> >   in/out the array
> > - we have already scalarized nonzero rank assignments
> > 
> > SIMPLE doesn't know about array syntax, and Fortran 95 does, remember?
> 
> I don't necessarily think this must be a hard and fast rule.
> Are there instances (aside from inlining) that could take
> advantage of optimiziation before scalarization?
> 
> I've suggested before that it may well be useful to have cases
> in which language-specific nodes may survive into SIMPLE.  We'd
> treat them as black boxes during optimization and call back
> into the front end to lower them.

Booo, hisss.
That would *screw* points-to analysis and other things quite harshly, 
unless we added language dependent hooks for it (which defeats the purpose 
of having language-independent alias analysis).

Right now, the points-to analysis will work on all languages (though from 
a f77 perspective, it doesn't handle the COMMON stuff (or whatever it's 
called.).

If I moved to a flow-sensitive alias-analysis, or some of the k-limiting 
ones (which differentiate between structure fields), i'd be kinda screwed 
depending on the "black box" nodes.

I'd rather try to avoid language-dependent stuff at all costs.

Other compilers just have some HLO (High Level Optimizer) hook that is 
language dependent, where the language can perform whatever optimizations 
can't be done well at a language-independent tree level.

The reasoning is probably:
If 99% of the language can be expressed in the  language-independent form 
that is amenable to optimization, just fine, why screw up 10 language 
independent optimizers so we can optimize the other 1% of the language 
statements  well. It makes more sense to write an optimizer at a language 
dependent level that does something smart with those 1% *before* they are 
made into  language-independent trees.

Does this add more code? Maybe.
Does it give you better optimization, and cleaner maintenance of language 
independent stuff? yes.



 > > > > r~
> 
> 



More information about the Gcc mailing list