[LLVMdev] Walking all the predecessors for a basic block
Prabhat Kumar Saraswat
prabhat.saraswat at gmail.com
Tue Jan 22 06:11:07 PST 2008
Hi all,
Is there a way to walk through ALL the predecessors of a basic block
in a CFG. I tried to iterate over the preds using this method
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++I) {
BasicBlock *PredBB = *PI;
}
but this only gives the immediate predecessors for a basic block.
For example, in this sample control flow graph.
entry -> bb1 -> bb2 -> bb4 -> return
| |
bb3 <-|
walking over the predecessors for bb2 only gives bb3 and bb1.. while i
need something like bb3 bb1 and return (i.e. walking till the root of
the CFG)
Any Ideas ?
Regards
Prabhat
More information about the llvm-dev
mailing list