How can I get list of its predecessor basic blocks from a basic block? --Rajwinder Singh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100625/21c52063/attachment.html>
On 25/06/10 06:05, RAJWINDER SINGH wrote:> How can I get list of its predecessor basic blocks from a basic block?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() (http://llvm.org/doxygen/BasicBlock_8cpp_source.html#l00157) 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.> --Rajwinder Singh
On Jun 25, 2010, at 7:30 AM, Duncan Sands wrote:> On 25/06/10 06:05, RAJWINDER SINGH wrote: >> How can I get list of its predecessor basic blocks from a basic block? > > If BB is a BasicBlock*, you can get begin and end iterators using > pred_begin(BB) and pred_end(BB).Like this: :) http://llvm.org/docs/ProgrammersManual.html#iterate_preds -Chris