LLVM API Documentation
#include <MachineTraceMetrics.h>
Classes | |
class | Ensemble |
struct | FixedBlockInfo |
struct | InstrCycles |
struct | LiveInReg |
class | Trace |
struct | TraceBlockInfo |
Public Types | |
enum | Strategy { TS_MinInstrCount, TS_NumStrategies } |
Strategies for selecting traces. More... | |
Public Member Functions | |
MachineTraceMetrics () | |
void | getAnalysisUsage (AnalysisUsage &) const override |
bool | runOnMachineFunction (MachineFunction &) override |
void | releaseMemory () override |
void | verifyAnalysis () const override |
const FixedBlockInfo * | getResources (const MachineBasicBlock *) |
Get the fixed resource information about MBB. Compute it on demand. | |
ArrayRef< unsigned > | getProcResourceCycles (unsigned MBBNum) const |
Ensemble * | getEnsemble (Strategy) |
void | invalidate (const MachineBasicBlock *MBB) |
Static Public Attributes | |
static char | ID = 0 |
Friends | |
class | Ensemble |
class | Trace |
Definition at line 67 of file MachineTraceMetrics.h.
Strategies for selecting traces.
TS_MinInstrCount |
Select the trace through a block that has the fewest instructions. |
TS_NumStrategies |
Definition at line 341 of file MachineTraceMetrics.h.
machine trace Machine Trace true MachineTraceMetrics::MachineTraceMetrics | ( | ) |
Definition at line 40 of file MachineTraceMetrics.cpp.
References llvm::sys::path::begin(), and llvm::sys::path::end().
void MachineTraceMetrics::getAnalysisUsage | ( | AnalysisUsage & | AU | ) | const [override, virtual] |
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.
Reimplemented from llvm::MachineFunctionPass.
Definition at line 46 of file MachineTraceMetrics.cpp.
References llvm::AnalysisUsage::addRequired(), and llvm::AnalysisUsage::setPreservesAll().
MachineTraceMetrics::Ensemble * MachineTraceMetrics::getEnsemble | ( | MachineTraceMetrics::Strategy | 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 372 of file MachineTraceMetrics.cpp.
References llvm_unreachable, TS_MinInstrCount, and TS_NumStrategies.
ArrayRef< unsigned > MachineTraceMetrics::getProcResourceCycles | ( | 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 133 of file MachineTraceMetrics.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::TargetSchedModel::getNumProcResourceKinds(), llvm::makeArrayRef(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
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 86 of file MachineTraceMetrics.cpp.
References llvm::MachineBasicBlock::getNumber(), llvm::TargetSchedModel::getNumProcResourceKinds(), llvm::TargetSchedModel::getResourceFactor(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), llvm::MachineTraceMetrics::FixedBlockInfo::HasCalls, llvm::TargetSchedModel::hasInstrSchedModel(), llvm::MachineTraceMetrics::FixedBlockInfo::hasResources(), if(), llvm::MachineTraceMetrics::FixedBlockInfo::InstrCount, llvm::MCSchedClassDesc::isValid(), llvm::AArch64CC::MI, llvm::TargetSchedModel::resolveSchedClass(), and llvm::PPCISD::SC.
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 385 of file MachineTraceMetrics.cpp.
References llvm::dbgs(), DEBUG, llvm::MachineBasicBlock::getNumber(), llvm::MachineTraceMetrics::Ensemble::invalidate(), and TS_NumStrategies.
void MachineTraceMetrics::releaseMemory | ( | ) | [override, virtual] |
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.
Optionally implement this function to release pass memory when it is no longer used.
Reimplemented from llvm::Pass.
Definition at line 68 of file MachineTraceMetrics.cpp.
References llvm::SmallVectorImpl< T >::clear(), and TS_NumStrategies.
bool MachineTraceMetrics::runOnMachineFunction | ( | MachineFunction & | MF | ) | [override, virtual] |
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Implements llvm::MachineFunctionPass.
Definition at line 53 of file MachineTraceMetrics.cpp.
References llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getNumBlockIDs(), llvm::TargetSchedModel::getNumProcResourceKinds(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::TargetSchedModel::init(), Loops, llvm::SmallVectorImpl< T >::resize(), llvm::AArch64DB::ST, and TII.
void MachineTraceMetrics::verifyAnalysis | ( | ) | const [override, virtual] |
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.
Reimplemented from llvm::Pass.
Definition at line 393 of file MachineTraceMetrics.cpp.
References llvm::MachineFunction::getNumBlockIDs(), llvm::SmallVectorTemplateCommon< T, typename >::size(), TS_NumStrategies, and llvm::MachineTraceMetrics::Ensemble::verify().
friend class Ensemble [friend] |
Definition at line 85 of file MachineTraceMetrics.h.
friend class Trace [friend] |
Definition at line 86 of file MachineTraceMetrics.h.
Referenced by llvm::MachineTraceMetrics::Ensemble::getTrace().
char MachineTraceMetrics::ID = 0 [static] |
Definition at line 77 of file MachineTraceMetrics.h.