[LLVMdev] Machine basic blocks

Vadim Chugunov vadimcn at gmail.com
Sat Jul 26 11:37:09 PDT 2014


On Sat, Jul 26, 2014 at 2:50 AM, Tim Northover <t.p.northover at gmail.com>
wrote:

> 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?
>

Hypothetical.   I am trying to figure out what my code needs to be deal
with.  Sounds like this one would not be a concern then.

thanks,
Vadim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140726/d5df1d56/attachment.html>


More information about the llvm-dev mailing list