LLVM 20.0.0git
Public Member Functions | Friends | List of all members
llvm::InstCostVisitor Class Reference

#include "llvm/Transforms/IPO/FunctionSpecialization.h"

Inheritance diagram for llvm::InstCostVisitor:
Inheritance graph
[legend]

Public Member Functions

 InstCostVisitor (std::function< BlockFrequencyInfo &(Function &)> GetBFI, Function *F, const DataLayout &DL, TargetTransformInfo &TTI, SCCPSolver &Solver)
 
bool isBlockExecutable (BasicBlock *BB) const
 
Cost getCodeSizeSavingsForArg (Argument *A, Constant *C)
 Compute the codesize savings for replacing argument A with constant C.
 
Cost getCodeSizeSavingsFromPendingPHIs ()
 
Cost getLatencySavingsForKnownConstants ()
 Compute the latency savings from replacing all arguments with constants for a specialization candidate.
 
- Public Member Functions inherited from llvm::InstVisitor< InstCostVisitor, Constant * >
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)
 
Constantvisit (Instruction *I)
 
Constantvisit (Instruction &I)
 
void visitModule (Module &M)
 
void visitFunction (Function &F)
 
void visitBasicBlock (BasicBlock &BB)
 
ConstantvisitICmpInst (ICmpInst &I)
 
ConstantvisitFCmpInst (FCmpInst &I)
 
ConstantvisitAllocaInst (AllocaInst &I)
 
ConstantvisitLoadInst (LoadInst &I)
 
ConstantvisitStoreInst (StoreInst &I)
 
ConstantvisitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
 
ConstantvisitAtomicRMWInst (AtomicRMWInst &I)
 
ConstantvisitFenceInst (FenceInst &I)
 
ConstantvisitGetElementPtrInst (GetElementPtrInst &I)
 
ConstantvisitPHINode (PHINode &I)
 
ConstantvisitTruncInst (TruncInst &I)
 
ConstantvisitZExtInst (ZExtInst &I)
 
ConstantvisitSExtInst (SExtInst &I)
 
ConstantvisitFPTruncInst (FPTruncInst &I)
 
ConstantvisitFPExtInst (FPExtInst &I)
 
ConstantvisitFPToUIInst (FPToUIInst &I)
 
ConstantvisitFPToSIInst (FPToSIInst &I)
 
ConstantvisitUIToFPInst (UIToFPInst &I)
 
ConstantvisitSIToFPInst (SIToFPInst &I)
 
ConstantvisitPtrToIntInst (PtrToIntInst &I)
 
ConstantvisitIntToPtrInst (IntToPtrInst &I)
 
ConstantvisitBitCastInst (BitCastInst &I)
 
ConstantvisitAddrSpaceCastInst (AddrSpaceCastInst &I)
 
ConstantvisitSelectInst (SelectInst &I)
 
ConstantvisitVAArgInst (VAArgInst &I)
 
ConstantvisitExtractElementInst (ExtractElementInst &I)
 
ConstantvisitInsertElementInst (InsertElementInst &I)
 
ConstantvisitShuffleVectorInst (ShuffleVectorInst &I)
 
ConstantvisitExtractValueInst (ExtractValueInst &I)
 
ConstantvisitInsertValueInst (InsertValueInst &I)
 
ConstantvisitLandingPadInst (LandingPadInst &I)
 
ConstantvisitFuncletPadInst (FuncletPadInst &I)
 
ConstantvisitCleanupPadInst (CleanupPadInst &I)
 
ConstantvisitCatchPadInst (CatchPadInst &I)
 
ConstantvisitFreezeInst (FreezeInst &I)
 
ConstantvisitDbgDeclareInst (DbgDeclareInst &I)
 
ConstantvisitDbgValueInst (DbgValueInst &I)
 
ConstantvisitDbgVariableIntrinsic (DbgVariableIntrinsic &I)
 
ConstantvisitDbgLabelInst (DbgLabelInst &I)
 
ConstantvisitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
ConstantvisitMemSetInst (MemSetInst &I)
 
ConstantvisitMemSetInlineInst (MemSetInlineInst &I)
 
ConstantvisitMemSetPatternInst (MemSetPatternInst &I)
 
ConstantvisitMemCpyInst (MemCpyInst &I)
 
ConstantvisitMemCpyInlineInst (MemCpyInlineInst &I)
 
ConstantvisitMemMoveInst (MemMoveInst &I)
 
ConstantvisitMemTransferInst (MemTransferInst &I)
 
ConstantvisitMemIntrinsic (MemIntrinsic &I)
 
ConstantvisitVAStartInst (VAStartInst &I)
 
ConstantvisitVAEndInst (VAEndInst &I)
 
ConstantvisitVACopyInst (VACopyInst &I)
 
ConstantvisitIntrinsicInst (IntrinsicInst &I)
 
ConstantvisitCallInst (CallInst &I)
 
ConstantvisitInvokeInst (InvokeInst &I)
 
ConstantvisitCallBrInst (CallBrInst &I)
 
ConstantvisitReturnInst (ReturnInst &I)
 
ConstantvisitBranchInst (BranchInst &I)
 
ConstantvisitSwitchInst (SwitchInst &I)
 
ConstantvisitIndirectBrInst (IndirectBrInst &I)
 
ConstantvisitResumeInst (ResumeInst &I)
 
ConstantvisitUnreachableInst (UnreachableInst &I)
 
ConstantvisitCleanupReturnInst (CleanupReturnInst &I)
 
ConstantvisitCatchReturnInst (CatchReturnInst &I)
 
ConstantvisitCatchSwitchInst (CatchSwitchInst &I)
 
ConstantvisitTerminator (Instruction &I)
 
ConstantvisitCastInst (CastInst &I)
 
ConstantvisitUnaryOperator (UnaryOperator &I)
 
ConstantvisitBinaryOperator (BinaryOperator &I)
 
ConstantvisitCmpInst (CmpInst &I)
 
ConstantvisitUnaryInstruction (UnaryInstruction &I)
 
ConstantvisitCallBase (CallBase &I)
 
void visitInstruction (Instruction &I)
 

Friends

class InstVisitor< InstCostVisitor, Constant * >
 

Detailed Description

Definition at line 153 of file FunctionSpecialization.h.

Constructor & Destructor Documentation

◆ InstCostVisitor()

llvm::InstCostVisitor::InstCostVisitor ( std::function< BlockFrequencyInfo &(Function &)>  GetBFI,
Function F,
const DataLayout DL,
TargetTransformInfo TTI,
SCCPSolver Solver 
)
inline

Definition at line 174 of file FunctionSpecialization.h.

References DL, and F.

Member Function Documentation

◆ getCodeSizeSavingsForArg()

Cost InstCostVisitor::getCodeSizeSavingsForArg ( Argument A,
Constant C 
)

Compute the codesize savings for replacing argument A with constant C.

Definition at line 163 of file FunctionSpecialization.cpp.

References A, llvm::CallingConv::C, llvm::dbgs(), isBlockExecutable(), and LLVM_DEBUG.

◆ getCodeSizeSavingsFromPendingPHIs()

Cost InstCostVisitor::getCodeSizeSavingsFromPendingPHIs ( )

Definition at line 151 of file FunctionSpecialization.cpp.

References isBlockExecutable().

◆ getLatencySavingsForKnownConstants()

Cost InstCostVisitor::getLatencySavingsForKnownConstants ( )

Compute the latency savings from replacing all arguments with constants for a specialization candidate.

As this function computes the latency savings for all Instructions in KnownConstants at once, it should be called only after every instruction has been visited, i.e. after:

  • getCodeSizeSavingsForArg has been run for every constant argument of a specialization candidate
  • getCodeSizeSavingsFromPendingPHIs has been run

to ensure that the latency savings are calculated for all Instructions we have visited and found to be constant.

Definition at line 189 of file FunctionSpecialization.cpp.

References llvm::dbgs(), llvm::TargetTransformInfo::getInstructionCost(), I, llvm::Latency, LLVM_DEBUG, and llvm::TargetTransformInfo::TCK_Latency.

◆ isBlockExecutable()

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

Friends And Related Function Documentation

◆ InstVisitor< InstCostVisitor, Constant * >

friend class InstVisitor< InstCostVisitor, Constant * >
friend

Definition at line 187 of file FunctionSpecialization.h.


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