Hi,

I would like to use ipa_ref in the PASS_LIST all_late_ipa_passes to query
the statement (ref->stmt) of where a global variable is used. However, I am
having some problems achieving this.

What I do is:

1. Check that ipa_ref->referring has a body and is not inlined.
2. get_body
3. try to print out the gimple statement using print_gimple_stmt
(dump_file, ref->stmt, 0, TDF_NONE).

This all seems correct to me, but I have been receiving errors that print
is trying to print a tree with an incorrect TREE_CODE. I am assuming here
that ref->stmt is not updated after all_regular_ipa_passes, much like how
when looking at cgraph_edge the call statement is also not updated. Can
someone please tell me if this is indeed the case or what is happening here?

Also, while I think that the gimple statements might not be maintained, I
see that ipa_ref is still used in the ipa_pta pass during
all_late_ipa_passes. I see that ipa_ref->referring and ipa_ref->stmt are
not used. Instead the tree of the referred is obtained in the following
way: ref->referred->decl. I am assuming that it would be possible to use
ref->referred->decl and search for this tree everywhere in referring to
find the uses. Can someone confirm this?

Thanks!
-Erick

Reply via email to