* Updating the CFG after function modifcation
@ 2011-07-16 6:53 Matt Davis
2011-07-16 11:18 ` Eric Botcazou
0 siblings, 1 reply; 2+ messages in thread
From: Matt Davis @ 2011-07-16 6:53 UTC (permalink / raw)
To: gcc
Hello,
I have an IPA pass (implemented as a plugin) which executes after all IPA
passes. My pass transforms functions by adding code and also modifying the
function prototypes. I have had this work on a per-function basis, via a
GIMPLE_PASS, which calls update_ssa verify_ssa and cleanup_cfg after each
function is processed. However, I have recently moved my plugin to execute
after all IPA passes, so I can iterate over the cfg of the program. The first
iteration is an analysis, and the second iteration does the transformations.
Unfortunately, I keep getting errors now, primarily a segfault in
"compute_call_stmt_bb_frequency" in the processing of the main(). The segfault
occurs because the argument 'bb' is NULL and later dereferenced. (NOTE: I do
not modify the prototype of main).
The e->call_stmt that the null basic block references is from a statement I have
removed via gsi_remove during my transformation pass. I need to clean up the
cfg somehow, after I remove the statement. My gimple pass, with this same
functionality worked fine. Something tells me that my plugin should be in a
different position. I also tried calling cleanup_tree_cfg() after my
transformation pass, still no luck
Any suggestions would be welcomed. Thanks for even reading this far.
-Matt
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Updating the CFG after function modifcation
2011-07-16 6:53 Updating the CFG after function modifcation Matt Davis
@ 2011-07-16 11:18 ` Eric Botcazou
0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2011-07-16 11:18 UTC (permalink / raw)
To: Matt Davis; +Cc: gcc
> I have an IPA pass (implemented as a plugin) which executes after all IPA
> passes. My pass transforms functions by adding code and also modifying the
> function prototypes. I have had this work on a per-function basis, via a
> GIMPLE_PASS, which calls update_ssa verify_ssa and cleanup_cfg after each
> function is processed. However, I have recently moved my plugin to execute
> after all IPA passes, so I can iterate over the cfg of the program.
Callgraph, not CFG, of the program.
> The e->call_stmt that the null basic block references is from a statement I
> have removed via gsi_remove during my transformation pass. I need to clean
> up the cfg somehow, after I remove the statement. My gimple pass, with
> this same functionality worked fine. Something tells me that my plugin
> should be in a different position. I also tried calling cleanup_tree_cfg()
> after my transformation pass, still no luck
Try invoking rebuild_cgraph_edges.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-16 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-16 6:53 Updating the CFG after function modifcation Matt Davis
2011-07-16 11:18 ` Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).