[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp ScheduleDAGList.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Mar 5 15:51:59 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
ScheduleDAG.cpp updated: 1.71 -> 1.72
ScheduleDAGList.cpp updated: 1.13 -> 1.14
---
Log message:
When a hazard recognizer needs noops to be inserted, do so. This represents
noops as null pointers in the instruction sequence.
---
Diffs of the changes: (+19 -10)
ScheduleDAG.cpp | 4 ++++
ScheduleDAGList.cpp | 25 +++++++++++++++----------
2 files changed, 19 insertions(+), 10 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.71 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.72
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.71 Sat Feb 25 03:53:49 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Sun Mar 5 17:51:47 2006
@@ -370,6 +370,10 @@
NI->VRBase = VRBase;
}
+void ScheduleDAG::EmitNoop() {
+ TII->insertNoop(*BB, BB->end());
+}
+
/// EmitAll - Emit all nodes in schedule sorted order.
///
void ScheduleDAG::EmitAll() {
Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.13 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.14
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.13 Sun Mar 5 17:13:56 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Sun Mar 5 17:51:47 2006
@@ -214,7 +214,7 @@
private:
// SDNode to SUnit mapping (many to one).
std::map<SDNode*, SUnit*> SUnitMap;
- // The schedule.
+ // The schedule. Null SUnit*'s represend noop instructions.
std::vector<SUnit*> Sequence;
// Current scheduling cycle.
unsigned CurrCycle;
@@ -523,7 +523,7 @@
// processors without pipeline interlocks and other cases.
DEBUG(std::cerr << "*** Emitting noop");
HazardRec->EmitNoop();
- // FIXME: Add a noop to the schedule!!
+ Sequence.push_back(0); // NULL SUnit -> noop
++NumNoops;
}
}
@@ -688,21 +688,26 @@
/// EmitSchedule - Emit the machine code in scheduled order.
void ScheduleDAGList::EmitSchedule() {
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
- SDNode *N;
- SUnit *SU = Sequence[i];
- for (unsigned j = 0, ee = SU->FlaggedNodes.size(); j != ee; j++) {
- N = SU->FlaggedNodes[j];
- EmitNode(getNI(N));
+ if (SUnit *SU = Sequence[i]) {
+ for (unsigned j = 0, ee = SU->FlaggedNodes.size(); j != ee; j++) {
+ SDNode *N = SU->FlaggedNodes[j];
+ EmitNode(getNI(N));
+ }
+ EmitNode(getNI(SU->Node));
+ } else {
+ // Null SUnit* is a noop.
+ EmitNoop();
}
- EmitNode(getNI(SU->Node));
}
}
/// dump - dump the schedule.
void ScheduleDAGList::dump() const {
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
- SUnit *SU = Sequence[i];
- SU->dump(&DAG, false);
+ if (SUnit *SU = Sequence[i])
+ SU->dump(&DAG, false);
+ else
+ std::cerr << "**** NOOP ****\n";
}
}
More information about the llvm-commits
mailing list