[LLVMdev] [LLVMDev] [Question] about TerminatorInst

Chris Lattner clattner at apple.com
Thu Sep 2 10:05:32 PDT 2010


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





More information about the llvm-dev mailing list