[cfe-dev] Clang Control Flow Graph?

Jordan Rose jordan_rose at apple.com
Thu Aug 8 11:54:36 PDT 2013


On Aug 7, 2013, at 10:05 , Sung-Yee Guo <masoug at gmail.com> wrote:

> Good point. But the code I'm parsing never have goto statements.
> 
> I'm not actually trying to perform an exhaustive search through the CFG, I'm just starting at some block and walking up through the predecessors until I hit the ENTRY block. With the depth-first iterator, it seems to me that I should first assign special numbers to each block that follows the depth-first order and then have the walker walk up the CFG and avoid predecessors whose depth-first number is less than the current block's depth-first number (seems a bit inefficient, unless I can reassign block ids which I'm guessing is not safe?). Do you have any suggestions for alternatives?

Unless you actually need the depth-first numbers, that's functionally equivalent to just keeping a visited set. Again, SmallPtrSet will do you well.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130808/c6196f7f/attachment.html>


More information about the cfe-dev mailing list