How to create a "finish" function for a tree opt pass
Diego Novillo
dnovillo@google.com
Fri Feb 29 20:36:00 GMT 2008
On 2/29/08 3:15 PM, Haifeng He wrote:
> What I did currently was to add my dump routine in
> toplev.c:compile_file, after finish_aliases_2
> and coverage_finish. I thought it might be nice if there is already
> some kind of method defined in the
> tree_opt_pass so that user can use to do similar finish-up work.
If you are writing an intra-procedural pass, this is not possible. Your
code will be executed once per function in the callgraph.
You can accomplish this if you are implementing an inter-procedural
pass. See for instance, pass_ipa_cp.
We don't have finalizer hooks for executing after all the functions have
been optimized. You'd have to put your code in cgraph_optimize, maybe.
Though where you put it now may be just as good. Though, I think I'd
rather see what you're trying to do first. Maybe your pass should be an
IPA pass.
Diego.
More information about the Gcc-help
mailing list