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

Helper class for SCCPSolver. More...

Inheritance diagram for llvm::SCCPInstVisitor:
Inheritance graph
[legend]
Collaboration diagram for llvm::SCCPInstVisitor:
Collaboration graph
[legend]

Public Member Functions

void addAnalysis (Function &F, AnalysisResultsForFn A)
 
bool markBlockExecutable (BasicBlock *BB)
 
const PredicateBasegetPredicateInfoFor (Instruction *I)
 
DomTreeUpdater getDTU (Function &F)
 
 SCCPInstVisitor (const DataLayout &DL, std::function< const TargetLibraryInfo &(Function &)> GetTLI, LLVMContext &Ctx)
 
void trackValueOfGlobalVariable (GlobalVariable *GV)
 
void addTrackedFunction (Function *F)
 
void addToMustPreserveReturnsInFunctions (Function *F)
 
bool mustPreserveReturn (Function *F)
 
void addArgumentTrackedFunction (Function *F)
 
bool isArgumentTrackedFunction (Function *F)
 
void solve ()
 
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 ()
 
const DenseMap< GlobalVariable *, ValueLatticeElement > & getTrackedGlobals ()
 
const SmallPtrSet< Function *, 16 > getMRVFunctionsTracked ()
 
void markOverdefined (Value *V)
 
bool isStructLatticeConstant (Function *F, StructType *STy)
 
ConstantgetConstant (const ValueLatticeElement &LV) const
 
- Public Member Functions inherited from llvm::InstVisitor< SCCPInstVisitor >
void visit (Iterator Start, Iterator End)
 
void visit (Module &M)
 
void visit (Function &F)
 
void visit (BasicBlock &BB)
 
void visit (Module *M)
 
void visit (Function *F)
 
void visit (BasicBlock *BB)
 
void visit (Instruction *I)
 
void visit (Instruction &I)
 
void visitModule (Module &M)
 
void visitFunction (Function &F)
 
void visitBasicBlock (BasicBlock &BB)
 
void visitICmpInst (ICmpInst &I)
 
void visitFCmpInst (FCmpInst &I)
 
void visitAllocaInst (AllocaInst &I)
 
void visitLoadInst (LoadInst &I)
 
void visitStoreInst (StoreInst &I)
 
void visitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
 
void visitAtomicRMWInst (AtomicRMWInst &I)
 
void visitFenceInst (FenceInst &I)
 
void visitGetElementPtrInst (GetElementPtrInst &I)
 
void visitPHINode (PHINode &I)
 
void visitTruncInst (TruncInst &I)
 
void visitZExtInst (ZExtInst &I)
 
void visitSExtInst (SExtInst &I)
 
void visitFPTruncInst (FPTruncInst &I)
 
void visitFPExtInst (FPExtInst &I)
 
void visitFPToUIInst (FPToUIInst &I)
 
void visitFPToSIInst (FPToSIInst &I)
 
void visitUIToFPInst (UIToFPInst &I)
 
void visitSIToFPInst (SIToFPInst &I)
 
void visitPtrToIntInst (PtrToIntInst &I)
 
void visitIntToPtrInst (IntToPtrInst &I)
 
void visitBitCastInst (BitCastInst &I)
 
void visitAddrSpaceCastInst (AddrSpaceCastInst &I)
 
void visitSelectInst (SelectInst &I)
 
void visitVAArgInst (VAArgInst &I)
 
void visitExtractElementInst (ExtractElementInst &I)
 
void visitInsertElementInst (InsertElementInst &I)
 
void visitShuffleVectorInst (ShuffleVectorInst &I)
 
void visitExtractValueInst (ExtractValueInst &I)
 
void visitInsertValueInst (InsertValueInst &I)
 
void visitLandingPadInst (LandingPadInst &I)
 
void visitFuncletPadInst (FuncletPadInst &I)
 
void visitCleanupPadInst (CleanupPadInst &I)
 
void visitCatchPadInst (CatchPadInst &I)
 
void visitFreezeInst (FreezeInst &I)
 
void visitDbgDeclareInst (DbgDeclareInst &I)
 
void visitDbgValueInst (DbgValueInst &I)
 
void visitDbgVariableIntrinsic (DbgVariableIntrinsic &I)
 
void visitDbgLabelInst (DbgLabelInst &I)
 
void visitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
void visitMemSetInst (MemSetInst &I)
 
void visitMemCpyInst (MemCpyInst &I)
 
void visitMemMoveInst (MemMoveInst &I)
 
void visitMemTransferInst (MemTransferInst &I)
 
void visitMemIntrinsic (MemIntrinsic &I)
 
void visitVAStartInst (VAStartInst &I)
 
void visitVAEndInst (VAEndInst &I)
 
void visitVACopyInst (VACopyInst &I)
 
void visitIntrinsicInst (IntrinsicInst &I)
 
void visitCallInst (CallInst &I)
 
void visitInvokeInst (InvokeInst &I)
 
void visitCallBrInst (CallBrInst &I)
 
void visitReturnInst (ReturnInst &I)
 
void visitBranchInst (BranchInst &I)
 
void visitSwitchInst (SwitchInst &I)
 
void visitIndirectBrInst (IndirectBrInst &I)
 
void visitResumeInst (ResumeInst &I)
 
void visitUnreachableInst (UnreachableInst &I)
 
void visitCleanupReturnInst (CleanupReturnInst &I)
 
void visitCatchReturnInst (CatchReturnInst &I)
 
void visitCatchSwitchInst (CatchSwitchInst &I)
 
void visitTerminator (Instruction &I)
 
void visitCastInst (CastInst &I)
 
void visitUnaryOperator (UnaryOperator &I)
 
void visitBinaryOperator (BinaryOperator &I)
 
void visitCmpInst (CmpInst &I)
 
void visitUnaryInstruction (UnaryInstruction &I)
 
void visitCallBase (CallBase &I)
 
void visitInstruction (Instruction &I)
 

Friends

class InstVisitor< SCCPInstVisitor >
 

Detailed Description

Helper class for SCCPSolver.

This implements the instruction visitor and holds all the state.

Definition at line 69 of file SCCPSolver.cpp.

Constructor & Destructor Documentation

◆ SCCPInstVisitor()

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

Definition at line 352 of file SCCPSolver.cpp.

Member Function Documentation

◆ addAnalysis()

void llvm::SCCPInstVisitor::addAnalysis ( Function F,
AnalysisResultsForFn  A 
)
inline

◆ addArgumentTrackedFunction()

void llvm::SCCPInstVisitor::addArgumentTrackedFunction ( Function F)
inline

Definition at line 385 of file SCCPSolver.cpp.

References F, and llvm::SmallPtrSetImpl< PtrType >::insert().

◆ addToMustPreserveReturnsInFunctions()

void llvm::SCCPInstVisitor::addToMustPreserveReturnsInFunctions ( Function F)
inline

Definition at line 377 of file SCCPSolver.cpp.

References F, and llvm::SmallPtrSetImpl< PtrType >::insert().

◆ addTrackedFunction()

void llvm::SCCPInstVisitor::addTrackedFunction ( Function F)
inline

◆ getConstant()

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

◆ getDTU()

DomTreeUpdater llvm::SCCPInstVisitor::getDTU ( Function F)
inline

◆ getLatticeValueFor()

const ValueLatticeElement& llvm::SCCPInstVisitor::getLatticeValueFor ( Value V) const
inline

◆ getMRVFunctionsTracked()

const SmallPtrSet<Function *, 16> llvm::SCCPInstVisitor::getMRVFunctionsTracked ( )
inline

Definition at line 435 of file SCCPSolver.cpp.

◆ getPredicateInfoFor()

const PredicateBase* llvm::SCCPInstVisitor::getPredicateInfoFor ( Instruction I)
inline

◆ getStructLatticeValueFor()

std::vector<ValueLatticeElement> llvm::SCCPInstVisitor::getStructLatticeValueFor ( Value V) const
inline

◆ getTrackedGlobals()

const DenseMap<GlobalVariable *, ValueLatticeElement>& llvm::SCCPInstVisitor::getTrackedGlobals ( )
inline

Definition at line 431 of file SCCPSolver.cpp.

◆ getTrackedRetVals()

const MapVector<Function *, ValueLatticeElement>& llvm::SCCPInstVisitor::getTrackedRetVals ( )
inline

Definition at line 427 of file SCCPSolver.cpp.

◆ isArgumentTrackedFunction()

bool llvm::SCCPInstVisitor::isArgumentTrackedFunction ( Function F)
inline

Definition at line 389 of file SCCPSolver.cpp.

References llvm::SmallPtrSetImpl< PtrType >::count(), and F.

◆ isBlockExecutable()

bool llvm::SCCPInstVisitor::isBlockExecutable ( BasicBlock BB) const
inline

Definition at line 397 of file SCCPSolver.cpp.

References BB.

◆ isEdgeFeasible()

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

◆ isStructLatticeConstant()

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

◆ markBlockExecutable()

bool SCCPInstVisitor::markBlockExecutable ( BasicBlock BB)

Definition at line 454 of file SCCPSolver.cpp.

References BB, llvm::dbgs(), and LLVM_DEBUG.

◆ markOverdefined()

void llvm::SCCPInstVisitor::markOverdefined ( Value V)
inline

Definition at line 439 of file SCCPSolver.cpp.

References llvm::numbers::e, llvm::Value::getType(), and i.

◆ mustPreserveReturn()

bool llvm::SCCPInstVisitor::mustPreserveReturn ( Function F)
inline

Definition at line 381 of file SCCPSolver.cpp.

References llvm::SmallPtrSetImpl< PtrType >::count(), and F.

◆ removeLatticeValueFor()

void llvm::SCCPInstVisitor::removeLatticeValueFor ( Value V)
inline

◆ resolvedUndefsIn()

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

This method handles this by finding an unresolved branch and marking it one of the edges from the block as being feasible, even though the condition doesn't say it would otherwise be. This allows SCCP to find the rest of the CFG and only slightly pessimizes the analysis results (by marking one, potentially infeasible, edge feasible). This cannot usefully modify the constraints on the condition of the branch, as that would impact other users of the value.

This scan also checks for values that use undefs. It conservatively marks them as overdefined.

Definition at line 1417 of file SCCPSolver.cpp.

References BB, llvm::numbers::e, F, llvm::BlockAddress::get(), llvm::CallBase::getCalledFunction(), llvm::ConstantInt::getFalse(), llvm::Instruction::getSuccessor(), i, I, llvm::ValueLatticeElement::isUnknownOrUndef(), and SI.

◆ solve()

void SCCPInstVisitor::solve ( )

◆ trackValueOfGlobalVariable()

void llvm::SCCPInstVisitor::trackValueOfGlobalVariable ( GlobalVariable GV)
inline

Friends And Related Function Documentation

◆ InstVisitor< SCCPInstVisitor >

friend class InstVisitor< SCCPInstVisitor >
friend

Definition at line 279 of file SCCPSolver.cpp.


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