///
void Run();
- /// BuildSchedUnits - Build SUnits and set up their Preds and Succs
+ /// BuildSchedGraph - Build SUnits and set up their Preds and Succs
/// to form the scheduling dependency graph.
///
- virtual void BuildSchedUnits() = 0;
+ virtual void BuildSchedGraph() = 0;
/// ComputeLatency - Compute node latency.
///
return &SUnits.back();
}
- /// BuildSchedUnits - Build SUnits from the MachineBasicBlock that we are
+ /// BuildSchedGraph - Build SUnits from the MachineBasicBlock that we are
/// input.
- virtual void BuildSchedUnits();
+ virtual void BuildSchedGraph();
/// ComputeLatency - Compute node latency.
///
virtual SelectionDAG *getDAG() { return DAG; }
- /// BuildSchedUnits - Build SUnits from the selection dag that we are input.
- /// This SUnit graph is similar to the SelectionDAG, but represents flagged
- /// together nodes with a single SUnit.
- virtual void BuildSchedUnits();
+ /// BuildSchedGraph - Build the SUnit graph from the selection dag that we
+ /// are input. This SUnit graph is similar to the SelectionDAG, but
+ /// excludes nodes that aren't interesting to scheduling, and represents
+ /// flagged together nodes with a single SUnit.
+ virtual void BuildSchedGraph();
/// ComputeLatency - Compute node latency.
///
void CreateVirtualRegisters(SDNode *Node, MachineInstr *MI,
const TargetInstrDesc &II,
DenseMap<SDValue, unsigned> &VRBaseMap);
+
+ /// BuildSchedUnits, AddSchedEdges - Helper functions for BuildSchedGraph.
+ void BuildSchedUnits();
+ void AddSchedEdges();
};
}
void SchedulePostRATDList::Schedule() {
DOUT << "********** List Scheduling **********\n";
- // Build scheduling units.
- BuildSchedUnits();
+ // Build the scheduling graph.
+ BuildSchedGraph();
if (EnableAntiDepBreaking) {
if (BreakAntiDependencies()) {
// that register, and add new anti-dependence and output-dependence
// edges based on the next live range of the register.
SUnits.clear();
- BuildSchedUnits();
+ BuildSchedGraph();
}
}
const MachineDominatorTree &mdt)
: ScheduleDAG(0, bb, tm), MLI(mli), MDT(mdt) {}
-void ScheduleDAGInstrs::BuildSchedUnits() {
+void ScheduleDAGInstrs::BuildSchedGraph() {
SUnits.clear();
SUnits.reserve(BB->size());
LiveRegDefs.resize(TRI->getNumRegs(), NULL);
LiveRegCycles.resize(TRI->getNumRegs(), 0);
- // Build scheduling units.
- BuildSchedUnits();
+ // Build the scheduling graph.
+ BuildSchedGraph();
DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
SUnits[su].dumpAll(this));
void ScheduleDAGList::Schedule() {
DOUT << "********** List Scheduling **********\n";
- // Build scheduling units.
- BuildSchedUnits();
+ // Build the scheduling graph.
+ BuildSchedGraph();
AvailableQueue->initNodes(SUnits);
LiveRegDefs.resize(TRI->getNumRegs(), NULL);
LiveRegCycles.resize(TRI->getNumRegs(), 0);
- // Build scheduling units.
- BuildSchedUnits();
+ // Build the scheduling graph.
+ BuildSchedGraph();
DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
SUnits[su].dumpAll(this));
}
}
-/// BuildSchedUnits - Build SUnits from the selection dag that we are input.
-/// This SUnit graph is similar to the SelectionDAG, but represents flagged
-/// together nodes with a single SUnit.
void ScheduleDAGSDNodes::BuildSchedUnits() {
// During scheduling, the NodeId field of SDNode is used to map SDNodes
// to their associated SUnits by holding SUnits table indices. A value
else
ComputeLatency(NodeSUnit);
}
-
+}
+
+void ScheduleDAGSDNodes::AddSchedEdges() {
// Pass 2: add the preds, succs, etc.
for (unsigned su = 0, e = SUnits.size(); su != e; ++su) {
SUnit *SU = &SUnits[su];
}
}
+/// BuildSchedGraph - Build the SUnit graph from the selection dag that we
+/// are input. This SUnit graph is similar to the SelectionDAG, but
+/// excludes nodes that aren't interesting to scheduling, and represents
+/// flagged together nodes with a single SUnit.
+void ScheduleDAGSDNodes::BuildSchedGraph() {
+ // Populate the SUnits array.
+ BuildSchedUnits();
+ // Compute all the scheduling dependencies between nodes.
+ AddSchedEdges();
+}
+
void ScheduleDAGSDNodes::ComputeLatency(SUnit *SU) {
const InstrItineraryData &InstrItins = TM.getInstrItineraryData();