[LLVMdev] Machine basic blocks
Tim Northover
t.p.northover at gmail.com
Sat Jul 26 02:50:34 PDT 2014
Hi,
On 26 July 2014 09:04, Vadim Chugunov <vadimcn at gmail.com> wrote:
> - 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 should be able to construct a MachineFunction::iterator directly
from your basic block and move backwards/forwards using that (E.g.
"std::prev(MachineFunction::iterator(MyBB))" at its most basic).
> - Does LLVM make any effort to ensure that MBB's predecessors and successors
> lists are semantically correct?
Yes. Within a pass you can usually save up the adjustments for later
(depending on what support calls you make), but you need to maintain
this information if you're modifying the block structure.
> For example, what happens if an MBB "falls
> through" into the next block, but the next block is not on its' successors
> list?
I think that shouldn't happen and would be a bug. Is this
hypothetical, or do you have an example where we're doing this at the
moment?
Cheers.
Tim.
More information about the llvm-dev
mailing list