[LLVMdev] Basic Block Predecessor
Stephan Falke
falke at iti.uka.de
Thu Nov 14 17:32:04 PST 2013
Hi Billy,
> Is there a fast way to retrieve all of the predecessors to a BasicBlock
> in a function. Specifically, is there a fast way to iterate through all
> BasicBlocks which can break to a specific BasicBlock?
CFG.h defines pred_iterator to do just this. So after including
llvm/Support/CFG.h you can iterate through the predecessors of a
BasicBlock bb using something like
for (pred_iterator PI = pred_begin(bb), E = pred_end(bb); PI != E; ++PI) {
....
}
--Stephan
More information about the llvm-dev
mailing list