[LLVMdev] GlobalsModRef

Duncan Sands baldrick at free.fr
Sat Nov 19 06:16:52 PST 2011


Hi Jorge,

> I'm implementing an intra-procedural analysis. For correctness, during
> the analysis of each function I need to know which global variables
> may be modified by other functions in order to avoid wrong assumptions
> about those variables.
>
> I looked at lib/Analysis/IPA/GlobalsModRef.cpp and it seems that it
> does what I want. My problem is that I don't know how to use it ;-(
>
> I wrote a pass:
>
>    struct MyPass : public FunctionPass {
>      ....
>      virtual void getAnalysisUsage(AnalysisUsage&  AU) const {
>         AU.addRequired<GlobalsModRef>();
>         ...
>      }
>      ...
>    }
>
> but then I don't know which header file should I include. Otherwise, I
> get the obvious error that "GlobalsModRef was not declared in this
> scope"
>
> Sorry because it's a basic question but I looked for any client of
> GlobalsModRef in the llvm tree but it seems nobody uses it.

I think the reason for that is that you are supposed to use the generic
alias analysis interface.  This then queries any present alias analyses
(like GlobalsModRef) for you.

Ciao, Duncan.



More information about the llvm-dev mailing list