[LLVMdev] First time!
Chris Lattner
sabre at nondot.org
Thu Dec 20 09:33:34 PST 2007
On Thu, 20 Dec 2007, aditya vishnubhotla wrote:
> I want to know
> How to count the number of predecessors for each basic
> block?
Use:
#include "llvm/Support/CFG.h"
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++I) {
BasicBlock *PredBB = *PI;
..
}
to walk basic block predecessors. Similarly, use succ_* for successors.
You might find this section useful:
http://llvm.org/docs/ProgrammersManual.html#common
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list