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.
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();
}