[LLVMdev] [PATCH] Add functionality to scc_iterator

Chris Lattner clattner at apple.com
Thu Aug 6 22:24:27 PDT 2009


On Aug 6, 2009, at 4:19 PM, Patrick Alexander Simmons wrote:

> Chris Lattner wrote:
>> On Aug 4, 2009, at 3:48 PM, Patrick Alexander Simmons wrote:
>>
>>
>>> Hi,
>>>
>>> I've been using scc_iterator, and I added the templates necessary to
>>> make it work with inverse graphs.  I also added a "bb_reachable"
>>> function to tell whether an arbitrary graph node is part of cycle.
>>> Might this be useful to others?
>>>
>>
>> Hi Patrick,
>>
>> The scc_begin/end specializations look fine.  The "bb_reachable" name
>> is not a good one though, it doesn't give any hint about what the
>> function actually does.  I don't think it is really generally useful
>> enough to include in scciterator.h
>>
>> -Chris
>>
> I agree that bb_reachable is not the best name.  How about  
> "is_in_cycle"
> instead?  I think a function to tell whether an arbitrary graph node  
> is
> part of a cycle could be useful in a variety of circumstances; is  
> there
> another header file where it would be more appropriate?

It's more of an algorithm than a datastructure.  Where else in the  
codebase would it be useful to use?  If only in one place, it is  
probably reasonable to put it near the code that uses it.

-Chris



More information about the llvm-dev mailing list