[cfe-dev] Finding Fallthrough Block in CFG

Bill Wendling via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 18 01:29:26 PST 2019


Bumping this just in case it's been missed.

On Fri, Nov 29, 2019 at 7:01 PM Bill Wendling <isanbard at gmail.com> wrote:

> I'm trying to find the "fallthrough" block in the CFG. The specific
> instance is a CFG block that ends in an "asm goto"
>
>  [B3]
>    1: int out2;
>    T: asm volatile goto ("testl %0, %0; testl %1, %2; jne %l3" : "+S"
> (out1), "+D" (out2) : "r" (out1) :  : label_true, loop);
>    Preds (1): B4
>    Succs (2): B2 B1
>
> In this case, the "loop" target is also the fallthrough block:
>
> int test2(int out1) {
>   int out2;
>
>
> * asm volatile goto("testl %0, %0; testl %1, %2; jne %l3" : "+S"(out1),
> "+D"(out2) : "r"(out1) :: label_true, loop);loop:  return out2;*
> label_true:
>   return -2;
> }
>
> From the CFG output above, it's hard to determine which of those
> successors is supposed to be the fallthrough. I could loop through the
> blocks in the CFG, but that seems unnecessarily wasteful. Is there a nicer
> way to figure this out?
>
> -bw
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191218/977d1ec5/attachment-0001.html>


More information about the cfe-dev mailing list