This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: semantics of null lang_hooks.callgraph.expand_function?
Jim Wilson wrote:-
> Gary Funck wrote:
> >While working with GCC's language hooks, we found that
> >certain places in GCC test for a null value of
> >lang_hooks.callgraph.expand_function, but
> >cgraph_expand_function() calls the hook directly:
>
> When cgraph was first added, it was optional, and could be disabled if
> -fno-unit-at-a-time was used, or if the language front-end did not
> support cgraph.
>
> For a while, our intentions have been to make this mandatory, and
> eliminate the -fno-unit-at-a-time option. It appears that we have
> already reached the point where front end support for cgraph is
> mandatory, as the code no longer works when callgraph.expand_function is
> NULL. This means all of the checks for NULL are now obsolete and can be
> removed. The -fno-unit-at-a-time options still exists meanwhile, but
> will eventually be dropped.
>
> It looks like gcc-3.4 supports a NULL callgraph.expand_function hook,
> and gcc-4.0 and later do not, so I'd guess this transition happened when
> tree-ssa got merged in. Or maybe it was enabled by the tree-ssa work.
In general I think the idea with hooks, whether language or target,
was that they were all non-NULL and so we avoided this issue and
scattering conditionals everywhere. If you wanted to do nothing you
used an empty hook, which was usually the default.
Neil.