__attribute__((leafify))
Jan Hubicka
jh@suse.cz
Sat Jun 7 14:43:00 GMT 2003
> On Sat, 7 Jun 2003, Jan Hubicka wrote:
>
> > > On Tue, 3 Jun 2003, Joseph S. Myers wrote:
> > > While trying to address this issue I found that __attribute__((leafify))
> > > indeed does _not_ work :( The problem is we usually have thrown away the
> > > trees for the to-be inlined functions, which are not marked as to be
> > > inlined by marking the caller leafify. Ugh. I suppose this can be fixed
> > > with the unit-at-a-time global CFG? So __attribute__((leafify)) would
> > > either depend on the user marking relevant functions inline and hope
> > > the compiler does expansion in the right order (just specifying
> > > -finline-functions is not enough for moderately complex testcases) or
> > > depend on -funit-at-a-time which is not yet available for C++?
> > >
> > > Jan? Any different suggestions?
> >
> > With -funit-at-a-time it is trivial. I would like to improve the
> > inlining heuristics somewhat in this scheme (I think we can limit the
> > overall unit size growth that would solve most of our problems with code
> > size explossion with the inlining).
>
> Well, with __attribute__((leafify)) we really want to force inlining of
> all callees, ignoring any negative impact this may have. I'm currently
> looking at cgraphunit.c:cgraph_expand_functions and it looks like the
> sorting is done in the opposite direction than needed for leafify. We
> somehow need to output the leaf functions before all callees, so their
> trees are still around (or mark all callees as inlined, if that is
> easier). If its trivial, can you suggest the best way to do this?
It is always profitable to output called functions first so you can do
maximum of the analysis.
This is not major problem for leafify argument. With unit-at-a-time you
can do the analysis first - figure out what functions you will inline
into leaf functions and keep their trees around.
I guess all you need is to make the way inlining decisions are made
slightly more generic (adding a flag to cgraph_node specifying whether
the function will be inlined and set it in cgraph_optimize recursivly
for all functions reachable from leaf functions as well as for functions
inlined for other reasons) and add a hook into tree-inline so cgraphunit
can force function being inlined not only at global basis (as I do
currently via alwaysinline attribute).
I've originally planed to do these changes once unit-at-a-time is used
by all frontends that do use tree inlinining so I can kill the old
heuristics and avoid code duplication. Because the unit-at-a-time C++
seems to be running into troubles, perhaps we will do the change first.
>
> > Concerning the unit-at-a-time at C++ I am not quite sure when we will
> > reach to it. My current unit-at-a-time patch does not appear to be
> > acceptable for Mark and he has suggested more intrussive what where I am
> > not sure I will be able to implement it soon.
>
> Well, I seriously hope to see it in 3.4!
Well, me too, but I am not at all sure whether it will happen.
Honza
>
> Thanks,
>
> Richard.
More information about the Gcc
mailing list