Craig Topper via llvm-dev
2018-Jan-13 03:45 UTC
[llvm-dev] Integrating llvm pass with pass manager
Clang doesn’t support adding passes from the command line the way opt does. Opt has special parsing in opt.cpp for this that clang doesn’t have. I’m not sure what the correct way to do this is. I think your plugin needs to do something to tell clang/llvm when to run the pass. I’ll try to look later when I’m back at a computer. On Fri, Jan 12, 2018 at 7:00 PM 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Do you pull clang under llvm/tools and compile it as well? In theory, if > `opt` recognize the option, so does `clang -mllvm`. > > > 2018-01-12 8:47 GMT+08:00 sangeeta chowdhary <sangitachowdhary at gmail.com>: > >> Hello, >> >> I have tried giving this option like this >> >> clang -c -emit-llvm -mllvm -rdetector hello.c -c -o hello.bc >> but I am getting error " Unknown command line argument '-rdetector’.” >> >> Although same option work with opt - >> opt -rdetector hello.ll >> >> >> >> On Jan 11, 2018, at 6:41 PM, sangeeta chowdhary < >> sangitachowdhary at gmail.com> wrote: >> >> Can you please tell me when I need to give this option and how. I am >> sorry I am new to this. Thank you so much for responding. >> >> On Jan 11, 2018, at 6:28 PM, 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote: >> >> -mllvm >> >> >> >> > -- > Wei-Ren Chen (陳韋任) > Homepage: https://people.cs.nctu.edu.tw/~chenwj > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- ~Craig -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180113/d494228c/attachment.html>
David Chisnall via llvm-dev
2018-Jan-13 12:35 UTC
[llvm-dev] Integrating llvm pass with pass manager
On 13 Jan 2018, at 03:45, Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > I’m not sure what the correct way to do this is. I think your plugin needs to do something to tell clang/llvm when to run the pass. I’ll try to look later when I’m back at a computer.You need to use RegisterStandardPasses to add it to the default pipeline automatically. You can find an example here: https://github.com/CompilerTeaching/SimplePass/blob/ba5248a9ea0bd9e1fab3b1f8a5c85d6e0db57acd/SimplePass.cc#L116 David
sangeeta chowdhary via llvm-dev
2018-Jan-14 00:14 UTC
[llvm-dev] Integrating llvm pass with pass manager
I have taken SimplePass and added in Transform directory, “libLLVMSimplePass.a” is built but I can not see this pass in opt —help. I don’t even see the name of pass while registering it in the example.> On Jan 13, 2018, at 7:35 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote: > > On 13 Jan 2018, at 03:45, Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> I’m not sure what the correct way to do this is. I think your plugin needs to do something to tell clang/llvm when to run the pass. I’ll try to look later when I’m back at a computer. > > You need to use RegisterStandardPasses to add it to the default pipeline automatically. You can find an example here: > > https://github.com/CompilerTeaching/SimplePass/blob/ba5248a9ea0bd9e1fab3b1f8a5c85d6e0db57acd/SimplePass.cc#L116 > > David >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180113/8ec8b819/attachment.html>