<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 26, 2014 at 2:50 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div class=""><br>
On 26 July 2014 09:04, Vadim Chugunov <<a href="mailto:vadimcn@gmail.com">vadimcn@gmail.com</a>> wrote:<br>
> - If I have a pointer to an MBB, is there an easy way to find which block<br>
> that precedes it in the MachineFunction blocks list?  (without iterating<br>
> through all of the MF's basic blocks)<br>
<br>
</div>You should be able to construct a MachineFunction::iterator directly<br>
from your basic block and move backwards/forwards using that (E.g.<br>
"std::prev(MachineFunction::iterator(MyBB))" at its most basic).<br>
<div class=""><br>
> - Does LLVM make any effort to ensure that MBB's predecessors and successors<br>
> lists are semantically correct?<br>
<br>
</div>Yes. Within a pass you can usually save up the adjustments for later<br>
(depending on what support calls you make), but you need to maintain<br>
this information if you're modifying the block structure.<br>
<div class=""><br>
> For example, what happens if an MBB "falls<br>
> through" into the next block, but the next block is not on its' successors<br>
> list?<br>
<br>
</div>I think that shouldn't happen and would be a bug. Is this<br>
hypothetical, or do you have an example where we're doing this at the<br>
moment?<br></blockquote><div><br></div><div>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. <br><br></div><div>thanks,<br></div><div>Vadim<br>
</div></div></div></div>