On Fri, 2011-02-25 at 19:57 +0000, Dave Korn wrote: > On 25/02/2011 19:21, Kyle Girard wrote: > > > I was hoping to see the assignment. > > > Looking at the gimple output there is no way to see that 'a' was > > assigned in bar(). So that it can be used in wik(). Am I > > misunderstanding something shouldn't there be a way to see the > > assignment in bar? Do I have to parse the expression statement or are > > things already optimized away and there is no way to get the information > > that I seek. > > Ah, right. Yes, the stuff you see at the GIMPLE level has already been > substantially processed compared to the original AST - operations decomposed, > constants folded, that kind of thing. For instance if (like Andrew suggests) > we add a "int x;" declaration in class A from your original example, we get: > > > void foo::bar(A&) (struct foo * const this, struct A & aa) > > { > > this->a = MEM[(const struct A &)aa]; > > } >
Ok that's starting to make a little bit more sense... > You probably need to look earlier than GIMPLE time. What plugin event are > you hooking? Currently, I try to get the earliest GIMPLE possible by using creating my own pass like this struct register_pass_info pass_info; pass_info.pass = &myPass; pass_info.reference_pass_name = all_lowering_passes->name; pass_info.ref_pass_instance_number = 0; pass_info.pos_op = PASS_POS_INSERT_AFTER; register_callback(pluginName, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); Which, if I understand correctly gets me in before any major optimization happens to the GIMPLE. But by the sounds of it I will need to go earlier somehow for some methods/functions. Is it possible to be an earlier pass and still have proper GIMPLE? or can i hook in earlier and sort of put my own artificial GIMPLE in somehow? If that is possible how would I know when the to fake the GIMPLE and when not to? Cheers, Kyle