Finding Fallthrough Block in CFG

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Finding Fallthrough Block in CFG

Tom Stellard via cfe-dev
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

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev