LLVM API Documentation
#include <SparsePropagation.h>
Public Member Functions | |
SparseSolver (AbstractLatticeFunction *Lattice) | |
~SparseSolver () | |
void | Solve (Function &F) |
void | Print (Function &F, raw_ostream &OS) const |
LatticeVal | getLatticeState (Value *V) const |
LatticeVal | getOrInitValueState (Value *V) |
bool | isEdgeFeasible (BasicBlock *From, BasicBlock *To, bool AggressiveUndef=false) |
bool | isBlockExecutable (BasicBlock *BB) const |
SparseSolver - This class is a general purpose solver for Sparse Conditional Propagation with a programmable lattice function.
Definition at line 115 of file SparsePropagation.h.
llvm::SparseSolver::SparseSolver | ( | AbstractLatticeFunction * | Lattice | ) | [inline, explicit] |
Definition at line 137 of file SparsePropagation.h.
llvm::SparseSolver::~SparseSolver | ( | ) | [inline] |
Definition at line 139 of file SparsePropagation.h.
LatticeVal llvm::SparseSolver::getLatticeState | ( | Value * | V | ) | const [inline] |
getLatticeState - Return the LatticeVal object that corresponds to the value. If an value is not in the map, it is returned as untracked, unlike the getOrInitValueState method.
Definition at line 152 of file SparsePropagation.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), llvm::AbstractLatticeFunction::getUntrackedVal(), and I.
Referenced by Print().
SparseSolver::LatticeVal SparseSolver::getOrInitValueState | ( | Value * | V | ) |
getOrInitValueState - Return the LatticeVal object that corresponds to the value, initializing the value's state if it hasn't been entered into the map yet. This function is necessary because not all values should start out in the underdefined state... Arguments should be overdefined, and constants should be marked as constants.
Definition at line 53 of file SparsePropagation.cpp.
References llvm::ARM_PROC::A, llvm::CallingConv::C, llvm::AbstractLatticeFunction::ComputeArgument(), llvm::AbstractLatticeFunction::ComputeConstant(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), llvm::AbstractLatticeFunction::getOverdefinedVal(), llvm::AbstractLatticeFunction::getUndefVal(), llvm::AbstractLatticeFunction::getUntrackedVal(), I, if(), and llvm::AbstractLatticeFunction::IsUntrackedValue().
bool llvm::SparseSolver::isBlockExecutable | ( | BasicBlock * | BB | ) | const [inline] |
isBlockExecutable - Return true if there are any known feasible edges into the basic block. This is generally only useful when querying the lattice.
Definition at line 176 of file SparsePropagation.h.
References llvm::SmallPtrSetImpl< PtrType >::count().
bool SparseSolver::isEdgeFeasible | ( | BasicBlock * | From, |
BasicBlock * | To, | ||
bool | AggressiveUndef = false |
||
) |
isEdgeFeasible - Return true if the control flow edge from the 'From' basic block to the 'To' basic block is currently feasible. If AggressiveUndef is true, then this treats values with unknown lattice values as undefined. This is generally only useful when solving the lattice, not when querying it.
isEdgeFeasible - Return true if the control flow edge from the 'From' basic block to the 'To' basic block is currently feasible...
Definition at line 205 of file SparsePropagation.cpp.
References llvm::TerminatorInst::getNumSuccessors(), llvm::TerminatorInst::getSuccessor(), and llvm::BasicBlock::getTerminator().
void SparseSolver::Print | ( | Function & | F, |
raw_ostream & | OS | ||
) | const |
Definition at line 329 of file SparsePropagation.cpp.
References llvm::BasicBlock::begin(), llvm::Function::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::BasicBlock::end(), llvm::Function::end(), getLatticeState(), llvm::Value::getName(), llvm::Value::hasName(), I, and llvm::AbstractLatticeFunction::PrintValue().
void SparseSolver::Solve | ( | Function & | F | ) |
Solve - Solve for constants and executable blocks.
Definition at line 293 of file SparsePropagation.cpp.
References llvm::BasicBlock::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), DEBUG, llvm::BasicBlock::end(), llvm::Function::getEntryBlock(), llvm::Instruction::getParent(), I, and llvm::Value::users().