How to create a "finish" function for a tree opt pass
Haifeng He
hehaifeng2nd@gmail.com
Fri Feb 29 20:27:00 GMT 2008
On Fri, Feb 29, 2008 at 6:00 AM, Diego Novillo <dnovillo@google.com> wrote:
>
> On 2/29/08 12:16 AM, Haifeng He wrote:
> > Hi,
> >
> > I have wrote a tree pass and I would like to create a "finish" function to dump
> > the analysis results. Since the results contains some global
> > information, I want to dump them
> > after the pass has been executed though all the functions of current
> > file. Is there a good way
> > that I can do that?
>
> If you want to dump the IL after your pass is done, simply add
> TODO_dump_funcs to the todo_flags_finish field in the pass declaration.
>
> If you need to dump other information, simply do it just before
> returning from the entry point function to your pass.
>
Thanks for the response. Probably I did not say it clearly. in my
previous mail. What I wanted was something
little different. Basically, I want to dump all the RECORD_TYPE used
in all the functions of the current
compilation unit. Since a tree pass is executed at function level (if
I understood correctly),
if I dump such information at the end of my pass, a RECORD_TYPE will
be written out
multiple times if the type is used in several functions.
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.
Haifeng
>
> Diego.
>
>
More information about the Gcc-help
mailing list