[llvm-commits] [PATCH] Enable edge pruning in PostOrderIterator.h

Sean Silva silvas at purdue.edu
Mon Jul 16 22:39:42 PDT 2012


> This patch makes it possible to prune graph edges by specializing the po_iterator_storage base class and implementing the insertEdge() function.

The presence of this customizability should be clearly documented at
the top of the file.

> It is already possible to limit the traversal to a subset of graph nodes by providing a custom SetType class, see for example the LoopBlocksTraversal class which limits a post-order traversal to blocks inside a loop.

I was recently in a position where I was evaluating whether
po_iterator was suited to something that I was doing, and after
reading the whole header I had no clue that this was possible.

Please make sure that this, the functionality you add in this patch,
and any other "goodies" are clearly documented at the top of the file
in a nice big comment (that preferably also contains a "quickstart"
example). I really, _really_ like the format that you have used in
this email for describing the feature, namely "It is possible to do X
by providing a custom Y, see for example Z which uses this
functionality to do W". The goal is that by just reading the file
header, a person can get a good idea of whether or not po_iterator is
capable of doing what they are looking for.

--Sean Silva

On Mon, Jul 16, 2012 at 8:05 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
> All,
>
> Please review the attached patch which generalizes the po_iterator class template such that it is possible to prune graph edges from the DFS traversal.
>
> It is already possible to limit the traversal to a subset of graph nodes by providing a custom SetType class, see for example the LoopBlocksTraversal class which limits a post-order traversal to blocks inside a loop. It is currently not possible to remove edges from the graph, though. For example, it would be useful to run a post-order traversal over loop blocks while omitting the back edges.
>
> This patch makes it possible to prune graph edges by specializing the po_iterator_storage base class and implementing the insertEdge() function. The patch also pulls the existing DFSetTraits trick into the po_iterator_storage base class.
>
> /jakob
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list