14 #ifndef LLVM_CODEGEN_SCHEDULEDFS_H
15 #define LLVM_CODEGEN_SCHEDULEDFS_H
18 #include "llvm/Support/DataTypes.h"
25 class ScheduleDAGInstrs;
69 static const unsigned InvalidSubtreeID = ~0u;
81 NodeData(): InstrCount(0), SubtreeID(InvalidSubtreeID) {}
86 unsigned ParentTreeID;
87 unsigned SubInstrCount;
89 TreeData(): ParentTreeID(InvalidSubtreeID), SubInstrCount(0) {}
97 Connection(
unsigned tree,
unsigned level): TreeID(tree),
Level(level) {}
101 unsigned SubtreeLimit;
103 std::vector<NodeData> DFSNodeData;
106 SmallVector<TreeData, 16> DFSTreeData;
110 std::vector<SmallVector<Connection, 4> > SubtreeConnections;
114 std::vector<unsigned> SubtreeConnectLevels;
118 : IsBottomUp(IsBU), SubtreeLimit(lim) {}
126 bool empty()
const {
return DFSNodeData.empty(); }
132 SubtreeConnections.clear();
133 SubtreeConnectLevels.clear();
138 DFSNodeData.resize(NumSUnits);
147 return DFSNodeData[SU->
NodeNum].InstrCount;
153 return DFSTreeData[SubtreeID].SubInstrCount;
173 assert(SU->
NodeNum < DFSNodeData.size() &&
"New Node");
174 return DFSNodeData[SU->
NodeNum].SubtreeID;
182 return SubtreeConnectLevels[SubtreeID];
190 raw_ostream &
operator<<(raw_ostream &OS,
const ILPValue &Val);
unsigned getSubtreeLimit() const
Get the node cutoff before subtrees are considered significant.
void clear()
Clear the results.
unsigned getSubtreeLevel(unsigned SubtreeID) const
Get the connection level of a subtree.
Represent the ILP of the subDAG rooted at a DAG node.
unsigned getNumSubInstrs(unsigned SubtreeID) const
Get the number of instructions in the given subtree not including children.
bool operator>(ILPValue RHS) const
unsigned getNumSubtrees() const
The number of subtrees detected in this DAG.
Compute the values of each DAG node for various metrics during DFS.
void print(raw_ostream &OS) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool operator<=(ILPValue RHS) const
ILPValue(unsigned count, unsigned length)
void resize(unsigned NumSUnits)
Initialize the result data with the size of the DAG.
bool operator>=(ILPValue RHS) const
bool operator<(ILPValue RHS) const
Internal state used to compute SchedDFSResult.
bool empty() const
Return true if this DFSResult is uninitialized.
void compute(ArrayRef< SUnit > SUnits)
Compute various metrics for the DAG with given roots.
unsigned Length
Length may either correspond to depth or height, depending on direction, and cycles or nodes dependin...
ILPValue getILP(const SUnit *SU) const
Get the ILP value for a DAG node.
unsigned getDepth() const
getDepth - Return the depth of this node, which is the length of the maximum path up to any node whic...
unsigned getSubtreeID(const SUnit *SU) const
Get the ID of the subtree the given DAG node belongs to.
unsigned getNumInstrs(const SUnit *SU) const
Get the number of instructions in the given subtree and its children.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
SchedDFSResult(bool IsBU, unsigned lim)
void scheduleTree(unsigned SubtreeID)
Scheduler callback to update SubtreeConnectLevels when a tree is initially scheduled.
This class implements an extremely fast bulk output stream that can only output to a stream...
SUnit - Scheduling unit. This is a node in the scheduling DAG.