[PATCH] D50120: [ADT] Add some documentation for GraphTraits.

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 17:23:00 PDT 2018


timshen created this revision.
timshen added reviewers: dblaikie, asbirlea.
Herald added subscribers: dexonsmith, bixia, jlebar, sanjoy.

Add some context for GraphTraits.


https://reviews.llvm.org/D50120

Files:
  llvm/include/llvm/ADT/GraphTraits.h


Index: llvm/include/llvm/ADT/GraphTraits.h
===================================================================
--- llvm/include/llvm/ADT/GraphTraits.h
+++ llvm/include/llvm/ADT/GraphTraits.h
@@ -25,6 +25,14 @@
 // GraphTraits - This class should be specialized by different graph types...
 // which is why the default version is empty.
 //
+// GraphTraits is not designed in the most convenient and intuitive way, as it
+// started with simple and limited scenarios (aka BasicBlock), and over time
+// evolved to facncier applications (e.g. CFG and DomTree).
+//
+// One of the common "fancy" uses of GraphTraits is to create a view of a
+// physical graph. The view interprets the physical graph slightly differently
+// without incurring significant memory footprint. Such application is possible
+// by hacking on NodeRef. LoopBodyTraits is a good example.
 template<class GraphType>
 struct GraphTraits {
   // Elements to provide:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50120.158427.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180801/fd58d807/attachment.bin>


More information about the llvm-commits mailing list