LLVM  6.0.0svn
Public Member Functions | List of all members
llvm::MachineTraceMetrics::Trace Class Reference

A trace represents a plausible sequence of executed basic blocks that passes through the current basic block one. More...

#include "llvm/CodeGen/MachineTraceMetrics.h"

Public Member Functions

 Trace (Ensemble &te, TraceBlockInfo &tbi)
 
void print (raw_ostream &) const
 
unsigned getInstrCount () const
 Compute the total number of instructions in the trace. More...
 
unsigned getResourceDepth (bool Bottom) const
 Return the resource depth of the top/bottom of the trace center block. More...
 
unsigned getResourceLength (ArrayRef< const MachineBasicBlock *> Extrablocks=None, ArrayRef< const MCSchedClassDesc *> ExtraInstrs=None, ArrayRef< const MCSchedClassDesc *> RemoveInstrs=None) const
 Return the resource length of the trace. More...
 
unsigned getCriticalPath () const
 Return the length of the (data dependency) critical path through the trace. More...
 
InstrCycles getInstrCycles (const MachineInstr &MI) const
 Return the depth and height of MI. More...
 
unsigned getInstrSlack (const MachineInstr &MI) const
 Return the slack of MI. More...
 
unsigned getPHIDepth (const MachineInstr &PHI) const
 Return the Depth of a PHI instruction in a trace center block successor. More...
 
bool isDepInTrace (const MachineInstr &DefMI, const MachineInstr &UseMI) const
 A dependence is useful if the basic block of the defining instruction is part of the trace of the user instruction. More...
 

Detailed Description

A trace represents a plausible sequence of executed basic blocks that passes through the current basic block one.

The Trace class serves as a handle to internal cached data structures.

Definition at line 256 of file MachineTraceMetrics.h.

Constructor & Destructor Documentation

◆ Trace()

llvm::MachineTraceMetrics::Trace::Trace ( Ensemble te,
TraceBlockInfo tbi 
)
inlineexplicit

Definition at line 263 of file MachineTraceMetrics.h.

References print().

Member Function Documentation

◆ getCriticalPath()

unsigned llvm::MachineTraceMetrics::Trace::getCriticalPath ( ) const
inline

Return the length of the (data dependency) critical path through the trace.

Definition at line 294 of file MachineTraceMetrics.h.

References llvm::MachineTraceMetrics::TraceBlockInfo::CriticalPath.

Referenced by adjCycles().

◆ getInstrCount()

unsigned llvm::MachineTraceMetrics::Trace::getInstrCount ( ) const
inline

Compute the total number of instructions in the trace.

Definition at line 268 of file MachineTraceMetrics.h.

References llvm::MachineTraceMetrics::TraceBlockInfo::InstrDepth, llvm::MachineTraceMetrics::TraceBlockInfo::InstrHeight, and llvm::None.

◆ getInstrCycles()

InstrCycles llvm::MachineTraceMetrics::Trace::getInstrCycles ( const MachineInstr MI) const
inline

Return the depth and height of MI.

The depth is only valid for instructions in or above the trace center block. The height is only valid for instructions in or below the trace center block.

Definition at line 299 of file MachineTraceMetrics.h.

References DefMI, llvm::LiveRegUnit::MI, and UseMI.

Referenced by adjCycles(), llvm::createAArch64ConditionalCompares(), and getCombinerObjective().

◆ getInstrSlack()

unsigned MachineTraceMetrics::Trace::getInstrSlack ( const MachineInstr MI) const

Return the slack of MI.

This is the number of cycles MI can be delayed before the critical path becomes longer. MI must be an instruction in the trace center block.

Definition at line 1175 of file MachineTraceMetrics.cpp.

References assert(), llvm::MachineTraceMetrics::InstrCycles::Depth, llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getParent(), and llvm::MachineTraceMetrics::InstrCycles::Height.

Referenced by adjCycles(), and getCombinerObjective().

◆ getPHIDepth()

unsigned MachineTraceMetrics::Trace::getPHIDepth ( const MachineInstr PHI) const

Return the Depth of a PHI instruction in a trace center block successor.

The PHI does not have to be part of the trace.

Definition at line 1183 of file MachineTraceMetrics.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T >::front(), getPHIDeps(), and llvm::SmallVectorTemplateCommon< T >::size().

Referenced by adjCycles().

◆ getResourceDepth()

unsigned MachineTraceMetrics::Trace::getResourceDepth ( bool  Bottom) const

Return the resource depth of the top/bottom of the trace center block.

When bottom is set include instructions in current block in estimate.

This is the number of cycles required to execute all instructions from the trace head to the trace center block. The resource depth only considers execution resources, it ignores data dependencies. When Bottom is set, instructions in the trace center block are included.

All instructions before current block

Definition at line 1198 of file MachineTraceMetrics.cpp.

References llvm::max(), and llvm::ArrayRef< T >::size().

Referenced by llvm::createAArch64ConditionalCompares().

◆ getResourceLength()

unsigned MachineTraceMetrics::Trace::getResourceLength ( ArrayRef< const MachineBasicBlock *>  Extrablocks = None,
ArrayRef< const MCSchedClassDesc *>  ExtraInstrs = None,
ArrayRef< const MCSchedClassDesc *>  RemoveInstrs = None 
) const

Return the resource length of the trace.

This is the number of cycles required to execute the instructions in the trace if they were all independent, exposing the maximum instruction-level parallelism.

Any blocks in Extrablocks are included as if they were part of the trace. Likewise, extra resources required by the specified scheduling classes are included. For the caller to account for extra machine instructions, it must first resolve each instruction's scheduling class.

Definition at line 1225 of file MachineTraceMetrics.cpp.

References llvm::MachineBasicBlock::getNumber(), llvm::max(), llvm::PPCISD::SC, and llvm::ArrayRef< T >::size().

Referenced by adjCycles(), getCombinerObjective(), and INITIALIZE_PASS().

◆ isDepInTrace()

bool MachineTraceMetrics::Trace::isDepInTrace ( const MachineInstr DefMI,
const MachineInstr UseMI 
) const

A dependence is useful if the basic block of the defining instruction is part of the trace of the user instruction.

It is assumed that DefMI dominates UseMI (see also isUsefulDominator).

Definition at line 1279 of file MachineTraceMetrics.cpp.

References llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getParent(), and llvm::MachineTraceMetrics::TraceBlockInfo::isUsefulDominator().

◆ print()

void MachineTraceMetrics::Trace::print ( raw_ostream OS) const

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