LLVM: llvm::SCCPSolver Class Reference (original) (raw)
SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propagation (SCCP). More...
#include "[llvm/Transforms/Utils/SCCPSolver.h](SCCPSolver%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| LLVM_ABI | SCCPSolver (const DataLayout &DL, std::function< const TargetLibraryInfo &(Function &)> GetTLI, LLVMContext &Ctx) |
| LLVM_ABI | ~SCCPSolver () |
| LLVM_ABI void | addPredicateInfo (Function &F, DominatorTree &DT, AssumptionCache &AC) |
| LLVM_ABI void | removeSSACopies (Function &F) |
| LLVM_ABI bool | markBlockExecutable (BasicBlock *BB) |
| markBlockExecutable - This method can be used by clients to mark all of the blocks that are known to be intrinsically live in the processed unit. | |
| LLVM_ABI const PredicateBase * | getPredicateInfoFor (Instruction *I) |
| LLVM_ABI void | trackValueOfGlobalVariable (GlobalVariable *GV) |
| trackValueOfGlobalVariable - Clients can use this method to inform the SCCPSolver that it should track loads and stores to the specified global variable if it can. | |
| LLVM_ABI void | addTrackedFunction (Function *F) |
| addTrackedFunction - If the SCCP solver is supposed to track calls into and out of the specified function (which cannot have its address taken), this method must be called. | |
| LLVM_ABI void | addToMustPreserveReturnsInFunctions (Function *F) |
| Add function to the list of functions whose return cannot be modified. | |
| LLVM_ABI bool | mustPreserveReturn (Function *F) |
| Returns true if the return of the given function cannot be modified. | |
| LLVM_ABI void | addArgumentTrackedFunction (Function *F) |
| LLVM_ABI bool | isArgumentTrackedFunction (Function *F) |
| Returns true if the given function is in the solver's set of argument-tracked functions. | |
| LLVM_ABI const SmallPtrSetImpl< Function * > & | getArgumentTrackedFunctions () const |
| LLVM_ABI void | solve () |
| Solve - Solve for constants and executable blocks. | |
| LLVM_ABI bool | resolvedUndefsIn (Function &F) |
| resolvedUndefsIn - While solving the dataflow for a function, we assume that branches on undef values cannot reach any of their successors. | |
| LLVM_ABI void | solveWhileResolvedUndefsIn (Module &M) |
| LLVM_ABI void | solveWhileResolvedUndefsIn (SmallVectorImpl< Function * > &WorkList) |
| LLVM_ABI void | solveWhileResolvedUndefs () |
| LLVM_ABI bool | isBlockExecutable (BasicBlock *BB) const |
| LLVM_ABI bool | isEdgeFeasible (BasicBlock *From, BasicBlock *To) const |
| LLVM_ABI std::vector< ValueLatticeElement > | getStructLatticeValueFor (Value *V) const |
| LLVM_ABI void | removeLatticeValueFor (Value *V) |
| LLVM_ABI void | resetLatticeValueFor (CallBase *Call) |
| Invalidate the Lattice Value of Call and its users after specializing the call. | |
| LLVM_ABI const ValueLatticeElement & | getLatticeValueFor (Value *V) const |
| LLVM_ABI const MapVector< Function *, ValueLatticeElement > & | getTrackedRetVals () const |
| getTrackedRetVals - Get the inferred return value map. | |
| LLVM_ABI const DenseMap< GlobalVariable *, ValueLatticeElement > & | getTrackedGlobals () const |
| getTrackedGlobals - Get and return the set of inferred initializers for global variables. | |
| LLVM_ABI const SmallPtrSet< Function *, 16 > & | getMRVFunctionsTracked () const |
| getMRVFunctionsTracked - Get the set of functions which return multiple values tracked by the pass. | |
| LLVM_ABI void | markOverdefined (Value *V) |
| markOverdefined - Mark the specified value overdefined. | |
| LLVM_ABI void | trackValueOfArgument (Argument *V) |
| trackValueOfArgument - Mark the specified argument overdefined unless it have range attribute. | |
| LLVM_ABI bool | isStructLatticeConstant (Function *F, StructType *STy) |
| LLVM_ABI Constant * | getConstant (const ValueLatticeElement &LV, Type *Ty) const |
| Helper to return a Constant if LV is either a constant or a constant range with a single element. | |
| LLVM_ABI Constant * | getConstantOrNull (Value *V) const |
| Return either a Constant or nullptr for a given Value. | |
| LLVM_ABI void | setLatticeValueForSpecializationArguments (Function *F, const SmallVectorImpl< ArgInfo > &Args) |
| Set the Lattice Value for the arguments of a specialization F. | |
| LLVM_ABI void | markFunctionUnreachable (Function *F) |
| Mark all of the blocks in function F non-executable. | |
| LLVM_ABI void | visit (Instruction *I) |
| LLVM_ABI void | visitCall (CallInst &I) |
| LLVM_ABI bool | simplifyInstsInBlock (BasicBlock &BB, SmallPtrSetImpl< Value * > &InsertedValues, Statistic &InstRemovedStat, Statistic &InstReplacedStat) |
| LLVM_ABI bool | removeNonFeasibleEdges (BasicBlock *BB, DomTreeUpdater &DTU, BasicBlock *&NewUnreachableBB) const |
| LLVM_ABI void | inferReturnAttributes () const |
| LLVM_ABI void | inferArgAttributes () const |
| LLVM_ABI bool | tryToReplaceWithConstant (Value *V) |
SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propagation (SCCP).
Definition at line 66 of file SCCPSolver.h.
◆ ~SCCPSolver()
| SCCPSolver::~SCCPSolver ( ) | default |
|---|
◆ addArgumentTrackedFunction()
| void SCCPSolver::addArgumentTrackedFunction | ( | Function * | F | ) |
|---|
◆ addPredicateInfo()
◆ addToMustPreserveReturnsInFunctions()
| void SCCPSolver::addToMustPreserveReturnsInFunctions | ( | Function * | F | ) |
|---|
◆ addTrackedFunction()
| void SCCPSolver::addTrackedFunction | ( | Function * | F | ) |
|---|
addTrackedFunction - If the SCCP solver is supposed to track calls into and out of the specified function (which cannot have its address taken), this method must be called.
Definition at line 2341 of file SCCPSolver.cpp.
References F.
Referenced by runIPSCCP(), and runSCCP().
◆ getArgumentTrackedFunctions()
◆ getConstant()
Helper to return a Constant if LV is either a constant or a constant range with a single element.
Definition at line 2434 of file SCCPSolver.cpp.
◆ getConstantOrNull()
◆ getLatticeValueFor()
◆ getMRVFunctionsTracked()
getMRVFunctionsTracked - Get the set of functions which return multiple values tracked by the pass.
Definition at line 2420 of file SCCPSolver.cpp.
Referenced by runIPSCCP().
◆ getPredicateInfoFor()
◆ getStructLatticeValueFor()
◆ getTrackedGlobals()
getTrackedGlobals - Get and return the set of inferred initializers for global variables.
Definition at line 2416 of file SCCPSolver.cpp.
Referenced by runIPSCCP().
◆ getTrackedRetVals()
◆ inferArgAttributes()
| void llvm::SCCPSolver::inferArgAttributes | ( | ) | const |
|---|
◆ inferReturnAttributes()
| void llvm::SCCPSolver::inferReturnAttributes | ( | ) | const |
|---|
◆ isArgumentTrackedFunction()
◆ isBlockExecutable()
◆ isConstant()
◆ isEdgeFeasible()
◆ isOverdefined()
◆ isStructLatticeConstant()
◆ markBlockExecutable()
markBlockExecutable - This method can be used by clients to mark all of the blocks that are known to be intrinsically live in the processed unit.
This returns true if the block was not considered live before.
Definition at line 2329 of file SCCPSolver.cpp.
Referenced by runIPSCCP(), and runSCCP().
◆ markFunctionUnreachable()
| void SCCPSolver::markFunctionUnreachable | ( | Function * | F | ) |
|---|
Mark all of the blocks in function F non-executable.
Clients can used this method to erase a function from the module (e.g., if it has been completely specialized and is no longer needed).
Definition at line 2448 of file SCCPSolver.cpp.
References F.
◆ markOverdefined()
| void SCCPSolver::markOverdefined | ( | Value * | V | ) |
|---|
markOverdefined - Mark the specified value overdefined.
This works with both scalars and structs.
Definition at line 2424 of file SCCPSolver.cpp.
◆ mustPreserveReturn()
◆ removeLatticeValueFor()
| void SCCPSolver::removeLatticeValueFor | ( | Value * | V | ) |
|---|
◆ removeNonFeasibleEdges()
Definition at line 379 of file SCCPSolver.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdatesPermissive(), assert(), llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::cast(), llvm::SmallPtrSetImpl< PtrType >::contains(), llvm::BasicBlock::Create(), llvm::BranchInst::Create(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::Instruction::eraseFromParent(), llvm::BasicBlock::getContext(), llvm::Instruction::getDebugLoc(), llvm::BasicBlock::getParent(), llvm::DebugLoc::getTemporary(), llvm::BasicBlock::getTerminator(), llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isa(), isEdgeFeasible(), llvm_unreachable, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BasicBlock::removePredecessor(), llvm::Instruction::setDebugLoc(), llvm::SmallPtrSetImplBase::size(), and llvm::successors().
Referenced by runIPSCCP(), and runSCCP().
◆ removeSSACopies()
| void SCCPSolver::removeSSACopies | ( | Function & | F | ) |
|---|
◆ resetLatticeValueFor()
| void SCCPSolver::resetLatticeValueFor | ( | CallBase * | Call | ) |
|---|
Invalidate the Lattice Value of Call and its users after specializing the call.
Then recompute it.
Definition at line 2402 of file SCCPSolver.cpp.
References Call.
◆ resolvedUndefsIn()
resolvedUndefsIn - While solving the dataflow for a function, we assume that branches on undef values cannot reach any of their successors.
However, this is not a safe assumption. After we solve dataflow, this method should be use to handle this. If this returns true, the solver should be rerun.
Definition at line 2368 of file SCCPSolver.cpp.
References F.
Referenced by runSCCP().
◆ setLatticeValueForSpecializationArguments()
Set the Lattice Value for the arguments of a specialization F.
If an argument is Constant then its lattice value is marked with the corresponding actual argument in Args. Otherwise, its lattice value is inherited (copied) from the corresponding formal argument in Args.
Definition at line 2443 of file SCCPSolver.cpp.
References F.
◆ simplifyInstsInBlock()
◆ solve()
| void SCCPSolver::solve | ( | ) |
|---|
◆ solveWhileResolvedUndefs()
| void SCCPSolver::solveWhileResolvedUndefs | ( | ) |
|---|
◆ solveWhileResolvedUndefsIn() [1/2]
| void SCCPSolver::solveWhileResolvedUndefsIn | ( | Module & | M | ) |
|---|
◆ solveWhileResolvedUndefsIn() [2/2]
◆ trackValueOfArgument()
| void SCCPSolver::trackValueOfArgument | ( | Argument * | V | ) |
|---|
trackValueOfArgument - Mark the specified argument overdefined unless it have range attribute.
This works with both scalars and structs.
Definition at line 2426 of file SCCPSolver.cpp.
Referenced by runIPSCCP(), and runSCCP().
◆ trackValueOfGlobalVariable()
trackValueOfGlobalVariable - Clients can use this method to inform the SCCPSolver that it should track loads and stores to the specified global variable if it can.
This is only legal to call if performing Interprocedural SCCP.
Definition at line 2337 of file SCCPSolver.cpp.
Referenced by runIPSCCP().
◆ tryToReplaceWithConstant()
| bool llvm::SCCPSolver::tryToReplaceWithConstant | ( | Value * | V | ) |
|---|
Definition at line 64 of file SCCPSolver.cpp.
References addToMustPreserveReturnsInFunctions(), llvm::dbgs(), llvm::dyn_cast(), F, llvm::CallBase::getCalledFunction(), getConstantOrNull(), llvm::CallBase::getOperandBundle(), llvm::CallBase::isMustTailCall(), LLVM_DEBUG, llvm::LLVMContext::OB_clang_arc_attachedcall, and llvm::wouldInstructionBeTriviallyDead().
Referenced by runIPSCCP(), and simplifyInstsInBlock().
◆ visit()
◆ visitCall()
| void SCCPSolver::visitCall | ( | CallInst & | I | ) |
|---|
The documentation for this class was generated from the following files:
- include/llvm/Transforms/Utils/SCCPSolver.h
- lib/Transforms/Utils/SCCPSolver.cpp