cgraph instrumentation
Chassin
chassin@ceis.cujae.edu.cu
Thu Jan 24 15:36:00 GMT 2013
On Thu, Jan 24, 2013 at 4:46 AM, Chassin <chassin@ceis.cujae.edu.cu> wrote:
> On 01/23/2013 02:37 PM, Richard Biener wrote:
>>
>> Please keep this on the list.
>>
>> On Wed, Jan 23, 2013 at 5:52 PM, Chassin <chassin@ceis.cujae.edu.cu>
>> 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 ;)
>>
>> Richard.
>>
>>> cheers
>>>
>>> --
>>> Chaddy Huussin Vazquez , Chassin@ceis.cujae.edu.cu
>>>
>>> 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 |
>>> http://cujae.edu.cu
>>>
>>>
>>> Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu
>
> Hi Ms.Richard , i am new to gcc , i got confused so by removing the edge i
> am really not doing anything !!! cuz if the call stmt still exist , did i
> understood right ?
> if so then what really the edge represent ??
Callgraph nodes and callgraph edges are a representation of functions
and call statements. The functions with their statements are the main
representation of the intermediate language ontop of which other
high-level data structures are built. The functions and their statements
are the representation to change.
> , can you provide me a sample
> code how to do that ?
No, because it's quite a nonsensical operation so there doesn't exist
an example in GCC itself I can point you to.
Richard.
48 Aniversario del Instituto Superior Politecnico Jose Antonio Echeverria, Cujae
Una obra de la Revolucion Cubana | 2 de diciembre de 1964 | http://cujae.edu.cu
Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu
More information about the Gcc
mailing list