LLVM:help

How can I get list of its predecessor basic blocks from a basic block?

–Rajwinder Singh

If BB is a BasicBlock*, you can get begin and end iterators using
pred_begin(BB) and pred_end(BB).

Ciao,

Duncan.

RAJWINDER SINGH wrote:

How can I get list of its predecessor basic blocks from a basic block?

I believe you can use a pred_iterator to iterate over the predecessors of a basic block.

See the implementation of BasicBlock::getUniquePredecessor() (LLVM: lib/IR/BasicBlock.cpp Source File) for an example of how to use it.

BTW, if you haven't discovered it already, the doxygen docs (http://llvm.org/doxygen/hierarchy.html) are extremely useful in figuring out how to do something in LLVM. I use them all the time.

-- John T.

Like this: :slight_smile:
http://llvm.org/docs/ProgrammersManual.html#iterate_preds

-Chris