Modifying GIMPLE/SSA tree to collect memory accesses

Srinivas Pasupuleti
Sun Feb 7 09:11:00 GMT 2010


I have written a GIMPLE pass to do memory profiling. Basically for
every GIMPLE_MODIFY_STMT, I'm including a printf statement to print
the reference of DEF and USE variables of the statement. I'm using GCC

For e.g., if the statement in gimple is
D.2761 = D.2616 + 1;

I insert printf call in GIMPLE tree just below the above statement:
printf("DEF %p, USE %p\n",&D.2761, &D.2616);

The above code works perfectly and prints all the memory references
when the optimization flag is turned off.
But when I execute with -O , I get an error at expand_expr_addr_expr_1 expr.c file.

Could anyone help as to what is happening....Ideally I want to run my
pass on SSA and SSA is built only upon -O flag.

Where should I be inserting my pass in passes.c.


More information about the Gcc-help mailing list