[PATCH] D58491: [IR] Add GraphTraits specializations for Value def-use graphs

Eugene Sharygin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 01:22:17 PST 2019


eush created this revision.
eush added reviewers: chandlerc, davidxl, dberlin, rnk.
Herald added a project: LLVM.

This adds GraphTraits specializations for Value type that provide
GraphTraits interface to operands (forward direction) or uses (inverse
direction) of a given Value. This allows applying graph algorithms to
use-def graphs.

Note that walking this graph in the forward direction inherently
requires dynamically casting each node to User, due to the underlying
representation of the edges.

The specializations are put in `IR/User.h` to avoid introducing a
cyclical dependency between `IR/Value.h` and `IR/User.h`.


Repository:
  rL LLVM

https://reviews.llvm.org/D58491

Files:
  include/llvm/IR/User.h
  unittests/IR/UserTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58491.187734.patch
Type: text/x-patch
Size: 5318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190221/84d8fbd4/attachment.bin>


More information about the llvm-commits mailing list