Hi LLVM Delveloper, i've been working on LLVM and Clang to get basic block information. The CFG supports Visitors (CFG.h) but i might want to ask that is there any code sample available so that i can get the things easily.. Regards, Kulkarni Ashish A. College of engineering, Pune India. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130319/6157a18a/attachment.html>
Hi, Example on how to iterate over CFG, take a look at DominanceFrontier.cpp. You can further implement easily a traverse graph algorithm. On Tue, Mar 19, 2013 at 2:35 PM, Ashish Kulkarni < ashish-kulkarni at hotmail.com> wrote:> Hi LLVM Delveloper, > i've been working on LLVM and Clang to get basic block information. > The CFG supports Visitors (CFG.h) but i might want to ask that is there > any code sample available so that i can get the things easily.. > > Regards, > Kulkarni Ashish A. > College of engineering, Pune > India. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- Best regards, Alexandru Ionut Diaconescu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130319/5f9311e6/attachment.html>
To get definitions before uses (apart from PHI nodes), use ReversePostOrderTraversal: #include <llvm/ADT/PostOrderIterator.h> ReversePostOrderTraversal<Function*> rpot((Function *)&func); for (ReversePostOrderTraversal<Function*>::rpo_iterator bi rpot.begin(), be = rpot.end(); bi != be; ++bi) { (*bi)->dump(); } On 03/19/2013 10:46 AM, Alexandru Ionut Diaconescu wrote:> Hi, > > Example on how to iterate over CFG, take a look at > |DominanceFrontier.cpp|. > > You can further implement easily a traverse graph algorithm. > > On Tue, Mar 19, 2013 at 2:35 PM, Ashish Kulkarni > <ashish-kulkarni at hotmail.com <mailto:ashish-kulkarni at hotmail.com>> wrote: > > Hi LLVM Delveloper, > i've been working on LLVM and Clang to get basic block > information. The CFG supports Visitors (CFG.h) but i might want to > ask thatis there any code sample available so that i can get the > things easily.. > > Regards, > Kulkarni Ashish A. > College of engineering, Pune > India. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > -- > Best regards, > Alexandru Ionut Diaconescu > > > _______________________________________________ > 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/20130319/5f7aa154/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Basic Block code sample
- [LLVMdev] A way to traverse machine basic blocks in order?
- [LLVMdev] A way to traverse machine basic blocks in order?
- [LLVMdev] Extracting Basic Blocks/CFG from LLVM/clang
- [LLVMdev] Any passes that work on extended basic blocks?