Rekha R
2013-Oct-03 19:45 UTC
[LLVMdev] A way to write new pass by keeping source and build directories separate
Hi, I was trying to write a sample optimization pass in LLVM, by following instructions in LLVM doc for Writing a New Pass. But then ran into *make*issues. The issue is with having separate *source *and *build* directories. The LLVM doc for 'Getting Started' suggests keeping the two separate, but the 'Writing a new pass' doc assumes they are merged. Hence the *make *issue. I did a bit of googling and could not find a desired solution. The solutions proposed were to combine the *source* and *build* directories. I am happy to say that I could find a solution with keeping *source *and *build *directories separate, as desired. I thought I could share it with newbies like me. 0. Download LLVM source into /llvm-src and build it into /llvm-build directories. 1. Write a new pass and Makefile as mentioned in LLVM doc 'Writing a new pass'. Assume it is created in /llvm-src/lib/Transforms/NewPass directory. 2. Modify the Makefile in /llvm-src/lib/Transforms directory by adding NewPass under PARALLEL_DIRS. 3. *make* in /llvm-build directory. 4. Thats it. If things go fine, newpass.so will be created in /llvm-build/Debug+Asserts/lib directory. 5. The new pass can be loaded by modifying the command mentioned in the LLVM doc (for Writing a new pass) as opt -load /llvm-build/Debug+Asserts/lib/newpass.so -newpass < hello.bc> /dev/nullHope this helps. -- Rekha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131004/7f55babb/attachment.html>
arrowdodger
2013-Oct-04 04:52 UTC
[LLVMdev] A way to write new pass by keeping source and build directories separate
On Oct 3, 2013 11:47 PM, "Rekha R" <rekharamapai at nitc.ac.in> wrote:> > Hi, > > I was trying to write a sample optimization pass in LLVM, by followinginstructions in LLVM doc for Writing a New Pass. But then ran into make issues. The issue is with having separate source and build directories. The LLVM doc for 'Getting Started' suggests keeping the two separate, but the 'Writing a new pass' doc assumes they are merged. Hence the make issue.> > I did a bit of googling and could not find a desired solution. Thesolutions proposed were to combine the source and build directories.> > I am happy to say that I could find a solution with keeping source andbuild directories separate, as desired. I thought I could share it with newbies like me.> > 0. Download LLVM source into /llvm-src and build it into /llvm-builddirectories.> 1. Write a new pass and Makefile as mentioned in LLVM doc 'Writing anew pass'. Assume it is created in /llvm-src/lib/Transforms/NewPass directory.> 2. Modify the Makefile in /llvm-src/lib/Transforms directory by addingNewPass under PARALLEL_DIRS.> 3. make in /llvm-build directory. > 4. Thats it. If things go fine, newpass.so will be created in/llvm-build/Debug+Asserts/lib directory.> 5. The new pass can be loaded by modifying the command mentioned in theLLVM doc (for Writing a new pass) as> > > opt -load /llvm-build/Debug+Asserts/lib/newpass.so -newpass < hello.bc >/dev/null> > Hope this helps. > > -- > Rekha > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >A long ago I've added support for developing passes outside source dir for CMake build system. There should be documentation on this. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131004/c8fcae56/attachment.html>
Rekha R
2013-Oct-04 16:07 UTC
[LLVMdev] A way to write new pass by keeping source and build directories separate
thank you for the info. Rekha On Fri, Oct 4, 2013 at 10:22 AM, arrowdodger <6yearold at gmail.com> wrote:> On Oct 3, 2013 11:47 PM, "Rekha R" <rekharamapai at nitc.ac.in> wrote: > > > > Hi, > > > > I was trying to write a sample optimization pass in LLVM, by following > instructions in LLVM doc for Writing a New Pass. But then ran into make > issues. The issue is with having separate source and build directories. The > LLVM doc for 'Getting Started' suggests keeping the two separate, but the > 'Writing a new pass' doc assumes they are merged. Hence the make issue. > > > > I did a bit of googling and could not find a desired solution. The > solutions proposed were to combine the source and build directories. > > > > I am happy to say that I could find a solution with keeping source and > build directories separate, as desired. I thought I could share it with > newbies like me. > > > > 0. Download LLVM source into /llvm-src and build it into /llvm-build > directories. > > 1. Write a new pass and Makefile as mentioned in LLVM doc 'Writing a > new pass'. Assume it is created in /llvm-src/lib/Transforms/NewPass > directory. > > 2. Modify the Makefile in /llvm-src/lib/Transforms directory by adding > NewPass under PARALLEL_DIRS. > > 3. make in /llvm-build directory. > > 4. Thats it. If things go fine, newpass.so will be created in > /llvm-build/Debug+Asserts/lib directory. > > 5. The new pass can be loaded by modifying the command mentioned in > the LLVM doc (for Writing a new pass) as > > > > > > opt -load /llvm-build/Debug+Asserts/lib/newpass.so -newpass < hello.bc > > /dev/null > > > > Hope this helps. > > > > -- > > Rekha > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > A long ago I've added support for developing passes outside source dir for > CMake build system. There should be documentation on this. >-- Rekha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131004/4406b1d4/attachment.html>
Umer
2013-Oct-07 13:28 UTC
[LLVMdev] A way to write new pass by keeping source and build directories separate
Thanks Rekha, I stumbled upon exactly the same problem, your post saved my time. Regards Umer On Thu, Oct 3, 2013 at 9:45 PM, Rekha R <rekharamapai at nitc.ac.in> wrote:> Hi, > > I was trying to write a sample optimization pass in LLVM, by following > instructions in LLVM doc for Writing a New Pass. But then ran into *make*issues. The issue is with having separate > *source *and *build* directories. The LLVM doc for 'Getting Started' > suggests keeping the two separate, but the 'Writing a new pass' doc assumes > they are merged. Hence the *make *issue. > > I did a bit of googling and could not find a desired solution. The > solutions proposed were to combine the *source* and *build* directories. > > I am happy to say that I could find a solution with keeping *source *and *build > *directories separate, as desired. I thought I could share it with > newbies like me. > > 0. Download LLVM source into /llvm-src and build it into /llvm-build > directories. > 1. Write a new pass and Makefile as mentioned in LLVM doc 'Writing a new > pass'. Assume it is created in /llvm-src/lib/Transforms/NewPass directory. > 2. Modify the Makefile in /llvm-src/lib/Transforms directory by adding > NewPass under PARALLEL_DIRS. > 3. *make* in /llvm-build directory. > 4. Thats it. If things go fine, newpass.so will be created in > /llvm-build/Debug+Asserts/lib directory. > 5. The new pass can be loaded by modifying the command mentioned in the > LLVM doc (for Writing a new pass) as > > > opt -load /llvm-build/Debug+Asserts/lib/newpass.so -newpass < hello.bc > /dev/null > > Hope this helps. > > -- > Rekha > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131007/c874b991/attachment.html>
Reasonably Related Threads
- [LLVMdev] A way to write new pass by keeping source and build directories separate
- [LLVMdev] Appropriate DS for implementing worklist
- [LLVMdev] Appropriate DS for implementing worklist
- [LLVMdev] On semantics of add instruction - nsw,nuw flags
- [LLVMdev] Appropriate DS for implementing worklist