Hi aditya, <br>There are two ways to cound the number of predecessors for each basic block. <br>You can generate the control flow graph using the CallGraphScc pass with the granularity of basic block and can simply traverse the graph bottom up till the root. The number of nodes encountered would be the number of predecessors. 
<br><br>The second way would be to use the special ;preds  marker in the llvm IR. Each basic block starts with this line which details the name of its predecessor blocks<br><br>for example<br><br>bb5:   ; preds bb2, bb3<br>
<br>thus bb5 is preceeded by bb2 and bb3. <br><br>but, one word of caution, even bb2 and bb3 can be preceeded by some other basic blocks, thus the count for bb5 (number of predecessors) won't be 2, but would be more (depends upon the predecessors of bb2 and bb3).
<br><br>You can also try to utilize the branching info at the end of each basic block in llvmIR of the source. <br><br>I am working on something similar, do let me know if u need some specific information.<br><br>Regards<br>
Prabhat<br><br><br><br><div class="gmail_quote">On Dec 20, 2007 11:36 AM, aditya vishnubhotla <<a href="mailto:vvaditya12@yahoo.com">vvaditya12@yahoo.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br><br>I want to know<br><br>How to count the number of predecessors for each basic<br>block?<br><br>Thank You<br><div class="WgoR0d"><br><br><br>      ____________________________________________________________________________________
<br>Never miss a thing.  Make Yahoo your home page.<br><a href="http://www.yahoo.com/r/hs" target="_blank">http://www.yahoo.com/r/hs</a><br>_______________________________________________<br>LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></blockquote></div><br>