[LLVMdev] Machine basic blocks

Manuel Jacob me at manueljacob.de
Sat Jul 26 02:58:53 PDT 2014


Hi Vadim,

On 2014-07-26 10:04, Vadim Chugunov wrote:
> Hi,
> I have a couple of questions about MachineBasicBlocks:
> 
> - If I have a pointer to an MBB, is there an easy way to find which
> block that precedes it in the MachineFunction blocks list?  (without
> iterating through all of the MF's basic blocks)

You can use MachineBasicBlock's predecessors() method (or pred_begin() / 
pred_end()).

> - Does LLVM make any effort to ensure that MBB's predecessors and
> successors lists are semantically correct?   For example, what
> happens if an MBB "falls through" into the next block, but the next
> block is not on its' successors list?

This would be invalid.  There is a MachineVerifier pass to check for 
such errors in the machine code.

> thanks!

-Manuel



More information about the llvm-dev mailing list