LLVM 22.0.0git
llvm::MachineTraceMetrics Class Reference

#include "llvm/CodeGen/MachineTraceMetrics.h"

Classes

class  Ensemble
 A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum resource height'. More...
struct  FixedBlockInfo
 Per-basic block information that doesn't depend on the trace through the block. More...
struct  InstrCycles
 InstrCycles represents the cycle height and depth of an instruction in a trace. More...
struct  LiveInReg
 A virtual register or regunit required by a basic block or its trace successors. More...
class  Trace
 A trace represents a plausible sequence of executed basic blocks that passes through the current basic block one. More...
struct  TraceBlockInfo
 Per-basic block information that relates to a specific trace through the block. More...

Public Member Functions

 MachineTraceMetrics ()=default
 MachineTraceMetrics (MachineFunction &MF, const MachineLoopInfo &LI)
 MachineTraceMetrics (MachineTraceMetrics &&)=default
 ~MachineTraceMetrics ()
void init (MachineFunction &Func, const MachineLoopInfo &LI)
void clear ()
const FixedBlockInfogetResources (const MachineBasicBlock *)
 Get the fixed resource information about MBB. Compute it on demand.
ArrayRef< unsignedgetProcReleaseAtCycles (unsigned MBBNum) const
 Get the scaled number of cycles used per processor resource in MBB.
EnsemblegetEnsemble (MachineTraceStrategy)
 Get the trace ensemble representing the given trace selection strategy.
void invalidate (const MachineBasicBlock *MBB)
 Invalidate cached information about MBB.
bool invalidate (MachineFunction &, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &)
 Handle invalidation explicitly.
void verifyAnalysis () const

Friends

class MachineTraceMetricsWrapperPass
class Ensemble
class Trace

Detailed Description

Definition at line 97 of file MachineTraceMetrics.h.

Constructor & Destructor Documentation

◆ MachineTraceMetrics() [1/3]

llvm::MachineTraceMetrics::MachineTraceMetrics ( )
default

◆ MachineTraceMetrics() [2/3]

llvm::MachineTraceMetrics::MachineTraceMetrics ( MachineFunction & MF,
const MachineLoopInfo & LI )
inlineexplicit

Definition at line 115 of file MachineTraceMetrics.h.

References init().

◆ MachineTraceMetrics() [3/3]

llvm::MachineTraceMetrics::MachineTraceMetrics ( MachineTraceMetrics && )
default

References MachineTraceMetrics().

◆ ~MachineTraceMetrics()

MachineTraceMetrics::~MachineTraceMetrics ( )

Definition at line 93 of file MachineTraceMetrics.cpp.

References clear().

Member Function Documentation

◆ clear()

void MachineTraceMetrics::clear ( )

Definition at line 95 of file MachineTraceMetrics.cpp.

Referenced by ~MachineTraceMetrics().

◆ getEnsemble()

MachineTraceMetrics::Ensemble * MachineTraceMetrics::getEnsemble ( MachineTraceStrategy strategy)

Get the trace ensemble representing the given trace selection strategy.

The returned Ensemble object is owned by the MachineTraceMetrics analysis, and valid for the lifetime of the analysis pass.

Definition at line 412 of file MachineTraceMetrics.cpp.

References assert(), llvm_unreachable, llvm::TS_Local, llvm::TS_MinInstrCount, and llvm::TS_NumStrategies.

◆ getProcReleaseAtCycles()

ArrayRef< unsigned > MachineTraceMetrics::getProcReleaseAtCycles ( unsigned MBBNum) const

Get the scaled number of cycles used per processor resource in MBB.

This is an array with SchedModel.getNumProcResourceKinds() entries. The getResources() function above must have been called first.

These numbers have already been scaled by SchedModel.getResourceFactor().

Definition at line 158 of file MachineTraceMetrics.cpp.

References llvm::ArrayRef(), and assert().

◆ getResources()

const MachineTraceMetrics::FixedBlockInfo * MachineTraceMetrics::getResources ( const MachineBasicBlock * MBB)

Get the fixed resource information about MBB. Compute it on demand.

Compute the resource usage in basic block MBB.

Definition at line 111 of file MachineTraceMetrics.cpp.

References assert(), llvm::MachineTraceMetrics::FixedBlockInfo::HasCalls, llvm::MachineTraceMetrics::FixedBlockInfo::hasResources(), InstrCount, llvm::MachineTraceMetrics::FixedBlockInfo::InstrCount, llvm::MCSchedClassDesc::isValid(), MBB, and MI.

◆ init()

void MachineTraceMetrics::init ( MachineFunction & Func,
const MachineLoopInfo & LI )

Definition at line 74 of file MachineTraceMetrics.cpp.

Referenced by MachineTraceMetrics().

◆ invalidate() [1/2]

void MachineTraceMetrics::invalidate ( const MachineBasicBlock * MBB)

Invalidate cached information about MBB.

This must be called before MBB is erased, or the CFG is otherwise changed.

This invalidates per-block information about resource usage for MBB only, and it invalidates per-trace information for any trace that passes through MBB.

Call Ensemble::getTrace() again to update any trace handles.

Definition at line 433 of file MachineTraceMetrics.cpp.

References llvm::dbgs(), LLVM_DEBUG, MBB, and llvm::printMBBReference().

◆ invalidate() [2/2]

bool MachineTraceMetrics::invalidate ( MachineFunction & ,
const PreservedAnalyses & PA,
MachineFunctionAnalysisManager::Invalidator &  )

Handle invalidation explicitly.

Definition at line 442 of file MachineTraceMetrics.cpp.

References llvm::PreservedAnalyses::getChecker().

◆ verifyAnalysis()

void MachineTraceMetrics::verifyAnalysis ( ) const

Definition at line 453 of file MachineTraceMetrics.cpp.

References assert().

◆ Ensemble

friend class Ensemble
friend

Definition at line 107 of file MachineTraceMetrics.h.

◆ MachineTraceMetricsWrapperPass

friend class MachineTraceMetricsWrapperPass
friend

Definition at line 106 of file MachineTraceMetrics.h.

References MachineTraceMetricsWrapperPass.

Referenced by MachineTraceMetricsWrapperPass.

◆ Trace

friend class Trace
friend

Definition at line 108 of file MachineTraceMetrics.h.


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