LLVM 19.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::MIRProfileLoader Class Referencefinal
Inheritance diagram for llvm::MIRProfileLoader:
Inheritance graph

Public Member Functions

void setInitVals (MachineDominatorTree *MDT, MachinePostDominatorTree *MPDT, MachineLoopInfo *MLI, MachineBlockFrequencyInfo *MBFI, MachineOptimizationRemarkEmitter *MORE)
void setFSPass (FSDiscriminatorPass Pass)
 MIRProfileLoader (StringRef Name, StringRef RemapName, IntrusiveRefCntPtr< vfs::FileSystem > FS)
void setBranchProbs (MachineFunction &F)
bool runOnFunction (MachineFunction &F)
bool doInitialization (Module &M)
bool isValid () const
- Public Member Functions inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction >
 SampleProfileLoaderBaseImpl (std::string Name, std::string RemapName, IntrusiveRefCntPtr< vfs::FileSystem > FS)
void dump ()

Protected Member Functions

ErrorOr< uint64_tgetInstWeight (const MachineInstr &MI) override
- Protected Member Functions inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction >
 ~SampleProfileLoaderBaseImpl ()=default
FunctiongetFunction (FunctionT &F)
const BasicBlockTgetEntryBB (const FunctionT *F)
PredRangeT getPredecessors (BasicBlockT *BB)
SuccRangeT getSuccessors (BasicBlockT *BB)
unsigned getFunctionLoc (FunctionT &Func)
 Get the line number for the function header.
virtual ErrorOr< uint64_tgetInstWeight (const InstructionT &Inst)
 Get the weight for an instruction.
ErrorOr< uint64_tgetInstWeightImpl (const InstructionT &Inst)
virtual ErrorOr< uint64_tgetProbeWeight (const InstructionT &Inst)
ErrorOr< uint64_tgetBlockWeight (const BasicBlockT *BB)
 Compute the weight of a basic block.
virtual const FunctionSamplesfindFunctionSamples (const InstructionT &I) const
 Get the FunctionSamples for an instruction.
void printEdgeWeight (raw_ostream &OS, Edge E)
 Print the weight of edge E on stream OS.
void printBlockWeight (raw_ostream &OS, const BasicBlockT *BB) const
 Print the weight of block BB on stream OS.
void printBlockEquivalence (raw_ostream &OS, const BasicBlockT *BB)
 Print the equivalence class of block BB on stream OS.
bool computeBlockWeights (FunctionT &F)
 Compute and store the weights of every basic block.
void findEquivalenceClasses (FunctionT &F)
 Find equivalence classes.
void findEquivalencesFor (BasicBlockT *BB1, ArrayRef< BasicBlockT * > Descendants, PostDominatorTreeT *DomTree)
 Find equivalence classes for the given block.
void propagateWeights (FunctionT &F)
 Propagate weights into edges.
void applyProfi (FunctionT &F, BlockEdgeMap &Successors, BlockWeightMap &SampleBlockWeights, BlockWeightMap &BlockWeights, EdgeWeightMap &EdgeWeights)
uint64_t visitEdge (Edge E, unsigned *NumUnknownEdges, Edge *UnknownEdge)
 Visit the given edge to decide if it has a valid weight.
void buildEdges (FunctionT &F)
 Build in/out edge lists for each basic block in the CFG.
bool propagateThroughEdges (FunctionT &F, bool UpdateBlockCount)
 Propagate weights through incoming/outgoing edges.
void clearFunctionData (bool ResetDT=true)
 Clear all the per-function data used to load samples and propagate weights.
void computeDominanceAndLoopInfo (FunctionT &F)
void computeDominanceAndLoopInfo (MachineFunction &F)
void computeDominanceAndLoopInfo (Function &F)
bool computeAndPropagateWeights (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs)
 Generate branch weight metadata for all branches in F.
void initWeightPropagation (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs)
void finalizeWeightPropagation (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs)
void emitCoverageRemarks (FunctionT &F)

Protected Attributes

 Hold the information of the basic block frequency.
FSDiscriminatorPass P
 PassNum is the sequence number this pass is called, start from 1.
unsigned LowBit
unsigned HighBit
bool ProfileIsValid = true
- Protected Attributes inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction >
DenseMap< const DILocation *, const FunctionSamples * > DILocation2SampleMap
BlockWeightMap BlockWeights
 Map basic blocks to their computed weights.
EdgeWeightMap EdgeWeights
 Map edges to their computed weights.
SmallPtrSet< const BasicBlockT *, 32 > VisitedBlocks
 Set of visited blocks during propagation.
SmallSet< Edge, 32 > VisitedEdges
 Set of visited edges during propagation.
EquivalenceClassMap EquivalenceClass
 Equivalence classes for block weights.
DominatorTreePtrT DT
 Dominance, post-dominance and loop information.
PostDominatorTreePtrT PDT
LoopInfoPtrT LI
BlockEdgeMap Predecessors
 Predecessors for each basic block in the CFG.
BlockEdgeMap Successors
 Successors for each basic block in the CFG.
SampleCoverageTracker CoverageTracker
 Profile coverage tracker.
std::unique_ptr< SampleProfileReaderReader
 Profile reader object.
std::map< SampleContext, FunctionSamplesOutlineFunctionSamples
 Synthetic samples created by duplicating the samples of inlined functions from the original profile as if they were top level sample profiles.
std::unique_ptr< PseudoProbeManagerProbeManager
 Samples collected for the body of this function.
std::string Filename
 Name of the profile file to load.
std::string RemappingFilename
 Name of the profile remapping file to load.
IntrusiveRefCntPtr< vfs::FileSystemFS
 VirtualFileSystem to load profile files from.
 Profile Summary Info computed from sample profile.
 Optimization Remark Emitter used to emit diagnostic remarks.


class SampleCoverageTracker

Additional Inherited Members

- Public Types inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction >
using NodeRef = typename GraphTraits< MachineFunction * >::NodeRef
using BT = std::remove_pointer_t< NodeRef >
using InstructionT = typename afdo_detail::IRTraits< BT >::InstructionT
using BasicBlockT = typename afdo_detail::IRTraits< BT >::BasicBlockT
using BlockFrequencyInfoT = typename afdo_detail::IRTraits< BT >::BlockFrequencyInfoT
using FunctionT = typename afdo_detail::IRTraits< BT >::FunctionT
using LoopT = typename afdo_detail::IRTraits< BT >::LoopT
using LoopInfoPtrT = typename afdo_detail::IRTraits< BT >::LoopInfoPtrT
using DominatorTreePtrT = typename afdo_detail::IRTraits< BT >::DominatorTreePtrT
using PostDominatorTreePtrT = typename afdo_detail::IRTraits< BT >::PostDominatorTreePtrT
using PostDominatorTreeT = typename afdo_detail::IRTraits< BT >::PostDominatorTreeT
using OptRemarkEmitterT = typename afdo_detail::IRTraits< BT >::OptRemarkEmitterT
using OptRemarkAnalysisT = typename afdo_detail::IRTraits< BT >::OptRemarkAnalysisT
using PredRangeT = typename afdo_detail::IRTraits< BT >::PredRangeT
using SuccRangeT = typename afdo_detail::IRTraits< BT >::SuccRangeT
using BlockWeightMap = DenseMap< const BasicBlockT *, uint64_t >
using EquivalenceClassMap = DenseMap< const BasicBlockT *, const BasicBlockT * >
using Edge = std::pair< const BasicBlockT *, const BasicBlockT * >
using EdgeWeightMap = DenseMap< Edge, uint64_t >
using BlockEdgeMap = DenseMap< const BasicBlockT *, SmallVector< const BasicBlockT *, 8 > >

Detailed Description

Definition at line 144 of file MIRSampleProfile.cpp.

Constructor & Destructor Documentation

◆ MIRProfileLoader()

llvm::MIRProfileLoader::MIRProfileLoader ( StringRef  Name,
StringRef  RemapName,
IntrusiveRefCntPtr< vfs::FileSystem FS 

Definition at line 163 of file MIRSampleProfile.cpp.

References string.

Member Function Documentation

◆ doInitialization()

bool llvm::MIRProfileLoader::doInitialization ( Module M)

◆ getInstWeight()

ErrorOr< uint64_t > llvm::MIRProfileLoader::getInstWeight ( const MachineInstr MI)

◆ isValid()

bool llvm::MIRProfileLoader::isValid ( ) const

Definition at line 171 of file MIRSampleProfile.cpp.

References ProfileIsValid.

◆ runOnFunction()

bool llvm::MIRProfileLoader::runOnFunction ( MachineFunction F)

◆ setBranchProbs()

void llvm::MIRProfileLoader::setBranchProbs ( MachineFunction F)

◆ setFSPass()

void llvm::MIRProfileLoader::setFSPass ( FSDiscriminatorPass  Pass)

◆ setInitVals()

void llvm::MIRProfileLoader::setInitVals ( MachineDominatorTree MDT,
MachinePostDominatorTree MPDT,
MachineLoopInfo MLI,
MachineBlockFrequencyInfo MBFI,
MachineOptimizationRemarkEmitter MORE 

Friends And Related Function Documentation

◆ SampleCoverageTracker

friend class SampleCoverageTracker

Definition at line 174 of file MIRSampleProfile.cpp.

Member Data Documentation


MachineBlockFrequencyInfo* llvm::MIRProfileLoader::BFI

Hold the information of the basic block frequency.

Definition at line 177 of file MIRSampleProfile.cpp.

Referenced by setBranchProbs(), and setInitVals().

◆ HighBit

unsigned llvm::MIRProfileLoader::HighBit

Definition at line 187 of file MIRSampleProfile.cpp.

Referenced by setFSPass().

◆ LowBit

unsigned llvm::MIRProfileLoader::LowBit

Definition at line 184 of file MIRSampleProfile.cpp.

Referenced by setFSPass().

◆ P

FSDiscriminatorPass llvm::MIRProfileLoader::P

PassNum is the sequence number this pass is called, start from 1.

Definition at line 180 of file MIRSampleProfile.cpp.

Referenced by doInitialization(), and setFSPass().

◆ ProfileIsValid

bool llvm::MIRProfileLoader::ProfileIsValid = true

Definition at line 189 of file MIRSampleProfile.cpp.

Referenced by doInitialization(), and isValid().

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