LLVM  3.7.0
Public Member Functions | List of all members
llvm::IDFCalculator Class Reference

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

#include <IteratedDominanceFrontier.h>

Public Member Functions

 IDFCalculator (DominatorTree &DT)
 
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

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.

Definition at line 47 of file IteratedDominanceFrontier.h.

Constructor & Destructor Documentation

llvm::IDFCalculator::IDFCalculator ( DominatorTree DT)
inline

Definition at line 50 of file IteratedDominanceFrontier.h.

Member Function Documentation

void IDFCalculator::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 21 of file IteratedDominanceFrontier.cpp.

References llvm::SmallVectorImpl< T >::clear(), llvm::df_begin(), llvm::df_end(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::DomTreeNodeBase< T >::getBlock(), llvm::DomTreeNodeBase< T >::getIDom(), llvm::DominatorTreeBase< N >::getNode(), llvm::DominatorTreeBase< N >::getRootNode(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::successors().

void llvm::IDFCalculator::resetLiveInBlocks ( )
inline

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

Definition at line 74 of file IteratedDominanceFrontier.h.

void llvm::IDFCalculator::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 57 of file IteratedDominanceFrontier.h.

void llvm::IDFCalculator::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 67 of file IteratedDominanceFrontier.h.


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