Go to the documentation of this file.
13 #ifndef LLVM_CODEGEN_SCHEDULEDFS_H
14 #define LLVM_CODEGEN_SCHEDULEDFS_H
24 template <
typename T>
class ArrayRef;
68 static const unsigned InvalidSubtreeID = ~0u;
78 unsigned SubtreeID = InvalidSubtreeID;
85 unsigned ParentTreeID = InvalidSubtreeID;
86 unsigned SubInstrCount = 0;
96 Connection(
unsigned tree,
unsigned level): TreeID(tree), Level(level) {}
100 unsigned SubtreeLimit;
102 std::vector<NodeData> DFSNodeData;
105 SmallVector<TreeData, 16> DFSTreeData;
109 std::vector<SmallVector<Connection, 4>> SubtreeConnections;
113 std::vector<unsigned> SubtreeConnectLevels;
117 : IsBottomUp(IsBU), SubtreeLimit(lim) {}
125 bool empty()
const {
return DFSNodeData.empty(); }
131 SubtreeConnections.clear();
132 SubtreeConnectLevels.clear();
137 DFSNodeData.resize(NumSUnits);
146 return DFSNodeData[SU->
NodeNum].InstrCount;
152 return DFSTreeData[SubtreeID].SubInstrCount;
173 return DFSNodeData[SU->
NodeNum].SubtreeID;
181 return SubtreeConnectLevels[SubtreeID];
189 raw_ostream &
operator<<(raw_ostream &OS,
const ILPValue &Val);
193 #endif // LLVM_CODEGEN_SCHEDULEDFS_H
void scheduleTree(unsigned SubtreeID)
Scheduler callback to update SubtreeConnectLevels when a tree is initially scheduled.
This is an optimization pass for GlobalISel generic memory operations.
Internal state used to compute SchedDFSResult.
static unsigned InstrCount
unsigned getDepth() const
Returns the depth of this node, which is the length of the maximum path up to any node which has no p...
unsigned getSubtreeID(const SUnit *SU) const
Get the ID of the subtree the given DAG node belongs to.
unsigned getNumSubInstrs(unsigned SubtreeID) const
Get the number of instructions in the given subtree not including children.
void clear()
Clear the results.
bool operator<(ILPValue RHS) const
unsigned NodeNum
Entry # of node in the node vector.
ILPValue(unsigned count, unsigned length)
Represent the ILP of the subDAG rooted at a DAG node.
unsigned getSubtreeLevel(unsigned SubtreeID) const
Get the connection level of a subtree.
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)
unsigned getNumSubtrees() const
The number of subtrees detected in this DAG.
void print(raw_ostream &OS) const
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
void resize(unsigned NumSUnits)
Initialize the result data with the size of the DAG.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator<=(ILPValue RHS) const
SchedDFSResult(bool IsBU, unsigned lim)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
unsigned Length
Length may either correspond to depth or height, depending on direction, and cycles or nodes dependin...
unsigned getSubtreeLimit() const
Get the node cutoff before subtrees are considered significant.
Compute the values of each DAG node for various metrics during DFS.
unsigned getNumInstrs(const SUnit *SU) const
Get the number of instructions in the given subtree and its children.
bool operator>=(ILPValue RHS) const
bool empty() const
Return true if this DFSResult is uninitialized.
bool operator>(ILPValue RHS) const
ArrayRef(const T &OneElt) -> ArrayRef< T >
ILPValue getILP(const SUnit *SU) const
Get the ILP value for a DAG node.
Scheduling unit. This is a node in the scheduling DAG.
void compute(ArrayRef< SUnit > SUnits)
Compute various metrics for the DAG with given roots.