This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove node from cgraph

Please keep this on the list.

On Wed, Jan 23, 2013 at 5:52 PM, Chassin <> wrote:
> On 01/23/2013 10:55 AM, Richard Biener wrote:
> The callgraph isn't the main data structure to modify here.  You probably
> still
> have references to the function in the IL via calls for example.  You
> probably
> want to remove all calls to the cgraph node.
> Thanks for the quick replay Sr , do you mean by removing calls the ( edges )
> ? , but  by using cgraph_remove_node it seams to delete all callee and
> callers to that node
> ....
> 01494   cgraph_node_remove_callers (node);
> 01495   cgraph_node_remove_callees (node);
> 01496   ipa_remove_all_references (&node->ref_list);
> 01497   ipa_remove_all_refering (&node->ref_list);
> ...
> in the dump file in my previous mail it shows that all edges related were
> removed , should i remove the reference in the GIMPLE body manually ? how ?

You need to remove the call stmts - they are the main representation
of the edges which
get re-built when needed.  You can iterate over the call statements
via the cgraph node
callers list of edges.  In the cgraph edge structure you'll find a
call_stmt member.  To
remove it you need to switch to the corresponding function (push/pop_cfun, use
DECL_STRUCT_FUNCTION (edge->caller->decl)) and then remove the stmt via
for example gsi_remove () after initializing an iterator via gsi_for_stmt.

That's not all of the details, you of course have to think of what to
do for other
references to the function (function pointers and later indirect
calls).  You have to
think about what the point is of removing arbitrary calls throughout a program
of course - I can't see any good reason to do this kind of stuff ;)


> cheers
> --
> Chaddy Huussin Vazquez ,
> Superior Polytechnic Institute âJose Antonio EcheverrÄaâ
> Informatics Engineering Faculty
> 48 Aniversario del Instituto Superior PolitÃcnico Josà Antonio EcheverrÃa,
> Cujae Una obra de la RevoluciÃn Cubana | 2 de diciembre de 1964 |
> Consulte la enciclopedia colaborativa cubana.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]