Hi Renato, Thanks for the help. I am trying to follow the AST way. I tried seeing the AST contents by using following command: *clang -Xclang -ast-dump -fsyntax-only loop.c* This is giving me some AST output( I believe so) but I am having two issue: 1. I am not able to put this output in a file as Its showing following error: *yaduveer at yaduveer-Inspiron-3542:~/RP$ clang -Xclang -ast-dump -fsyntax-only loop1d.c | llvm-dis -o ast.txt* *llvm-dis: Invalid bitcode signature* *clang: error: unable to execute command: Broken pipe* *clang: error: clang frontend command failed due to signal (use -v to see invocation)* *clang version 3.6.0 (trunk 225627) (llvm/trunk 225626)* *Target: x86_64-unknown-linux-gnu* *Thread model: posix* *clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ <http://llvm.org/bugs/> and include the crash backtrace, preprocessed source, and associated run script.* *clang: note: diagnostic msg: * ********************** *PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:* *Preprocessed source(s) and associated run script(s) are located at:* *clang: note: diagnostic msg: /tmp/loop1d-71cd19.c* *clang: note: diagnostic msg: /tmp/loop1d-71cd19.sh* *clang: note: diagnostic msg: * ********************** 2. I don't know whether this AST output is correct or not as I am seeing very large output compared to my small input program( file loop1d.c). Could you please advise me on following queries: a) Is there some way so that I can get dependency analysis of AST and Basic Blocks. b) How can I modify an existing pass by writing a new Pass just like "Hello" pass but the dependencies involved in that pass must not show error like "reclaration" ( As I tried with "LoopUnrollPass" in beginning.) Regards, Yaduveer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150513/129df94c/attachment.html>
On Wed, May 13, 2015 at 12:25 PM, yaduveer singh <yaduveer99 at gmail.com> wrote:> Hi Renato, > > Thanks for the help. > > I am trying to follow the AST way. I tried seeing the AST contents by > using following command: > > *clang -Xclang -ast-dump -fsyntax-only loop.c* > > This is giving me some AST output( I believe so) but I am having two issue: > > 1. I am not able to put this output in a file as Its showing following > error: > > *yaduveer at yaduveer-Inspiron-3542:~/RP$ clang -Xclang -ast-dump > -fsyntax-only loop1d.c | llvm-dis -o ast.txt* > *llvm-dis: Invalid bitcode signature* > *clang: error: unable to execute command: Broken pipe* > *clang: error: clang frontend command failed due to signal (use -v to see > invocation)* > *clang version 3.6.0 (trunk 225627) (llvm/trunk 225626)* > *Target: x86_64-unknown-linux-gnu* > *Thread model: posix* > *clang: note: diagnostic msg: PLEASE submit a bug report to > http://llvm.org/bugs/ <http://llvm.org/bugs/> and include the crash > backtrace, preprocessed source, and associated run script.* > *clang: note: diagnostic msg: * > ********************** > > *PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:* > *Preprocessed source(s) and associated run script(s) are located at:* > *clang: note: diagnostic msg: /tmp/loop1d-71cd19.c* > *clang: note: diagnostic msg: /tmp/loop1d-71cd19.sh* > *clang: note: diagnostic msg: * > > ********************** > > 2. I don't know whether this AST output is correct or not as I am seeing > very large output compared to my small input program( file loop1d.c). >llvm-dis works on LLVM bitcode and not on clang ASTs. You are mixing frontend and LLVM IR. Please see http://llvm.org/docs/CommandGuide/llvm-dis.html for more info. Regards, Suyog -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150513/71a1acda/attachment.html>
On 13 May 2015 at 07:55, yaduveer singh <yaduveer99 at gmail.com> wrote:> 2. I don't know whether this AST output is correct or not as I am seeing > very large output compared to my small input program( file loop1d.c).ASTs are normally multiple times larger than source code, as they contain a lot of semantics and cross references between the statements. I recommend you to start a new thread at cfe-dev at cs.uiuc.edu (the Clang mailing list) to learn how to detect AST patterns to add your undercover OpenMP pragmas to loops. More importantly, how to do that in an out-of-tree patch, or even as a Clang extra tool. They'll be able to help you a lot more than this crowd. :) cheers, --renato
Hi Renato, I have started a new thread regarding AST as per your suggestion. I have one more query. Could you please suggest me some command to see "dependency analysis" of "basis blocks" in IR. I mean something by which I can understand how Basis Blocks are connected? Regards, Yaduveer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150513/8bcd0b17/attachment.html>