47 #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H
48 #define LLVM_CODEGEN_MACHINETRACEMETRICS_H
57 class InstrItineraryData;
58 class MachineBasicBlock;
61 class MachineLoopInfo;
62 class MachineRegisterInfo;
63 class TargetInstrInfo;
64 class TargetRegisterInfo;
240 unsigned getBlockNum()
const {
return &TBI - &TE.BlockInfo[0]; }
279 return TE.Cycles.lookup(MI);
330 virtual const char *
getName()
const =0;
379 unsigned getCycles(
unsigned Scaled) {
381 return (Scaled + Factor - 1) / Factor;
void print(raw_ostream &) const
bool HasValidInstrDepths
Instruction depths have been computed. This implies hasValidDepth().
ArrayRef< unsigned > getProcResourceDepths(unsigned MBBNum) const
Get an array of processor resource depths for MBB.
void print(raw_ostream &) const
void print(raw_ostream &) const
const MachineBasicBlock * Pred
Trace predecessor, or NULL for the first block in the trace.
unsigned Depth
Earliest issue cycle as determined by data dependencies and instruction latencies from the beginning ...
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...
bool HasCalls
True when the block contains calls.
unsigned getCriticalPath() const
Return the length of the (data dependency) critical path through the trace.
void invalidateHeight()
Invalidate height resources when a block below this one has changed.
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
Trace(Ensemble &te, TraceBlockInfo &tbi)
unsigned getInstrCount() const
Compute the total number of instructions in the trace.
unsigned InstrCount
The number of non-trivial instructions in the block.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Provide an instruction scheduling machine model to CodeGen passes.
const MachineLoop * getLoopFor(const MachineBasicBlock *) const
Strategy
Strategies for selecting traces.
bool isUsefulDominator(const TraceBlockInfo &TBI) const
Assuming that this is a dominator of TBI, determine if it contains useful instruction depths...
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
LiveInReg(unsigned Reg, unsigned Height=0)
virtual const MachineBasicBlock * pickTraceSucc(const MachineBasicBlock *)=0
Select the trace through a block that has the fewest instructions.
const TraceBlockInfo * getHeightResources(const MachineBasicBlock *) const
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.
void invalidate(const MachineBasicBlock *MBB)
Invalidate traces through BadMBB.
unsigned CriticalPath
Critical path length.
void invalidate()
Invalidate resource information.
bool HasValidInstrHeights
Instruction heights have been computed. This implies hasValidHeight().
unsigned InstrHeight
Accumulated number of instructions in the trace below this block.
Ensemble * getEnsemble(Strategy)
Get the trace ensemble representing the given trace selection strategy.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Ensemble(MachineTraceMetrics *)
MachineTraceMetrics & MTM
unsigned getLatencyFactor() const
Multiply cycle count by this factor to normalize it relative to other resources.
Per-basic block information that doesn't depend on the trace through the block.
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.
static void addLiveIns(LivePhysRegs &LiveRegs, const MachineBasicBlock &MBB)
Add live-in registers of basic block MBB to LiveRegs.
Represent the analysis usage information of a pass.
const MachineBasicBlock * Succ
Trace successor, or NULL for the last block in the trace.
const FixedBlockInfo * getResources(const MachineBasicBlock *)
Get the fixed resource information about MBB. Compute it on demand.
unsigned Tail
The block number of the tail of the trace. (When hasValidHeight()).
const TraceBlockInfo * getDepthResources(const MachineBasicBlock *) const
virtual const char * getName() const =0
virtual const MachineBasicBlock * pickTracePred(const MachineBasicBlock *)=0
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...
ArrayRef< unsigned > getProcResourceHeights(unsigned MBBNum) const
Get an array of processor resource heights for MBB.
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...
bool hasValidDepth() const
Returns true if the depth resources have been computed from the trace above this block.
Per-basic block information that relates to a specific trace through the block.
void invalidate(const MachineBasicBlock *MBB)
Invalidate cached information about MBB.
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.
bool hasResources() const
Returns true when resource information for this block has been computed.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
InstrCycles getInstrCycles(const MachineInstr *MI) const
Return the depth and height of MI.
Representation of each machine instruction.
InstrCycles represents the cycle height and depth of an instruction in a trace.
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
bool hasValidHeight() const
Returns true if the height resources have been computed from the trace below this block...
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
unsigned getPHIDepth(const MachineInstr *PHI) const
Return the Depth of a PHI instruction in a trace center block successor.
SmallVector< LiveInReg, 4 > LiveIns
Live-in registers.
unsigned getResourceDepth(bool Bottom) const
Return the resource depth of the top/bottom of the trace center block.
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...
ArrayRef< unsigned > getProcResourceCycles(unsigned MBBNum) const
Get the scaled number of cycles used per processor resource in MBB.
Trace getTrace(const MachineBasicBlock *MBB)
Get the trace that passes through MBB.
unsigned getInstrSlack(const MachineInstr *MI) const
Return the slack of MI.
void getAnalysisUsage(AnalysisUsage &) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.