Under what circumstances will a TerminatorInst will have multiple successors? The three methods: virtual BasicBlock *getSuccessorV(unsigned idx) const = 0; virtual unsigned getNumSuccessorsV() const = 0; virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0; are defined for the TerminatorInst class, but I cannot see why a terminator is allowed to go to different targets. Thanks, Jeff Kunkel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100902/cb47cdd3/attachment.html>
On Sep 2, 2010, at 9:46 AM, Jeff Kunkel wrote:> Under what circumstances will a TerminatorInst will have multiple successors? > > The three methods: > > virtual BasicBlock *getSuccessorV(unsigned idx) const = 0; > virtual unsigned getNumSuccessorsV() const = 0; > virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0; > > are defined for the TerminatorInst class, but I cannot see why a terminator is allowed to go to different targets.A conditional branch goes to two different basic blocks based on whether the condition is true/false. Switch can go to any number of different destinations. -Chris
Conditional branches have two targets. Indirect branches presumably have as many as there are blocks in the function whose addresses are taken. Reid On Thu, Sep 2, 2010 at 12:46 PM, Jeff Kunkel <jdkunk3 at gmail.com> wrote:> Under what circumstances will a TerminatorInst will have multiple > successors? > The three methods: > virtual BasicBlock *getSuccessorV(unsigned idx) const = 0; > virtual unsigned getNumSuccessorsV() const = 0; > virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0; > are defined for the TerminatorInst class, but I cannot see why a terminator > is allowed to go to different targets. > Thanks, > Jeff Kunkel > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Hi Jeff,> Under what circumstances will a TerminatorInst will have multiple successors?for example when it is a condition branch (two successors), an invoke (also two successors) or a switch (maybe many successors). Ciao, Duncan.
Thank you for the quick response. On Thu, Sep 2, 2010 at 1:15 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Jeff, > > > Under what circumstances will a TerminatorInst will have multiple > successors? > > for example when it is a condition branch (two successors), an invoke (also > two > successors) or a switch (maybe many successors). > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100902/fa19c894/attachment.html>