aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-05 23:51:47 +0000
committerChris Lattner <sabre@nondot.org>2006-03-05 23:51:47 +0000
commita93dfcd40a0750455d093903a9b65627c4e58a8e (patch)
treed87de91a308ac6ef5fd3fbe8b7a42d9e709845f6
parent202bc85a9508de5b5f24cfbac060e17ea2f5f8dc (diff)
downloadexternal_llvm-a93dfcd40a0750455d093903a9b65627c4e58a8e.zip
external_llvm-a93dfcd40a0750455d093903a9b65627c4e58a8e.tar.gz
external_llvm-a93dfcd40a0750455d093903a9b65627c4e58a8e.tar.bz2
When a hazard recognizer needs noops to be inserted, do so. This represents
noops as null pointers in the instruction sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26564 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAG.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp25
2 files changed, 19 insertions, 10 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 611abc3..c9455a0 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -370,6 +370,10 @@ void ScheduleDAG::EmitNode(NodeInfo *NI) {
NI->VRBase = VRBase;
}
+void ScheduleDAG::EmitNoop() {
+ TII->insertNoop(*BB, BB->end());
+}
+
/// EmitAll - Emit all nodes in schedule sorted order.
///
void ScheduleDAG::EmitAll() {
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
index 19516dd..34ac7de 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
@@ -214,7 +214,7 @@ class ScheduleDAGList : public ScheduleDAG {
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 @@ void ScheduleDAGList::ListScheduleTopDown() {
// 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 @@ void ScheduleDAGList::BuildSchedUnits() {
/// 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";
}
}