Hi all, 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. Regards, Jorge
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.
Got it! Thanks Jorge On Saturday, November 19, 2011 at 15:16:52 (+0100), Duncan Sands wrote:>> 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. >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev