[cfe-dev] Fwd: How to get loop in the CFG

周书林 via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 15 20:00:52 PDT 2016


You could use BlockID to record the path in CFG you have traveled.
First, get the Terminator of current BB to judge whether this is a loop
branch BB,(Such as ForStmt or WhileStmt in Terminator.getStmt() ).
Then from current BB, you travel its successors and record its BlockID.
and when there is a loop in the traveled BBs' ID, you can know that you get
an loop.

2016-01-12 16:48 GMT+08:00 Eric Lu via cfe-dev <cfe-dev at lists.llvm.org>:

>
> Hi
>
> Can i get the loop in a Cfg? Like a list of BBs   that belong to a loop.
>
>
> Best Regards!
> Eric Lew
>
>
> Sent using CloudMagic Email
> <https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.4.10&pv=4.4.2&source=email_footer_2>
>
>
>
> --
> Best Regards!
> Eric Lew
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160316/1c339495/attachment-0001.html>


More information about the cfe-dev mailing list