[cfe-dev] Refactoring the dominators patch for Clang

Ted Kremenek kremenek at apple.com
Mon Nov 7 19:02:07 PST 2011


On Nov 7, 2011, at 11:38 AM, Anna Zaks wrote:

>> Second, on your comment on the approach I took. Even the current implementation of the recalculate function does not solely depend on GraphTraits. It also depends on Function::getEntryBlock or Function::front(), Function.size(), etc. Why do you think a clean implementation should only depend on GraphTraits?
> 
> That is the general idea behind GraphTraits. Each class which represents a graph implements the traits interface. The graph algorithms (dominators is one of them) rely only on that interface. I am not sure why the current implementation of dominators relies directly on the Function class methods instead of using the traits. I suspect it was just the matter of someone not having the time to implement that..
> 

I'm just catching up on this thread, but I agree 100% with Anna the we should have Dominators rely more on traits rather than specific methods in the graph object is the best way to do go.  Essentially there is an abstraction violation here that doesn't make Dominators generic enough.  What if we added a third kind of graph that we wanted to run Dominators on?  Would it need to have the same exact methods as well?  Having Dominators depend fully on trait classes gives users all the flexibility they need to adopt that algorithm to any graph data structure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111107/d9009e65/attachment.html>


More information about the cfe-dev mailing list