Nitish Srivastava via llvm-dev
2017-Sep-13 18:23 UTC
[llvm-dev] Adding pragma related metadata to only one loop
Hi everyone, I wanted to assign a new pragma for loops in clang. Let's call it "#pragma XXX" which can be applied to any loop in the entire loop hierarchy. I added the support for my pragma by following the same steps as were being used in the default implementation of "unroll" pragma. But now, when I compile any program using clang to llvm IR it attaches the pragma related metadata to the loop as well as to all the loops nested inside it. I just want to add the metadata to that particular loop and not all the loops nested inside it. Can someone suggest what would be the right way of doing this? or rather what files should I look into. So far I have made changes in the following files: 1) include/clang/Basic/Attr.td 2) include/clang/Parse/Parser.h 3) lib/CodeGen/CGLoopInfo.cpp 4) lib/CodeGen/CGLoopInfo.h 5) lib/Parse/ParsePragma.cpp 6) lib/Sema/SemaStmtAttr.cpp Any help would be appreciated. Thanks, Best Regards, Nitish -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170913/5f8b027d/attachment.html>
Nitish Srivastava via llvm-dev
2017-Sep-24 19:41 UTC
[llvm-dev] Adding pragma related metadata to only one loop
I have attached all the files that I have changed. Along with that, there is matrix-mul.c in which I am using a pragma, but that metadata for that pragma is getting applied to all the loops in the loop nest (as can be seen from .ll file). Any help would be great! Thanks a lot in advance, Best Regards, Nitish On Wed, Sep 13, 2017 at 2:23 PM, Nitish Srivastava <nks45 at cornell.edu> wrote:> Hi everyone, > > I wanted to assign a new pragma for loops in clang. Let's call it > "#pragma XXX" which can be applied to any loop in the entire loop > hierarchy. I added the support for my pragma by following the same steps as > were being used in the default implementation of "unroll" pragma. > > But now, when I compile any program using clang to llvm IR it attaches > the pragma related metadata to the loop as well as to all the loops nested > inside it. I just want to add the metadata to that particular loop and not > all the loops nested inside it. Can someone suggest what would be the right > way of doing this? or rather what files should I look into. > > So far I have made changes in the following files: > > 1) include/clang/Basic/Attr.td > 2) include/clang/Parse/Parser.h > 3) lib/CodeGen/CGLoopInfo.cpp > 4) lib/CodeGen/CGLoopInfo.h > 5) lib/Parse/ParsePragma.cpp > 6) lib/Sema/SemaStmtAttr.cpp > > Any help would be appreciated. > > Thanks, > > Best Regards, > Nitish > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: Attr.td Type: application/octet-stream Size: 100426 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0002.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: CGLoopInfo.cpp Type: text/x-c++src Size: 11684 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0003.cpp> -------------- next part -------------- A non-text attachment was scrubbed... Name: CGLoopInfo.h Type: text/x-chdr Size: 6037 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0002.h> -------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-mul.c Type: text/x-csrc Size: 1162 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0001.c> -------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-mul.ll Type: application/octet-stream Size: 23810 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0003.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: ParsePragma.cpp Type: text/x-c++src Size: 104654 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0004.cpp> -------------- next part -------------- A non-text attachment was scrubbed... Name: Parser.h Type: text/x-chdr Size: 116532 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0003.h> -------------- next part -------------- A non-text attachment was scrubbed... Name: SemaStmtAttr.cpp Type: text/x-c++src Size: 13570 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170924/ed8bb29d/attachment-0005.cpp>