Go to the documentation of this file.
46 #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H
47 #define LLVM_CODEGEN_MACHINETRACEMETRICS_H
61 class MachineFunction;
64 class MachineLoopInfo;
65 class MachineRegisterInfo;
66 struct MCSchedClassDesc;
68 class TargetInstrInfo;
69 class TargetRegisterInfo;
259 unsigned getBlockNum()
const {
return &TBI - &TE.BlockInfo[0]; }
299 return TE.Cycles.lookup(&
MI);
354 virtual const char *
getName()
const = 0;
415 unsigned getCycles(
unsigned Scaled) {
417 return (
Scaled + Factor - 1) / Factor;
435 #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H
bool hasResources() const
Returns true when resource information for this block has been computed.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder & UseMI
unsigned Depth
Earliest issue cycle as determined by data dependencies and instruction latencies from the beginning ...
virtual const MachineBasicBlock * pickTracePred(const MachineBasicBlock *)=0
Per-basic block information that relates to a specific trace through the block.
unsigned InstrCount
The number of non-trivial instructions in the block.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
void invalidate(const MachineBasicBlock *MBB)
Invalidate traces through BadMBB.
const FixedBlockInfo * getResources(const MachineBasicBlock *)
Get the fixed resource information about MBB. Compute it on demand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Strategy
Strategies for selecting traces.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
bool hasValidHeight() const
Returns true if the height resources have been computed from the trace below this block.
@ TS_MinInstrCount
Select the trace through a block that has the fewest instructions.
bool hasValidDepth() const
Returns true if the depth resources have been computed from the trace above this block.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Per-basic block information that doesn't depend on the trace through the block.
unsigned Head
The block number of the head of the trace. (When hasValidDepth()).
virtual const char * getName() const =0
LiveInRegUnits addLiveIns(MBB)
void invalidate(const MachineBasicBlock *MBB)
Invalidate cached information about MBB.
unsigned getCriticalPath() const
Return the length of the (data dependency) critical path through the trace.
Trace getTrace(const MachineBasicBlock *MBB)
Get the trace that passes through MBB.
Ensemble(MachineTraceMetrics *)
InstrCycles getInstrCycles(const MachineInstr &MI) const
Return the depth and height of MI.
bool HasValidInstrHeights
Instruction heights have been computed. This implies hasValidHeight().
void updateDepths(MachineBasicBlock::iterator Start, MachineBasicBlock::iterator End, SparseSet< LiveRegUnit > &RegUnits)
Updates the depth of the instructions from Start to End.
void updateDepth(TraceBlockInfo &TBI, const MachineInstr &, SparseSet< LiveRegUnit > &RegUnits)
Updates the depth of an machine instruction, given RegUnits.
unsigned InstrHeight
Accumulated number of instructions in the trace below this block.
TargetInstrInfo - Interface to description of machine instruction set.
virtual const MachineBasicBlock * pickTraceSucc(const MachineBasicBlock *)=0
bool isUsefulDominator(const TraceBlockInfo &TBI) const
Assuming that this is a dominator of TBI, determine if it contains useful instruction depths.
LiveInReg(Register Reg, unsigned Height=0)
Represent the analysis usage information of a pass.
ArrayRef< unsigned > getProcResourceCycles(unsigned MBBNum) const
Get the scaled number of cycles used per processor resource in MBB.
A possibly irreducible generalization of a Loop.
InstrCycles represents the cycle height and depth of an instruction in a trace.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
void print(raw_ostream &) const
Register Reg
The virtual register required, or a register unit.
unsigned getResourceDepth(bool Bottom) const
Return the resource depth of the top/bottom of the trace center block.
A trace represents a plausible sequence of executed basic blocks that passes through the current basi...
void getAnalysisUsage(AnalysisUsage &) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
SmallVector< LiveInReg, 4 > LiveIns
Live-in registers.
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 use...
Ensemble * getEnsemble(Strategy)
Get the trace ensemble representing the given trace selection strategy.
Provide an instruction scheduling machine model to CodeGen passes.
Representation of each machine instruction.
unsigned InstrDepth
Accumulated number of instructions in the trace above this block.
unsigned Height
For virtual registers: Minimum height of the defining instruction.
MachineTraceMetrics & MTM
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.
Trace(Ensemble &te, TraceBlockInfo &tbi)
unsigned getInstrCount() const
Compute the total number of instructions in the trace.
void invalidate()
Invalidate resource information.
void print(raw_ostream &) const
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
const TraceBlockInfo * getHeightResources(const MachineBasicBlock *) const
unsigned getLatencyFactor() const
Multiply cycle count by this factor to normalize it relative to other resources.
bool HasValidInstrDepths
Instruction depths have been computed. This implies hasValidDepth().
unsigned getSparseSetIndex() const
unsigned Height
Minimum number of cycles from this instruction is issued to the of the trace, as determined by data d...
void invalidateHeight()
Invalidate height resources when a block below this one has changed.
Wrapper class representing virtual and physical registers.
const MachineBasicBlock * Pred
Trace predecessor, or NULL for the first block in the trace.
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
void print(raw_ostream &) const
const MachineLoop * getLoopFor(const MachineBasicBlock *) const
ArrayRef< unsigned > getProcResourceDepths(unsigned MBBNum) const
Get an array of processor resource depths for MBB.
ArrayRef< unsigned > getProcResourceHeights(unsigned MBBNum) const
Get an array of processor resource heights for MBB.
const TraceBlockInfo * getDepthResources(const MachineBasicBlock *) const
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
unsigned getInstrSlack(const MachineInstr &MI) const
Return the slack of MI.
MachineInstrBuilder MachineInstrBuilder & DefMI
void invalidateDepth()
Invalidate depth resources when some block above this one has changed.
unsigned Tail
The block number of the tail of the trace. (When hasValidHeight()).
SparseSet - Fast set implementation for objects that can be identified by small unsigned keys.
bool HasCalls
True when the block contains calls.
unsigned getPHIDepth(const MachineInstr &PHI) const
Return the Depth of a PHI instruction in a trace center block successor.
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const MachineBasicBlock * Succ
Trace successor, or NULL for the last block in the trace.
unsigned CriticalPath
Critical path length.
A virtual register or regunit required by a basic block or its trace successors.