Data Dependence Graph Basics
authorBardia Mahjour <bmahjour@ca.ibm.com>
Wed, 18 Sep 2019 17:43:45 +0000 (17:43 +0000)
committerBardia Mahjour <bmahjour@ca.ibm.com>
Wed, 18 Sep 2019 17:43:45 +0000 (17:43 +0000)
commitdb800c267d8f3a4ce8dfc449b8d1d9c87708845a
tree76dbe320f137f9f670f302277d9229fa22a9efa1
parentc667cdc850c2aa821ffeedbc08c24bc985c59edd
Data Dependence Graph Basics

Summary:
This is the first patch in a series of patches that will implement data dependence graph in LLVM. Many of the ideas used in this implementation are based on the following paper:
D. J. Kuck, R. H. Kuhn, D. A. Padua, B. Leasure, and M. Wolfe (1981). DEPENDENCE GRAPHS AND COMPILER OPTIMIZATIONS.
This patch contains support for a basic DDGs containing only atomic nodes (one node for each instruction). The edges are two fold: def-use edges and memory-dependence edges.
The implementation takes a list of basic-blocks and only considers dependencies among instructions in those basic blocks. Any dependencies coming into or going out of instructions that do not belong to those basic blocks are ignored.

The algorithm for building the graph involves the following steps in order:

  1. For each instruction in the range of basic blocks to consider, create an atomic node in the resulting graph.
  2. For each node in the graph establish def-use edges to/from other nodes in the graph.
  3. For each pair of nodes containing memory instruction(s) create memory edges between them. This part of the algorithm goes through the instructions in lexicographical order and creates edges in reverse order if the sink of the dependence occurs before the source of it.

Authored By: bmahjour

Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

Reviewed By: Meinersbur, fhahn, myhsu

Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto

Tag: #llvm

Differential Revision: https://reviews.llvm.org/D65350

llvm-svn: 372238
16 files changed:
llvm/docs/DependenceGraphs/cycle.png [new file with mode: 0644]
llvm/docs/DependenceGraphs/cycle_pi.png [new file with mode: 0644]
llvm/docs/DependenceGraphs/index.rst [new file with mode: 0644]
llvm/docs/DependenceGraphs/uml_builder_pattern.png [new file with mode: 0644]
llvm/docs/DependenceGraphs/uml_nodes_and_edges.png [new file with mode: 0644]
llvm/docs/SubsystemDocumentation.rst
llvm/include/llvm/Analysis/DDG.h [new file with mode: 0644]
llvm/include/llvm/Analysis/DependenceGraphBuilder.h [new file with mode: 0644]
llvm/lib/Analysis/CMakeLists.txt
llvm/lib/Analysis/DDG.cpp [new file with mode: 0644]
llvm/lib/Analysis/DependenceGraphBuilder.cpp [new file with mode: 0644]
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/test/Analysis/DDG/basic-a.ll [new file with mode: 0644]
llvm/test/Analysis/DDG/basic-b.ll [new file with mode: 0644]
llvm/test/Analysis/DDG/basic-loopnest.ll [new file with mode: 0644]