[LLVMdev] Tracking global variables accesses

Chris Lattner sabre at nondot.org
Wed Apr 20 06:41:23 PDT 2005


On Wed, 20 Apr 2005, Vladimir Prus wrote:
> Is there any analysis in LLVM that can be used to obtain, for a function, the
> list of all global variables that may be modified as a result of a call to
> that function (taking into account any calls in those function and aliasing).
> If not, what's the best way to implement such a analysis?

No, not directly.  However, with the standard alias analysis interface, 
you can query a particular function call to see if it will modify a 
particular global (to get a list of all globals potentially modified, just 
iterate through the globals).  If your pass uses the standard alias 
analysis interface, this will allow it to work with many different aa 
implementations.

The other option is to hack the globals mod/ref alias analysis in 
Analysis/IPA to do what you want.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list