This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Fix function body estimation
Op za 18-10-2003, om 18:10 schreef Jan Hubicka:
> > > I would also like to write generic version of estimate_num_insns.
> > > Where is full generic gramar?
> >
> > There isn't one, really. GENERIC may still have language-specific
> > stmt/expr trees. You probably want to write a version for GIMPLE
> > instead.
>
> I see. I have kind of GIMPLE version ready. I see that currently all
> frontends directly gimplieize instead of producing generic node. Is
> this the way it is supposed to work or we are going to use generic more
> commonly in future?
gfortran produces GENERIC. C and C++, AFAIU, produce GIMPLE because
they were originally written produce SIMPLE -- there wasn't anything in
between like GENERIC at the time.
I would expect that eventually most (if not all) front ends will produce
GENERIC. After all that is why there is a language-independent
gimplification pass (with langhooks).
> There is deeper problem tought.
> In general I think we ought to do some early optimization passes before
> the function body size is estimated, so the functions probably should
> get gimplified first.
The problem I see is that gimplification can sometimes produce quite a
bit of obviously redundant code, so estimating the size of a gimplified
function tree will probably be a bit pessimistic. Not sure if that'll
be a problem.
(Another option could perhaps be (at some optimization levels, say -O3?)
to partially or fully tree-optimize each function before any inlining
takes place. The tree-ssa passes are fast enough :)
> Does it seem OK if I push gimplify call to
> cgraph_analyze_function? Do we need to re-gimplify after inlining or is
> inliner already able to keep gimple gimple?
The tree inliner can keep functions in GIMPLE form. See all the calls
to keep_function_in_gimple_form() in tree-inline.c.
At one point the tree-inliner even could _only_ inline GIMPLE and keep
the function gimplified, but Jason changed that. I don't recall why.
Gr.
Steven