> Hi,
> 
> I believe the general consensus is that lazy call graph node creation
> is no longer a good idea and a few of us have seen bugs caused by a
> creation of a node when we did not expect it.  Therefore I embarked on
> getting rid of it.  In the process I quickly realized it would be
> difficult to do that completely but it is certainly possible to weed
> it out of most places where it is not necessary.  We can then tackle
> the remaining places separately.
> 
> These patches are meant to be applied on top of
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01170.html
> 
> The first patch in the series removes the cgraph_node function.  Most
> of its callers should use already existing cgraph_get_node instead,
> for the others there are new functions:
> 
> - craph_create_node will create a node but fail on assert if there
>   already is a node for the declaration
> 
> - cgraph_get_create_node is the new lazy node creation.  I did not
>   want to continue using cgraph_node name because I really thought the
>   it was unfortunate and the new name will also help us to discourage
>   potential new uses and isolate those that we might want to convert
>   to a non-lazy way of creating nodes later.
> 
> - cgraph_do_get_node is a simple wrapper around cgraph_get_node which
>   checking_asserts that the return value is not NULL.  I found it very
>   useful while developing the patch and think it can be sometimes
>   useful even in the longer term, for example when the result is
>   stored in some data structure which is to be used later.  If the
>   general consensus is that we don't want it, it is easy to remove it
>   from the patch.

Well, I didn't quite expected we will get 3 new accesstors to the cgraph,
but I see it can be useful.  I would perhaps go with cgraph_maybe_create_node
that seems more consistent with names elsewhere, but cgraph_get_create_node
seems OK to me, too.

Thanks!
Honza

Reply via email to