LLVM  13.0.0git
Public Member Functions | List of all members
llvm::SCCPSolver Class Reference

SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propagation (SCCP). More...

#include "llvm/Transforms/Utils/SCCPSolver.h"

Public Member Functions

 SCCPSolver (const DataLayout &DL, std::function< const TargetLibraryInfo &(Function &)> GetTLI, LLVMContext &Ctx)
 
 ~SCCPSolver ()
 
void addAnalysis (Function &F, AnalysisResultsForFn A)
 
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. More...
 
const PredicateBasegetPredicateInfoFor (Instruction *I)
 
DomTreeUpdater getDTU (Function &F)
 
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. More...
 
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. More...
 
void addToMustPreserveReturnsInFunctions (Function *F)
 Add function to the list of functions whose return cannot be modified. More...
 
bool mustPreserveReturn (Function *F)
 Returns true if the return of the given function cannot be modified. More...
 
void addArgumentTrackedFunction (Function *F)
 
bool isArgumentTrackedFunction (Function *F)
 Returns true if the given function is in the solver's set of argument-tracked functions. More...
 
void solve ()
 Solve - Solve for constants and executable blocks. More...
 
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. More...
 
bool isBlockExecutable (BasicBlock *BB) const
 
bool isEdgeFeasible (BasicBlock *From, BasicBlock *To) const
 
std::vector< ValueLatticeElementgetStructLatticeValueFor (Value *V) const
 
void removeLatticeValueFor (Value *V)
 
const ValueLatticeElementgetLatticeValueFor (Value *V) const
 
const MapVector< Function *, ValueLatticeElement > & getTrackedRetVals ()
 getTrackedRetVals - Get the inferred return value map. More...
 
const DenseMap< GlobalVariable *, ValueLatticeElement > & getTrackedGlobals ()
 getTrackedGlobals - Get and return the set of inferred initializers for global variables. More...
 
const SmallPtrSet< Function *, 16 > getMRVFunctionsTracked ()
 getMRVFunctionsTracked - Get the set of functions which return multiple values tracked by the pass. More...
 
void markOverdefined (Value *V)
 markOverdefined - Mark the specified value overdefined. More...
 
bool isStructLatticeConstant (Function *F, StructType *STy)
 
ConstantgetConstant (const ValueLatticeElement &LV) const
 Helper to return a Constant if LV is either a constant or a constant range with a single element. More...
 

Detailed Description

SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propagation (SCCP).

Definition at line 44 of file SCCPSolver.h.

Constructor & Destructor Documentation

◆ SCCPSolver()

SCCPSolver::SCCPSolver ( const DataLayout DL,
std::function< const TargetLibraryInfo &(Function &)>  GetTLI,
LLVMContext Ctx 
)

Definition at line 1571 of file SCCPSolver.cpp.

◆ ~SCCPSolver()

SCCPSolver::~SCCPSolver ( )

Definition at line 1577 of file SCCPSolver.cpp.

Member Function Documentation

◆ addAnalysis()

void SCCPSolver::addAnalysis ( Function F,
AnalysisResultsForFn  A 
)

Definition at line 1579 of file SCCPSolver.cpp.

References A, F, and move.

Referenced by llvm::runIPSCCP().

◆ addArgumentTrackedFunction()

void SCCPSolver::addArgumentTrackedFunction ( Function F)

Definition at line 1609 of file SCCPSolver.cpp.

References F.

Referenced by llvm::runIPSCCP().

◆ addToMustPreserveReturnsInFunctions()

void SCCPSolver::addToMustPreserveReturnsInFunctions ( Function F)

Add function to the list of functions whose return cannot be modified.

Definition at line 1601 of file SCCPSolver.cpp.

References F.

Referenced by tryToReplaceWithConstant().

◆ 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 1597 of file SCCPSolver.cpp.

References F.

Referenced by llvm::runIPSCCP().

◆ getConstant()

Constant * SCCPSolver::getConstant ( const ValueLatticeElement LV) const

Helper to return a Constant if LV is either a constant or a constant range with a single element.

Definition at line 1664 of file SCCPSolver.cpp.

Referenced by tryToReplaceWithConstant().

◆ getDTU()

DomTreeUpdater SCCPSolver::getDTU ( Function F)

Definition at line 1591 of file SCCPSolver.cpp.

References F.

Referenced by llvm::runIPSCCP().

◆ getLatticeValueFor()

const ValueLatticeElement & SCCPSolver::getLatticeValueFor ( Value V) const

◆ getMRVFunctionsTracked()

const SmallPtrSet< Function *, 16 > SCCPSolver::getMRVFunctionsTracked ( )

getMRVFunctionsTracked - Get the set of functions which return multiple values tracked by the pass.

Definition at line 1654 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP().

◆ getPredicateInfoFor()

const PredicateBase * SCCPSolver::getPredicateInfoFor ( Instruction I)

Definition at line 1587 of file SCCPSolver.cpp.

References I.

Referenced by llvm::runIPSCCP().

◆ getStructLatticeValueFor()

std::vector< ValueLatticeElement > SCCPSolver::getStructLatticeValueFor ( Value V) const

Definition at line 1632 of file SCCPSolver.cpp.

Referenced by tryToReplaceWithConstant().

◆ getTrackedGlobals()

const DenseMap< GlobalVariable *, ValueLatticeElement > & SCCPSolver::getTrackedGlobals ( )

getTrackedGlobals - Get and return the set of inferred initializers for global variables.

Definition at line 1650 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP().

◆ getTrackedRetVals()

const MapVector< Function *, ValueLatticeElement > & SCCPSolver::getTrackedRetVals ( )

getTrackedRetVals - Get the inferred return value map.

Definition at line 1645 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP().

◆ isArgumentTrackedFunction()

bool SCCPSolver::isArgumentTrackedFunction ( Function F)

Returns true if the given function is in the solver's set of argument-tracked functions.

Definition at line 1613 of file SCCPSolver.cpp.

References F.

Referenced by findReturnsToZap().

◆ isBlockExecutable()

bool SCCPSolver::isBlockExecutable ( BasicBlock BB) const

Definition at line 1623 of file SCCPSolver.cpp.

References BB.

Referenced by llvm::runIPSCCP(), and runSCCP().

◆ isEdgeFeasible()

bool SCCPSolver::isEdgeFeasible ( BasicBlock From,
BasicBlock To 
) const

Definition at line 1627 of file SCCPSolver.cpp.

References From.

Referenced by removeNonFeasibleEdges().

◆ isStructLatticeConstant()

bool SCCPSolver::isStructLatticeConstant ( Function F,
StructType STy 
)

Definition at line 1660 of file SCCPSolver.cpp.

References F.

Referenced by llvm::runIPSCCP().

◆ markBlockExecutable()

bool SCCPSolver::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.

This returns true if the block was not considered live before.

Definition at line 1583 of file SCCPSolver.cpp.

References BB.

Referenced by llvm::runIPSCCP(), and runSCCP().

◆ markOverdefined()

void SCCPSolver::markOverdefined ( Value V)

markOverdefined - Mark the specified value overdefined.

This works with both scalars and structs.

Definition at line 1658 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP(), and runSCCP().

◆ mustPreserveReturn()

bool SCCPSolver::mustPreserveReturn ( Function F)

Returns true if the return of the given function cannot be modified.

Definition at line 1605 of file SCCPSolver.cpp.

References F.

Referenced by findReturnsToZap().

◆ removeLatticeValueFor()

void SCCPSolver::removeLatticeValueFor ( Value V)

Definition at line 1636 of file SCCPSolver.cpp.

Referenced by simplifyInstsInBlock().

◆ resolvedUndefsIn()

bool SCCPSolver::resolvedUndefsIn ( Function F)

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 1619 of file SCCPSolver.cpp.

References F.

Referenced by llvm::runIPSCCP(), and runSCCP().

◆ solve()

void SCCPSolver::solve ( )

Solve - Solve for constants and executable blocks.

Definition at line 1617 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP(), and runSCCP().

◆ trackValueOfGlobalVariable()

void SCCPSolver::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.

This is only legal to call if performing Interprocedural SCCP.

Definition at line 1593 of file SCCPSolver.cpp.

Referenced by llvm::runIPSCCP().


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