This is an archive of the discontinued LLVM Phabricator instance.

[IR] Add GraphTraits specializations for Value def-use graphs
Needs ReviewPublic

Authored by eush on Feb 21 2019, 1:22 AM.

Details

Summary

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.

Diff Detail

Event Timeline

eush created this revision.Feb 21 2019, 1:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2019, 1:22 AM