LLVM  8.0.1
Public Member Functions | List of all members
llvm::IDFCalculator< NodeTy, IsPostDom > Class Template Reference

Determine the iterated dominance frontier, given a set of defining blocks, and optionally, a set of live-in blocks. More...

#include "llvm/Analysis/IteratedDominanceFrontier.h"

Public Member Functions

 IDFCalculator (DominatorTreeBase< BasicBlock, IsPostDom > &DT)
 
 IDFCalculator (DominatorTreeBase< BasicBlock, IsPostDom > &DT, const GraphDiff< BasicBlock *, IsPostDom > *GD)
 
void setDefiningBlocks (const SmallPtrSetImpl< BasicBlock *> &Blocks)
 Give the IDF calculator the set of blocks in which the value is defined. More...
 
void setLiveInBlocks (const SmallPtrSetImpl< BasicBlock *> &Blocks)
 Give the IDF calculator the set of blocks in which the value is live on entry to the block. More...
 
void resetLiveInBlocks ()
 Reset the live-in block set to be empty, and tell the IDF calculator to not use liveness anymore. More...
 
void calculate (SmallVectorImpl< BasicBlock *> &IDFBlocks)
 Calculate iterated dominance frontiers. More...
 

Detailed Description

template<class NodeTy, bool IsPostDom>
class llvm::IDFCalculator< NodeTy, IsPostDom >

Determine the iterated dominance frontier, given a set of defining blocks, and optionally, a set of live-in blocks.

In turn, the results can be used to place phi nodes.

This algorithm is a linear time computation of Iterated Dominance Frontiers, pruned using the live-in set. By default, liveness is not used to prune the IDF computation. The template parameters should be either BasicBlock* or Inverse<BasicBlock *>, depending on if you want the forward or reverse IDF.

Definition at line 47 of file IteratedDominanceFrontier.h.

Constructor & Destructor Documentation

◆ IDFCalculator() [1/2]

template<class NodeTy , bool IsPostDom>
llvm::IDFCalculator< NodeTy, IsPostDom >::IDFCalculator ( DominatorTreeBase< BasicBlock, IsPostDom > &  DT)
inline

Definition at line 49 of file IteratedDominanceFrontier.h.

◆ IDFCalculator() [2/2]

template<class NodeTy , bool IsPostDom>
llvm::IDFCalculator< NodeTy, IsPostDom >::IDFCalculator ( DominatorTreeBase< BasicBlock, IsPostDom > &  DT,
const GraphDiff< BasicBlock *, IsPostDom > *  GD 
)
inline

Definition at line 52 of file IteratedDominanceFrontier.h.

Member Function Documentation

◆ calculate()

template<class NodeTy , bool IsPostDom>
void llvm::IDFCalculator< NodeTy, IsPostDom >::calculate ( SmallVectorImpl< BasicBlock *> &  IDFBlocks)

Calculate iterated dominance frontiers.

This uses the linear-time phi algorithm based on DJ-graphs mentioned in the file-level comment. It performs DF->IDF pruning using the live-in set, to avoid computing the IDF for blocks where an inserted PHI node would be dead.

Definition at line 22 of file IteratedDominanceFrontier.cpp.

Referenced by llvm::MemorySSAUpdater::applyInsertUpdates(), isUnconditionalBranch(), llvm::MemorySSA::OptimizeUses::optimizeUses(), promoteSingleBlockAlloca(), llvm::IDFCalculator< NodeTy, IsPostDom >::resetLiveInBlocks(), and llvm::SSAUpdaterBulk::RewriteAllUses().

◆ resetLiveInBlocks()

template<class NodeTy , bool IsPostDom>
void llvm::IDFCalculator< NodeTy, IsPostDom >::resetLiveInBlocks ( )
inline

Reset the live-in block set to be empty, and tell the IDF calculator to not use liveness anymore.

Definition at line 78 of file IteratedDominanceFrontier.h.

References llvm::IDFCalculator< NodeTy, IsPostDom >::calculate().

Referenced by llvm::SSAUpdaterBulk::RewriteAllUses().

◆ setDefiningBlocks()

template<class NodeTy , bool IsPostDom>
void llvm::IDFCalculator< NodeTy, IsPostDom >::setDefiningBlocks ( const SmallPtrSetImpl< BasicBlock *> &  Blocks)
inline

Give the IDF calculator the set of blocks in which the value is defined.

This is equivalent to the set of starting blocks it should be calculating the IDF for (though later gets pruned based on liveness).

Note: This set must live for the entire lifetime of the IDF calculator.

Definition at line 61 of file IteratedDominanceFrontier.h.

Referenced by llvm::MemorySSAUpdater::applyInsertUpdates(), isUnconditionalBranch(), llvm::MemorySSA::OptimizeUses::optimizeUses(), promoteSingleBlockAlloca(), and llvm::SSAUpdaterBulk::RewriteAllUses().

◆ setLiveInBlocks()

template<class NodeTy , bool IsPostDom>
void llvm::IDFCalculator< NodeTy, IsPostDom >::setLiveInBlocks ( const SmallPtrSetImpl< BasicBlock *> &  Blocks)
inline

Give the IDF calculator the set of blocks in which the value is live on entry to the block.

This is used to prune the IDF calculation to not include blocks where any phi insertion would be dead.

Note: This set must live for the entire lifetime of the IDF calculator.

Definition at line 71 of file IteratedDominanceFrontier.h.

Referenced by isUnconditionalBranch(), promoteSingleBlockAlloca(), and llvm::SSAUpdaterBulk::RewriteAllUses().


The documentation for this class was generated from the following files: