This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/6] Indirect call graph edges
On Sat, Feb 13, 2010 at 7:16 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Feb 13, 2010 at 7:01 PM, Martin Jambor <mjambor@suse.cz> wrote:
>> Hi,
>>
>> this is a re-post of the same patch I already sent here in January.
>> There are only minor differences. ?I have renamed the flag
>> indirect_call to indirect_inlining_edge and changed its purpose to be
>> exactly that, an edge made direct by indirect inlining (it may go away
>> completely, I currently use it only for asserts in ipa-cp
>> devirtualization) and I have added a few things to cgraph node
>> dumping. ?Most importantly, I have re-worked streaming so that
>> information for indirect inlining associated with nodes is written to
>> the jump functions section again in order to allow the cgraph stream
>> to remain simple and concise (which means it cannot store trees).
>>
>> The patch adds a new kind of edge to the call graph to represent
>> indirect calls with unknown callees (which we hope we can determine at
>> some stage) and uses them to replace ipa_param_call_notes in
>> ipa-prop.h. ?My immediate reason to do this is to move all the
>> information there from the notes because I will need them to be in
>> memory managed by the garbage collector (and did not want
>> ipa_node_params to become garbage collected) but in a broader sense
>> this is the right thing to do because it facilitates a more general
>> approach to keep information about such calls (ipa-cp jump functions
>> and the like) that is also consistent with how we do this for direct
>> edges.
>>
>> The data structure layout (a flag and a pointer in struct cgraph_edge
>> to a another special structure) was really chosen by Honza. ?The
>> subsequent patches add some more stuff to cgraph_indirect_call_info so
>> it won't look this silly for long.
>>
>> I have successfully bootstrapped and tested this beast on x86_84-linux
>> and would like to commit something along these lines when stage1 opens
>> again. ?Obviously, I welcome any comments.
>
> The cgraph.c file at the top currently contains very brief documentation
> which needs to be updated as it says:
>
> ? ?The callgraph at the moment does not represent indirect calls or calls
> ? ?from other compilation unit.
>
> Note that I think we should have some more elaborate overall overview
> about the cgraph interface.
Btw, I wonder what the callee node of an indirect edge points to? Should
we have a way to put a cgraph node set there? In IPA mod/ref analysis
it would be useful to know which functions can be reached via an
indirect call - the conservative set should be all functions that had their
address taken (but I believe we lie here for virtual functions).
Pointer analysis could also restrict the callee set like for
void (*p)(void);
if (b)
p = foo;
else
p = bar;
(*p)();
where we know we either call foo or bar. Is there a suitable place to
note this kind of information?
Thanks,
Richard.