Hello,

> I want to write a pass to walk the gimple tree and add some intrumentation 
> code. I read the chapter 9 of "GCC Internals" document, and it seems not to 
> describe the Macros to do so.
> 
> Can I get some information about this? Specifically, if someone can show me 
> which .h file I should look at to find the Macros, that would be great. Or, 
> Is there any other pass do the similar thing(traverse the gimple tree) that 
> I can read (--I did not find)?

depending on what you need, you may use walk_tree and/or combination of
special-handling for structured statements and tsi_ iterators, at that
point.  See e.g. pass_lower_cf.

Zdenek

> ------------------------------------------------
> //in gcc.4.0.2, tree-optimize.c
>    323 void
>    324 init_tree_optimization_passes (void)
>    325 {
>    326   struct tree_opt_pass **p;
>    327
>    328 #define NEXT_PASS(PASS)  (p = next_pass_1 (p, &PASS))
>    329
>    330   p = &all_passes;
>    331   NEXT_PASS (pass_gimple);
>    332
>    333   NEXT_PASS (MYPASS_code_instrument); //this is what I want to do
>    334   //the reason I want to add the pass here is: both C/C++(any other 
> front end, later) can use this;
>    335   NEXT_PASS (pass_remove_useless_stmts);
>    336   NEXT_PASS (pass_mudflap_1);
>    337   NEXT_PASS (pass_lower_cf);
>    338   NEXT_PASS (pass_lower_eh);
>    339   NEXT_PASS (pass_build_cfg);
> ......
> }
> --------------------------------------------------------
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 

Reply via email to