immediate predecessors

hi,
how to get the number of immediate predecessors for
each basic block (arguements of remarks statement at
the beginning of the basic block)

thank you
aditya

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.

Cheers!
-bw

I added this to the programmer's manual:
http://llvm.org/docs/ProgrammersManual.html#iterate_preds

-Chris