[LLVMdev] immediate predecessors

Bill Wendling isanbard at gmail.com
Thu Jan 3 03:04:54 PST 2008

Hi Aditya,

> how to get the number of immediate predecessors for
> each basic block (arguements of remarks statement at
> the beginning of the basic block)
Look at include/llvm/Support/CFG.h. It has a "pred_iterator"  
definition. So you can probably do something along the lines of:

	BasicBlock *BB;

	pred_iterator PI = pred_begin(BB);
	pred_iterator PE = pred_end(BB);

	for (; PI != PE; ++PI) {
	  // Do something

Do a search on the code base to see examples of its use.


More information about the llvm-dev mailing list