47 #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H 48 #define LLVM_CODEGEN_MACHINETRACEMETRICS_H 62 class MachineFunction;
65 class MachineLoopInfo;
66 class MachineRegisterInfo;
67 struct MCSchedClassDesc;
69 class TargetInstrInfo;
70 class TargetRegisterInfo;
108 void releaseMemory()
override;
109 void verifyAnalysis()
const override;
150 LiveInReg(
unsigned Reg,
unsigned Height = 0) : Reg(Reg), Height(Height) {}
173 unsigned InstrDepth = ~0u;
177 unsigned InstrHeight = ~0u;
206 if (Head != TBI.
Head)
213 return HasValidInstrDepths && InstrDepth <= TBI.
InstrDepth;
221 bool HasValidInstrDepths =
false;
224 bool HasValidInstrHeights =
false;
260 unsigned getBlockNum()
const {
return &TBI - &TE.BlockInfo[0]; }
277 unsigned getResourceDepth(
bool Bottom)
const;
287 unsigned getResourceLength(
300 return TE.Cycles.lookup(&MI);
355 virtual const char *
getName()
const = 0;
412 Ensemble* Ensembles[TS_NumStrategies];
416 unsigned getCycles(
unsigned Scaled) {
418 return (Scaled + Factor - 1) / Factor;
436 #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H This class represents lattice values for constants.
unsigned Depth
Earliest issue cycle as determined by data dependencies and instruction latencies from the beginning ...
void print(raw_ostream &) const
void invalidateHeight()
Invalidate height resources when a block below this one has changed.
unsigned const TargetRegisterInfo * TRI
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
static unsigned InstrCount
Trace(Ensemble &te, TraceBlockInfo &tbi)
bool hasResources() const
Returns true when resource information for this block has been computed.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
Strategy
Strategies for selecting traces.
static StringRef getName(Value *V)
LiveInReg(unsigned Reg, unsigned Height=0)
bool hasValidHeight() const
Returns true if the height resources have been computed from the trace below this block...
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.
void addLiveIns(MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs)
Adds registers contained in LiveRegs to the block live-in list of MBB.
unsigned Height
For virtual registers: Minimum height of the defining instruction.
TargetInstrInfo - Interface to description of machine instruction set.
void invalidateDepth()
Invalidate depth resources when some block above this one has changed.
unsigned CriticalPath
Critical path length.
unsigned const MachineRegisterInfo * MRI
void invalidate()
Invalidate resource information.
unsigned InstrHeight
Accumulated number of instructions in the trace below this block.
MachineInstrBuilder & UseMI
MachineTraceMetrics & MTM
unsigned getCriticalPath() const
Return the length of the (data dependency) critical path through the trace.
InstrCycles getInstrCycles(const MachineInstr &MI) const
Return the depth and height of MI.
Per-basic block information that doesn't depend on the trace through the block.
unsigned getLatencyFactor() const
Multiply cycle count by this factor to normalize it relative to other resources.
Represent the analysis usage information of a pass.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
unsigned Tail
The block number of the tail of the trace. (When hasValidHeight()).
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A trace represents a plausible sequence of executed basic blocks that passes through the current basi...
bool verify(const TargetRegisterInfo &TRI) const
Check that information hold by this instance make sense for the given TRI.
unsigned getInstrCount() const
Compute the total number of instructions in the trace.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned Height
Minimum number of cycles from this instruction is issued to the of the trace, as determined by data d...
MachineInstrBuilder MachineInstrBuilder & DefMI
Per-basic block information that relates to a specific trace through the block.
unsigned Head
The block number of the head of the trace. (When hasValidDepth()).
unsigned Reg
The virtual register required, or a register unit.
A virtual register or regunit required by a basic block or its trace successors.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
SparseSet - Fast set implmentation for objects that can be identified by small unsigned keys...
InstrCycles represents the cycle height and depth of an instruction in a trace.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
void print(raw_ostream &) const
SmallVector< LiveInReg, 4 > LiveIns
Live-in registers.
unsigned InstrDepth
Accumulated number of instructions in the trace above this block.
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isUsefulDominator(const TraceBlockInfo &TBI) const
Assuming that this is a dominator of TBI, determine if it contains useful instruction depths...
unsigned getSparseSetIndex() const