Thanks that helped me out. But now I am facing one more problem. It says : ‘llvm::ModulePass* llvm::createMyAnaPass()’ should have been declared inside ‘llvm’ but I can find no place to declare it. Where should I do it. John Criswell wrote:> ambika at cse.iitb.ac.in wrote: >> Hi, >> >> I am trying to add a pass inn LLVM, and I actually want to add it in >> source code, not just directly into object code. >> >> For that I included the lines in my file MyAna.cpp >> (llvm-2.6/lib/ana/MyAna.cpp) >> >> >> char MyAna::ID = 0; >> static RegisterPass<MyAna> X("my-aa","My Analysis"); >> static RegisterAnalysisGroup<AliasAnalysis> Y(X); >> >> ModulePass *llvm::createMyAnaPass() { return new MyAna(); } >> >> >> I also included createMyAnaPass() in Passes.h and LinkAllPasses.h >> But when I do make I get the following error : >> >> /home/ambika/llvm/llvm-obj/tools/opt/Release/opt.o: In function `global >> constructors keyed to opt.cpp': >> opt.cpp:(.text+0x1e89): undefined reference to `llvm::createMyAnaPass()' >> >> >> Am I missing out something. > Have you modified the Makefile in tools/opt to link in the library > containing your pass? Your pass doesn't appear to be placed in > libAnalysis or libTransform, so you'll need to modify the opt Makefile > to link in whatever your library's name is. > > -- John T. > >> Please help me. >> >> thanks and regards, >> Ambika >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Tue, Feb 23, 2010 at 7:17 AM, ambika <ambika at cse.iitb.ac.in> wrote:> Thanks that helped me out. > But now I am facing one more problem. It says : > > ‘llvm::ModulePass* llvm::createMyAnaPass()’ should have been declared > inside ‘llvm’ > > but I can find no place to declare it. > Where should I do it.We can do what scalar optimizations do. All scalar passes are declared in include/llvm/Transforms/Scalar.h and include/llvm-c/Transforms/Scalar.h, defined in lib/Transforms/Scalar.cpp, and used in include/llvm/LinkAllPasses.h. Jianzhou> > > John Criswell wrote: >> ambika at cse.iitb.ac.in wrote: >>> Hi, >>> >>> I am trying to add a pass inn LLVM, and I actually want to add it in >>> source code, not just directly into object code. >>> >>> For that I included the lines in my file MyAna.cpp >>> (llvm-2.6/lib/ana/MyAna.cpp) >>> >>> >>> char MyAna::ID = 0; >>> static RegisterPass<MyAna> X("my-aa","My Analysis"); >>> static RegisterAnalysisGroup<AliasAnalysis> Y(X); >>> >>> ModulePass *llvm::createMyAnaPass() { return new MyAna(); } >>> >>> >>> I also included createMyAnaPass() in Passes.h and LinkAllPasses.h >>> But when I do make I get the following error : >>> >>> /home/ambika/llvm/llvm-obj/tools/opt/Release/opt.o: In function `global >>> constructors keyed to opt.cpp': >>> opt.cpp:(.text+0x1e89): undefined reference to `llvm::createMyAnaPass()' >>> >>> >>> Am I missing out something. >> Have you modified the Makefile in tools/opt to link in the library >> containing your pass? Your pass doesn't appear to be placed in >> libAnalysis or libTransform, so you'll need to modify the opt Makefile >> to link in whatever your library's name is. >> >> -- John T. >> >>> Please help me. >>> >>> thanks and regards, >>> Ambika >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >>> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu > lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
I have done that. I have defined createMyAnaPass() in Passes.h and it is defined in MyAna.cpp and used in LinkAllPasses.h But still the error : /home/ambika/llvm/llvm-obj/tools/opt/Release/opt.o: In function `global constructors keyed to opt.cpp': opt.cpp:(.text+0x1e89): undefined reference to `llvm::createMyAnaPass()' I dont understand whats the problem. Jianzhou Zhao wrote:> On Tue, Feb 23, 2010 at 7:17 AM, ambika <ambika at cse.iitb.ac.in> wrote: > >> Thanks that helped me out. >> But now I am facing one more problem. It says : >> >> ‘llvm::ModulePass* llvm::createMyAnaPass()’ should have been declared >> inside ‘llvm’ >> >> but I can find no place to declare it. >> Where should I do it. >> > > We can do what scalar optimizations do. > > All scalar passes are declared in include/llvm/Transforms/Scalar.h and > include/llvm-c/Transforms/Scalar.h, > defined in lib/Transforms/Scalar.cpp, and used in include/llvm/LinkAllPasses.h. > > Jianzhou > > >> John Criswell wrote: >> >>> ambika at cse.iitb.ac.in wrote: >>> >>>> Hi, >>>> >>>> I am trying to add a pass inn LLVM, and I actually want to add it in >>>> source code, not just directly into object code. >>>> >>>> For that I included the lines in my file MyAna.cpp >>>> (llvm-2.6/lib/ana/MyAna.cpp) >>>> >>>> >>>> char MyAna::ID = 0; >>>> static RegisterPass<MyAna> X("my-aa","My Analysis"); >>>> static RegisterAnalysisGroup<AliasAnalysis> Y(X); >>>> >>>> ModulePass *llvm::createMyAnaPass() { return new MyAna(); } >>>> >>>> >>>> I also included createMyAnaPass() in Passes.h and LinkAllPasses.h >>>> But when I do make I get the following error : >>>> >>>> /home/ambika/llvm/llvm-obj/tools/opt/Release/opt.o: In function `global >>>> constructors keyed to opt.cpp': >>>> opt.cpp:(.text+0x1e89): undefined reference to `llvm::createMyAnaPass()' >>>> >>>> >>>> Am I missing out something. >>>> >>> Have you modified the Makefile in tools/opt to link in the library >>> containing your pass? Your pass doesn't appear to be placed in >>> libAnalysis or libTransform, so you'll need to modify the opt Makefile >>> to link in whatever your library's name is. >>> >>> -- John T. >>> >>> >>>> Please help me. >>>> >>>> thanks and regards, >>>> Ambika >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >>>> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >>