class ConstantHoistingPass

Declaration

class ConstantHoistingPass : public PassInfoMixin { /* full declaration omitted */ };

Description

A CRTP mix-in to automatically provide informational APIs needed for passes. This provides some boilerplate for types that are passes.

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:123

Inherits from: PassInfoMixin

Member Variables

private const llvm::TargetTransformInfo* TTI
private llvm::DominatorTree* DT
private llvm::BlockFrequencyInfo* BFI
private llvm::LLVMContext* Ctx
private const llvm::DataLayout* DL
private llvm::BasicBlock* Entry
private llvm::ProfileSummaryInfo* PSI
private llvm::ConstantHoistingPass::ConstCandVecType ConstIntCandVec
private llvm::ConstantHoistingPass::GVCandVecMapType ConstGEPCandMap
private llvm::ConstantHoistingPass::ConstInfoVecType ConstIntInfoVec
private llvm::ConstantHoistingPass::GVInfoVecMapType ConstGEPInfoMap
private MapVector<llvm::Instruction*, llvm::Instruction*> ClonedCastMap
Keep track of cast instructions we already cloned.

Method Overview

  • public void cleanup()
  • private void collectConstantCandidates(llvm::ConstantHoistingPass::ConstCandMapType & ConstCandMap, llvm::Instruction * Inst, unsigned int Idx, llvm::ConstantInt * ConstInt)
  • private void collectConstantCandidates(llvm::ConstantHoistingPass::ConstCandMapType & ConstCandMap, llvm::Instruction * Inst, unsigned int Idx, llvm::ConstantExpr * ConstExpr)
  • private void collectConstantCandidates(llvm::ConstantHoistingPass::ConstCandMapType & ConstCandMap, llvm::Instruction * Inst, unsigned int Idx)
  • private void collectConstantCandidates(llvm::ConstantHoistingPass::ConstCandMapType & ConstCandMap, llvm::Instruction * Inst)
  • private void collectConstantCandidates(llvm::Function & Fn)
  • private void deleteDeadCastInst() const
  • private void emitBaseConstants(llvm::Instruction * Base, llvm::Constant * Offset, llvm::Type * Ty, const consthoist::ConstantUser & ConstUser)
  • private bool emitBaseConstants(llvm::GlobalVariable * BaseGV)
  • private void findAndMakeBaseConstant(ConstCandVecType::iterator S, ConstCandVecType::iterator E, SmallVectorImpl<consthoist::ConstantInfo> & ConstInfoVec)
  • private void findBaseConstants(llvm::GlobalVariable * BaseGV)
  • private SetVector<llvm::Instruction *> findConstantInsertionPoint(const consthoist::ConstantInfo & ConstInfo) const
  • private llvm::Instruction * findMatInsertPt(llvm::Instruction * Inst, unsigned int Idx = ~0U) const
  • private unsigned int maximizeConstantsInRange(ConstCandVecType::iterator S, ConstCandVecType::iterator E, ConstCandVecType::iterator & MaxCostItr)
  • public llvm::PreservedAnalyses run(llvm::Function & F, llvm::FunctionAnalysisManager & AM)
  • public bool runImpl(llvm::Function & F, llvm::TargetTransformInfo & TTI, llvm::DominatorTree & DT, llvm::BlockFrequencyInfo * BFI, llvm::BasicBlock & Entry, llvm::ProfileSummaryInfo * PSI)

Methods

void cleanup()

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:132

void collectConstantCandidates(
    llvm::ConstantHoistingPass::ConstCandMapType&
        ConstCandMap,
    llvm::Instruction* Inst,
    unsigned int Idx,
    llvm::ConstantInt* ConstInt)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:174

Parameters

llvm::ConstantHoistingPass::ConstCandMapType& ConstCandMap
llvm::Instruction* Inst
unsigned int Idx
llvm::ConstantInt* ConstInt

void collectConstantCandidates(
    llvm::ConstantHoistingPass::ConstCandMapType&
        ConstCandMap,
    llvm::Instruction* Inst,
    unsigned int Idx,
    llvm::ConstantExpr* ConstExpr)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:177

Parameters

llvm::ConstantHoistingPass::ConstCandMapType& ConstCandMap
llvm::Instruction* Inst
unsigned int Idx
llvm::ConstantExpr* ConstExpr

void collectConstantCandidates(
    llvm::ConstantHoistingPass::ConstCandMapType&
        ConstCandMap,
    llvm::Instruction* Inst,
    unsigned int Idx)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:180

Parameters

llvm::ConstantHoistingPass::ConstCandMapType& ConstCandMap
llvm::Instruction* Inst
unsigned int Idx

void collectConstantCandidates(
    llvm::ConstantHoistingPass::ConstCandMapType&
        ConstCandMap,
    llvm::Instruction* Inst)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:182

Parameters

llvm::ConstantHoistingPass::ConstCandMapType& ConstCandMap
llvm::Instruction* Inst

void collectConstantCandidates(llvm::Function& Fn)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:184

Parameters

llvm::Function& Fn

void deleteDeadCastInst() const

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:199

void emitBaseConstants(
    llvm::Instruction* Base,
    llvm::Constant* Offset,
    llvm::Type* Ty,
    const consthoist::ConstantUser& ConstUser)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:194

Parameters

llvm::Instruction* Base
llvm::Constant* Offset
llvm::Type* Ty
const consthoist::ConstantUser& ConstUser

bool emitBaseConstants(
    llvm::GlobalVariable* BaseGV)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:198

Parameters

llvm::GlobalVariable* BaseGV

void findAndMakeBaseConstant(
    ConstCandVecType::iterator S,
    ConstCandVecType::iterator E,
    SmallVectorImpl<consthoist::ConstantInfo>&
        ConstInfoVec)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:185

Parameters

ConstCandVecType::iterator S
ConstCandVecType::iterator E
SmallVectorImpl<consthoist::ConstantInfo>& ConstInfoVec

void findBaseConstants(
    llvm::GlobalVariable* BaseGV)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:193

Parameters

llvm::GlobalVariable* BaseGV

SetVector<llvm::Instruction*>
findConstantInsertionPoint(
    const consthoist::ConstantInfo& ConstInfo)
    const

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:173

Parameters

const consthoist::ConstantInfo& ConstInfo

llvm::Instruction* findMatInsertPt(
    llvm::Instruction* Inst,
    unsigned int Idx = ~0U) const

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:171

Parameters

llvm::Instruction* Inst
unsigned int Idx = ~0U

unsigned int maximizeConstantsInRange(
    ConstCandVecType::iterator S,
    ConstCandVecType::iterator E,
    ConstCandVecType::iterator& MaxCostItr)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:188

Parameters

ConstCandVecType::iterator S
ConstCandVecType::iterator E
ConstCandVecType::iterator& MaxCostItr

llvm::PreservedAnalyses run(
    llvm::Function& F,
    llvm::FunctionAnalysisManager& AM)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:125

Parameters

llvm::Function& F
llvm::FunctionAnalysisManager& AM

bool runImpl(llvm::Function& F,
             llvm::TargetTransformInfo& TTI,
             llvm::DominatorTree& DT,
             llvm::BlockFrequencyInfo* BFI,
             llvm::BasicBlock& Entry,
             llvm::ProfileSummaryInfo* PSI)

Declared at: llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h:128

Parameters

llvm::Function& F
llvm::TargetTransformInfo& TTI
llvm::DominatorTree& DT
llvm::BlockFrequencyInfo* BFI
llvm::BasicBlock& Entry
llvm::ProfileSummaryInfo* PSI