2006-01-25 17:14:32 +08:00
|
|
|
//===---- ScheduleDAGList.cpp - Implement a list scheduler for isel DAG ---===//
|
2006-01-23 16:26:10 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Evan Cheng and is distributed under the
|
|
|
|
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This implements a simple two pass scheduler. The first pass attempts to push
|
|
|
|
// backward any lengthy instructions and critical paths. The second pass packs
|
|
|
|
// instructions into semi-optimal time slots.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "sched"
|
|
|
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
|
|
|
#include "llvm/CodeGen/SelectionDAG.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2006-01-25 17:14:32 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2006-03-06 07:13:56 +08:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2006-01-25 17:14:32 +08:00
|
|
|
#include <climits>
|
|
|
|
#include <iostream>
|
2006-01-23 16:26:10 +08:00
|
|
|
#include <queue>
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
#include <set>
|
|
|
|
#include <vector>
|
2006-01-23 16:26:10 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
namespace {
|
2006-03-06 07:13:56 +08:00
|
|
|
Statistic<> NumNoops ("scheduler", "Number of noops inserted");
|
|
|
|
Statistic<> NumStalls("scheduler", "Number of pipeline stalls");
|
2006-01-23 16:26:10 +08:00
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
/// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or a
|
|
|
|
/// group of nodes flagged together.
|
|
|
|
struct SUnit {
|
|
|
|
SDNode *Node; // Representative node.
|
|
|
|
std::vector<SDNode*> FlaggedNodes; // All nodes flagged to Node.
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
std::set<SUnit*> Preds; // All real predecessors.
|
|
|
|
std::set<SUnit*> ChainPreds; // All chain predecessors.
|
|
|
|
std::set<SUnit*> Succs; // All real successors.
|
|
|
|
std::set<SUnit*> ChainSuccs; // All chain successors.
|
2006-01-25 17:14:32 +08:00
|
|
|
int NumPredsLeft; // # of preds not scheduled.
|
|
|
|
int NumSuccsLeft; // # of succs not scheduled.
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
int NumChainPredsLeft; // # of chain preds not scheduled.
|
|
|
|
int NumChainSuccsLeft; // # of chain succs not scheduled.
|
2006-03-06 14:08:54 +08:00
|
|
|
int SethiUllman; // Sethi Ullman number.
|
2006-03-03 14:23:43 +08:00
|
|
|
bool isTwoAddress; // Is a two-address instruction.
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
bool isDefNUseOperand; // Is a def&use operand.
|
2006-01-25 17:14:32 +08:00
|
|
|
unsigned Latency; // Node latency.
|
|
|
|
unsigned CycleBound; // Upper/lower cycle to be scheduled at.
|
|
|
|
unsigned Slot; // Cycle node is scheduled at.
|
2006-01-26 08:30:29 +08:00
|
|
|
SUnit *Next;
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
SUnit(SDNode *node)
|
|
|
|
: Node(node), NumPredsLeft(0), NumSuccsLeft(0),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
NumChainPredsLeft(0), NumChainSuccsLeft(0),
|
2006-03-06 14:08:54 +08:00
|
|
|
SethiUllman(INT_MIN),
|
2006-03-03 14:23:43 +08:00
|
|
|
isTwoAddress(false), isDefNUseOperand(false),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
Latency(0), CycleBound(0), Slot(0), Next(NULL) {}
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
void dump(const SelectionDAG *G, bool All=true) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
void SUnit::dump(const SelectionDAG *G, bool All) const {
|
2006-01-26 08:30:29 +08:00
|
|
|
std::cerr << "SU: ";
|
2006-01-25 17:14:32 +08:00
|
|
|
Node->dump(G);
|
|
|
|
std::cerr << "\n";
|
|
|
|
if (FlaggedNodes.size() != 0) {
|
|
|
|
for (unsigned i = 0, e = FlaggedNodes.size(); i != e; i++) {
|
2006-01-26 08:30:29 +08:00
|
|
|
std::cerr << " ";
|
2006-01-25 17:14:32 +08:00
|
|
|
FlaggedNodes[i]->dump(G);
|
|
|
|
std::cerr << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (All) {
|
2006-03-06 05:10:33 +08:00
|
|
|
std::cerr << " # preds left : " << NumPredsLeft << "\n";
|
|
|
|
std::cerr << " # succs left : " << NumSuccsLeft << "\n";
|
|
|
|
std::cerr << " # chain preds left : " << NumChainPredsLeft << "\n";
|
|
|
|
std::cerr << " # chain succs left : " << NumChainSuccsLeft << "\n";
|
|
|
|
std::cerr << " Latency : " << Latency << "\n";
|
2006-03-06 14:08:54 +08:00
|
|
|
std::cerr << " SethiUllman : " << SethiUllman << "\n";
|
2006-01-26 08:30:29 +08:00
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
if (Preds.size() != 0) {
|
2006-03-06 05:10:33 +08:00
|
|
|
std::cerr << " Predecessors:\n";
|
2006-03-03 11:25:07 +08:00
|
|
|
for (std::set<SUnit*>::const_iterator I = Preds.begin(),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
E = Preds.end(); I != E; ++I) {
|
2006-01-25 17:14:32 +08:00
|
|
|
std::cerr << " ";
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
(*I)->dump(G, false);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ChainPreds.size() != 0) {
|
2006-03-06 05:10:33 +08:00
|
|
|
std::cerr << " Chained Preds:\n";
|
2006-03-03 11:25:07 +08:00
|
|
|
for (std::set<SUnit*>::const_iterator I = ChainPreds.begin(),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
E = ChainPreds.end(); I != E; ++I) {
|
2006-01-25 17:14:32 +08:00
|
|
|
std::cerr << " ";
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
(*I)->dump(G, false);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Succs.size() != 0) {
|
2006-03-06 05:10:33 +08:00
|
|
|
std::cerr << " Successors:\n";
|
2006-03-03 11:25:07 +08:00
|
|
|
for (std::set<SUnit*>::const_iterator I = Succs.begin(),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
E = Succs.end(); I != E; ++I) {
|
2006-01-25 17:14:32 +08:00
|
|
|
std::cerr << " ";
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
(*I)->dump(G, false);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ChainSuccs.size() != 0) {
|
2006-03-06 05:10:33 +08:00
|
|
|
std::cerr << " Chained succs:\n";
|
2006-03-03 11:25:07 +08:00
|
|
|
for (std::set<SUnit*>::const_iterator I = ChainSuccs.begin(),
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
E = ChainSuccs.end(); I != E; ++I) {
|
2006-01-25 17:14:32 +08:00
|
|
|
std::cerr << " ";
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
(*I)->dump(G, false);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Sorting functions for the Available queue.
|
|
|
|
struct ls_rr_sort : public std::binary_function<SUnit*, SUnit*, bool> {
|
|
|
|
bool operator()(const SUnit* left, const SUnit* right) const {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
bool LFloater = (left ->Preds.size() == 0);
|
|
|
|
bool RFloater = (right->Preds.size() == 0);
|
|
|
|
int LBonus = (int)left ->isDefNUseOperand;
|
|
|
|
int RBonus = (int)right->isDefNUseOperand;
|
2006-03-03 14:23:43 +08:00
|
|
|
|
|
|
|
// Special tie breaker: if two nodes share a operand, the one that
|
|
|
|
// use it as a def&use operand is preferred.
|
|
|
|
if (left->isTwoAddress && !right->isTwoAddress) {
|
|
|
|
SDNode *DUNode = left->Node->getOperand(0).Val;
|
|
|
|
if (DUNode->isOperand(right->Node))
|
|
|
|
LBonus++;
|
|
|
|
}
|
|
|
|
if (!left->isTwoAddress && right->isTwoAddress) {
|
|
|
|
SDNode *DUNode = right->Node->getOperand(0).Val;
|
|
|
|
if (DUNode->isOperand(left->Node))
|
|
|
|
RBonus++;
|
|
|
|
}
|
|
|
|
|
2006-03-06 14:08:54 +08:00
|
|
|
// Priority1 is just the number of live range genned.
|
|
|
|
int LPriority1 = left ->NumPredsLeft - LBonus;
|
|
|
|
int RPriority1 = right->NumPredsLeft - RBonus;
|
|
|
|
int LPriority2 = left ->SethiUllman + LBonus;
|
|
|
|
int RPriority2 = right->SethiUllman + RBonus;
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
|
|
|
|
// Favor floaters (i.e. node with no non-passive predecessors):
|
|
|
|
// e.g. MOV32ri.
|
|
|
|
if (!LFloater && RFloater)
|
2006-01-25 17:14:32 +08:00
|
|
|
return true;
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
else if (LFloater == RFloater)
|
|
|
|
if (LPriority1 > RPriority1)
|
2006-01-25 17:14:32 +08:00
|
|
|
return true;
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
else if (LPriority1 == RPriority1)
|
|
|
|
if (LPriority2 < RPriority2)
|
2006-01-25 17:14:32 +08:00
|
|
|
return true;
|
2006-03-06 14:08:54 +08:00
|
|
|
else if (LPriority2 == RPriority2)
|
2006-01-25 17:14:32 +08:00
|
|
|
if (left->CycleBound > right->CycleBound)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
2006-01-23 16:26:10 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-03-06 06:45:01 +08:00
|
|
|
|
2006-01-23 16:26:10 +08:00
|
|
|
/// ScheduleDAGList - List scheduler.
|
|
|
|
class ScheduleDAGList : public ScheduleDAG {
|
|
|
|
private:
|
2006-01-25 17:14:32 +08:00
|
|
|
// SDNode to SUnit mapping (many to one).
|
|
|
|
std::map<SDNode*, SUnit*> SUnitMap;
|
2006-03-06 07:59:20 +08:00
|
|
|
// The schedule. Null SUnit*'s represent noop instructions.
|
2006-01-25 17:14:32 +08:00
|
|
|
std::vector<SUnit*> Sequence;
|
|
|
|
// Current scheduling cycle.
|
|
|
|
unsigned CurrCycle;
|
2006-01-26 08:30:29 +08:00
|
|
|
// First and last SUnit created.
|
|
|
|
SUnit *HeadSUnit, *TailSUnit;
|
2006-01-23 16:26:10 +08:00
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
/// isBottomUp - This is true if the scheduling problem is bottom-up, false if
|
|
|
|
/// it is top-down.
|
|
|
|
bool isBottomUp;
|
|
|
|
|
2006-03-06 06:45:01 +08:00
|
|
|
/// HazardRec - The hazard recognizer to use.
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRecognizer &HazardRec;
|
2006-03-06 06:45:01 +08:00
|
|
|
|
2006-03-06 04:21:55 +08:00
|
|
|
typedef std::priority_queue<SUnit*, std::vector<SUnit*>, ls_rr_sort>
|
|
|
|
AvailableQueueTy;
|
|
|
|
|
2006-01-23 16:26:10 +08:00
|
|
|
public:
|
|
|
|
ScheduleDAGList(SelectionDAG &dag, MachineBasicBlock *bb,
|
2006-03-06 06:45:01 +08:00
|
|
|
const TargetMachine &tm, bool isbottomup,
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRecognizer &HR)
|
2006-01-26 08:30:29 +08:00
|
|
|
: ScheduleDAG(listSchedulingBURR, dag, bb, tm),
|
2006-03-06 08:22:00 +08:00
|
|
|
CurrCycle(0), HeadSUnit(NULL), TailSUnit(NULL), isBottomUp(isbottomup),
|
|
|
|
HazardRec(HR) {
|
2006-03-06 06:45:01 +08:00
|
|
|
}
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
~ScheduleDAGList() {
|
2006-01-26 08:30:29 +08:00
|
|
|
SUnit *SU = HeadSUnit;
|
|
|
|
while (SU) {
|
|
|
|
SUnit *NextSU = SU->Next;
|
|
|
|
delete SU;
|
|
|
|
SU = NextSU;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
2006-01-23 16:26:10 +08:00
|
|
|
|
|
|
|
void Schedule();
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
void dump() const;
|
|
|
|
|
|
|
|
private:
|
2006-01-26 08:30:29 +08:00
|
|
|
SUnit *NewSUnit(SDNode *N);
|
2006-03-06 04:21:55 +08:00
|
|
|
void ReleasePred(AvailableQueueTy &Avail,SUnit *PredSU, bool isChain = false);
|
2006-03-06 05:10:33 +08:00
|
|
|
void ReleaseSucc(AvailableQueueTy &Avail,SUnit *SuccSU, bool isChain = false);
|
|
|
|
void ScheduleNodeBottomUp(AvailableQueueTy &Avail, SUnit *SU);
|
|
|
|
void ScheduleNodeTopDown(AvailableQueueTy &Avail, SUnit *SU);
|
2006-01-25 17:14:32 +08:00
|
|
|
int CalcNodePriority(SUnit *SU);
|
|
|
|
void CalculatePriorities();
|
2006-03-06 05:10:33 +08:00
|
|
|
void ListScheduleTopDown();
|
|
|
|
void ListScheduleBottomUp();
|
2006-01-25 17:14:32 +08:00
|
|
|
void BuildSchedUnits();
|
|
|
|
void EmitSchedule();
|
2006-01-23 16:26:10 +08:00
|
|
|
};
|
2006-01-25 17:14:32 +08:00
|
|
|
} // end namespace
|
|
|
|
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRecognizer::~HazardRecognizer() {}
|
|
|
|
|
2006-01-26 08:30:29 +08:00
|
|
|
|
|
|
|
/// NewSUnit - Creates a new SUnit and return a ptr to it.
|
|
|
|
SUnit *ScheduleDAGList::NewSUnit(SDNode *N) {
|
|
|
|
SUnit *CurrSUnit = new SUnit(N);
|
|
|
|
|
|
|
|
if (HeadSUnit == NULL)
|
|
|
|
HeadSUnit = CurrSUnit;
|
|
|
|
if (TailSUnit != NULL)
|
|
|
|
TailSUnit->Next = CurrSUnit;
|
|
|
|
TailSUnit = CurrSUnit;
|
|
|
|
|
|
|
|
return CurrSUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ReleasePred - Decrement the NumSuccsLeft count of a predecessor. Add it to
|
|
|
|
/// the Available queue is the count reaches zero. Also update its cycle bound.
|
2006-03-06 04:21:55 +08:00
|
|
|
void ScheduleDAGList::ReleasePred(AvailableQueueTy &Available,
|
|
|
|
SUnit *PredSU, bool isChain) {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
// FIXME: the distance between two nodes is not always == the predecessor's
|
|
|
|
// latency. For example, the reader can very well read the register written
|
|
|
|
// by the predecessor later than the issue cycle. It also depends on the
|
|
|
|
// interrupt model (drain vs. freeze).
|
|
|
|
PredSU->CycleBound = std::max(PredSU->CycleBound, CurrCycle + PredSU->Latency);
|
|
|
|
|
2006-03-06 14:08:54 +08:00
|
|
|
if (!isChain)
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
PredSU->NumSuccsLeft--;
|
2006-03-06 14:08:54 +08:00
|
|
|
else
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
PredSU->NumChainSuccsLeft--;
|
2006-03-06 05:10:33 +08:00
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
#ifndef NDEBUG
|
2006-03-06 05:10:33 +08:00
|
|
|
if (PredSU->NumSuccsLeft < 0 || PredSU->NumChainSuccsLeft < 0) {
|
2006-01-25 17:14:32 +08:00
|
|
|
std::cerr << "*** List scheduling failed! ***\n";
|
|
|
|
PredSU->dump(&DAG);
|
|
|
|
std::cerr << " has been released too many times!\n";
|
|
|
|
assert(0);
|
2006-03-06 05:10:33 +08:00
|
|
|
}
|
2006-01-25 17:14:32 +08:00
|
|
|
#endif
|
2006-03-06 05:10:33 +08:00
|
|
|
|
|
|
|
if ((PredSU->NumSuccsLeft + PredSU->NumChainSuccsLeft) == 0) {
|
|
|
|
// EntryToken has to go last! Special case it here.
|
|
|
|
if (PredSU->Node->getOpcode() != ISD::EntryToken)
|
|
|
|
Available.push(PredSU);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
|
|
|
|
/// the Available queue is the count reaches zero. Also update its cycle bound.
|
|
|
|
void ScheduleDAGList::ReleaseSucc(AvailableQueueTy &Available,
|
|
|
|
SUnit *SuccSU, bool isChain) {
|
|
|
|
// FIXME: the distance between two nodes is not always == the predecessor's
|
|
|
|
// latency. For example, the reader can very well read the register written
|
|
|
|
// by the predecessor later than the issue cycle. It also depends on the
|
|
|
|
// interrupt model (drain vs. freeze).
|
|
|
|
SuccSU->CycleBound = std::max(SuccSU->CycleBound, CurrCycle + SuccSU->Latency);
|
|
|
|
|
2006-03-06 14:08:54 +08:00
|
|
|
if (!isChain)
|
2006-03-06 05:10:33 +08:00
|
|
|
SuccSU->NumPredsLeft--;
|
2006-03-06 14:08:54 +08:00
|
|
|
else
|
2006-03-06 05:10:33 +08:00
|
|
|
SuccSU->NumChainPredsLeft--;
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
if (SuccSU->NumPredsLeft < 0 || SuccSU->NumChainPredsLeft < 0) {
|
|
|
|
std::cerr << "*** List scheduling failed! ***\n";
|
|
|
|
SuccSU->dump(&DAG);
|
|
|
|
std::cerr << " has been released too many times!\n";
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((SuccSU->NumPredsLeft + SuccSU->NumChainPredsLeft) == 0)
|
|
|
|
Available.push(SuccSU);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ScheduleNodeBottomUp - Add the node to the schedule. Decrement the pending
|
|
|
|
/// count of its predecessors. If a predecessor pending count is zero, add it to
|
|
|
|
/// the Available queue.
|
|
|
|
void ScheduleDAGList::ScheduleNodeBottomUp(AvailableQueueTy &Available,
|
|
|
|
SUnit *SU) {
|
2006-03-03 14:23:43 +08:00
|
|
|
DEBUG(std::cerr << "*** Scheduling: ");
|
|
|
|
DEBUG(SU->dump(&DAG, false));
|
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
Sequence.push_back(SU);
|
|
|
|
SU->Slot = CurrCycle;
|
|
|
|
|
|
|
|
// Bottom up: release predecessors
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
for (std::set<SUnit*>::iterator I1 = SU->Preds.begin(),
|
|
|
|
E1 = SU->Preds.end(); I1 != E1; ++I1) {
|
2006-03-06 04:21:55 +08:00
|
|
|
ReleasePred(Available, *I1);
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
SU->NumPredsLeft--;
|
|
|
|
}
|
|
|
|
for (std::set<SUnit*>::iterator I2 = SU->ChainPreds.begin(),
|
|
|
|
E2 = SU->ChainPreds.end(); I2 != E2; ++I2)
|
2006-03-06 04:21:55 +08:00
|
|
|
ReleasePred(Available, *I2, true);
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
CurrCycle++;
|
|
|
|
}
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
|
|
|
|
/// count of its successors. If a successor pending count is zero, add it to
|
|
|
|
/// the Available queue.
|
|
|
|
void ScheduleDAGList::ScheduleNodeTopDown(AvailableQueueTy &Available,
|
|
|
|
SUnit *SU) {
|
|
|
|
DEBUG(std::cerr << "*** Scheduling: ");
|
|
|
|
DEBUG(SU->dump(&DAG, false));
|
|
|
|
|
|
|
|
Sequence.push_back(SU);
|
|
|
|
SU->Slot = CurrCycle;
|
|
|
|
|
|
|
|
// Bottom up: release successors.
|
|
|
|
for (std::set<SUnit*>::iterator I1 = SU->Succs.begin(),
|
|
|
|
E1 = SU->Succs.end(); I1 != E1; ++I1) {
|
|
|
|
ReleaseSucc(Available, *I1);
|
|
|
|
SU->NumSuccsLeft--;
|
|
|
|
}
|
|
|
|
for (std::set<SUnit*>::iterator I2 = SU->ChainSuccs.begin(),
|
|
|
|
E2 = SU->ChainSuccs.end(); I2 != E2; ++I2)
|
|
|
|
ReleaseSucc(Available, *I2, true);
|
|
|
|
|
|
|
|
CurrCycle++;
|
|
|
|
}
|
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
/// isReady - True if node's lower cycle bound is less or equal to the current
|
|
|
|
/// scheduling cycle. Always true if all nodes have uniform latency 1.
|
|
|
|
static inline bool isReady(SUnit *SU, unsigned CurrCycle) {
|
|
|
|
return SU->CycleBound <= CurrCycle;
|
|
|
|
}
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
/// ListScheduleBottomUp - The main loop of list scheduling for bottom-up
|
|
|
|
/// schedulers.
|
|
|
|
void ScheduleDAGList::ListScheduleBottomUp() {
|
2006-03-06 04:21:55 +08:00
|
|
|
// Available queue.
|
|
|
|
AvailableQueueTy Available;
|
|
|
|
|
|
|
|
// Add root to Available queue.
|
2006-03-06 05:10:33 +08:00
|
|
|
Available.push(SUnitMap[DAG.getRoot().Val]);
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
// While Available queue is not empty, grab the node with the highest
|
|
|
|
// priority. If it is not ready put it back. Schedule the node.
|
|
|
|
std::vector<SUnit*> NotReady;
|
|
|
|
while (!Available.empty()) {
|
|
|
|
SUnit *CurrNode = Available.top();
|
|
|
|
Available.pop();
|
|
|
|
|
|
|
|
while (!isReady(CurrNode, CurrCycle)) {
|
|
|
|
NotReady.push_back(CurrNode);
|
|
|
|
CurrNode = Available.top();
|
|
|
|
Available.pop();
|
|
|
|
}
|
2006-03-06 05:10:33 +08:00
|
|
|
|
|
|
|
// Add the nodes that aren't ready back onto the available list.
|
|
|
|
while (!NotReady.empty()) {
|
|
|
|
Available.push(NotReady.back());
|
|
|
|
NotReady.pop_back();
|
|
|
|
}
|
2006-01-25 17:14:32 +08:00
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
ScheduleNodeBottomUp(Available, CurrNode);
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add entry node last
|
|
|
|
if (DAG.getEntryNode().Val != DAG.getRoot().Val) {
|
|
|
|
SUnit *Entry = SUnitMap[DAG.getEntryNode().Val];
|
|
|
|
Entry->Slot = CurrCycle;
|
|
|
|
Sequence.push_back(Entry);
|
|
|
|
}
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
// Reverse the order if it is bottom up.
|
|
|
|
std::reverse(Sequence.begin(), Sequence.end());
|
|
|
|
|
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
#ifndef NDEBUG
|
2006-03-06 05:10:33 +08:00
|
|
|
// Verify that all SUnits were scheduled.
|
2006-01-26 08:30:29 +08:00
|
|
|
bool AnyNotSched = false;
|
|
|
|
for (SUnit *SU = HeadSUnit; SU != NULL; SU = SU->Next) {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
if (SU->NumSuccsLeft != 0 || SU->NumChainSuccsLeft != 0) {
|
2006-01-26 08:30:29 +08:00
|
|
|
if (!AnyNotSched)
|
|
|
|
std::cerr << "*** List scheduling failed! ***\n";
|
2006-01-25 17:14:32 +08:00
|
|
|
SU->dump(&DAG);
|
2006-01-26 08:30:29 +08:00
|
|
|
std::cerr << "has not been scheduled!\n";
|
|
|
|
AnyNotSched = true;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
2006-01-26 08:30:29 +08:00
|
|
|
assert(!AnyNotSched);
|
2006-01-26 05:49:13 +08:00
|
|
|
#endif
|
2006-03-06 05:10:33 +08:00
|
|
|
}
|
2006-01-25 17:14:32 +08:00
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
/// ListScheduleTopDown - The main loop of list scheduling for top-down
|
|
|
|
/// schedulers.
|
|
|
|
void ScheduleDAGList::ListScheduleTopDown() {
|
|
|
|
// Available queue.
|
|
|
|
AvailableQueueTy Available;
|
2006-03-06 08:22:00 +08:00
|
|
|
|
|
|
|
HazardRec.StartBasicBlock();
|
2006-03-06 05:10:33 +08:00
|
|
|
|
|
|
|
// Emit the entry node first.
|
|
|
|
SUnit *Entry = SUnitMap[DAG.getEntryNode().Val];
|
|
|
|
ScheduleNodeTopDown(Available, Entry);
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRec.EmitInstruction(Entry->Node);
|
2006-03-06 06:45:01 +08:00
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
// All leaves to Available queue.
|
|
|
|
for (SUnit *SU = HeadSUnit; SU != NULL; SU = SU->Next) {
|
|
|
|
// It is available if it has no predecessors.
|
|
|
|
if ((SU->Preds.size() + SU->ChainPreds.size()) == 0 && SU != Entry)
|
|
|
|
Available.push(SU);
|
|
|
|
}
|
|
|
|
|
|
|
|
// While Available queue is not empty, grab the node with the highest
|
|
|
|
// priority. If it is not ready put it back. Schedule the node.
|
|
|
|
std::vector<SUnit*> NotReady;
|
|
|
|
while (!Available.empty()) {
|
2006-03-06 06:45:01 +08:00
|
|
|
SUnit *FoundNode = 0;
|
2006-01-25 17:14:32 +08:00
|
|
|
|
2006-03-06 06:45:01 +08:00
|
|
|
bool HasNoopHazards = false;
|
|
|
|
do {
|
|
|
|
SUnit *CurrNode = Available.top();
|
|
|
|
Available.pop();
|
|
|
|
HazardRecognizer::HazardType HT =
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRec.getHazardType(CurrNode->Node);
|
2006-03-06 06:45:01 +08:00
|
|
|
if (HT == HazardRecognizer::NoHazard) {
|
|
|
|
FoundNode = CurrNode;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remember if this is a noop hazard.
|
|
|
|
HasNoopHazards |= HT == HazardRecognizer::NoopHazard;
|
|
|
|
|
|
|
|
NotReady.push_back(CurrNode);
|
|
|
|
} while (!Available.empty());
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
// Add the nodes that aren't ready back onto the available list.
|
|
|
|
while (!NotReady.empty()) {
|
|
|
|
Available.push(NotReady.back());
|
|
|
|
NotReady.pop_back();
|
|
|
|
}
|
2006-03-06 06:45:01 +08:00
|
|
|
|
|
|
|
// If we found a node to schedule, do it now.
|
|
|
|
if (FoundNode) {
|
|
|
|
ScheduleNodeTopDown(Available, FoundNode);
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRec.EmitInstruction(FoundNode->Node);
|
2006-03-06 06:45:01 +08:00
|
|
|
} else if (!HasNoopHazards) {
|
|
|
|
// Otherwise, we have a pipeline stall, but no other problem, just advance
|
|
|
|
// the current cycle and try again.
|
2006-03-06 07:13:56 +08:00
|
|
|
DEBUG(std::cerr << "*** Advancing cycle, no work to do");
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRec.AdvanceCycle();
|
2006-03-06 07:13:56 +08:00
|
|
|
++NumStalls;
|
2006-03-06 06:45:01 +08:00
|
|
|
} else {
|
|
|
|
// Otherwise, we have no instructions to issue and we have instructions
|
|
|
|
// that will fault if we don't do this right. This is the case for
|
|
|
|
// processors without pipeline interlocks and other cases.
|
2006-03-06 07:13:56 +08:00
|
|
|
DEBUG(std::cerr << "*** Emitting noop");
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRec.EmitNoop();
|
2006-03-06 07:59:20 +08:00
|
|
|
Sequence.push_back(0); // NULL SUnit* -> noop
|
2006-03-06 07:13:56 +08:00
|
|
|
++NumNoops;
|
2006-03-06 06:45:01 +08:00
|
|
|
}
|
2006-03-06 05:10:33 +08:00
|
|
|
}
|
2006-01-23 16:26:10 +08:00
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
// Verify that all SUnits were scheduled.
|
|
|
|
bool AnyNotSched = false;
|
|
|
|
for (SUnit *SU = HeadSUnit; SU != NULL; SU = SU->Next) {
|
|
|
|
if (SU->NumPredsLeft != 0 || SU->NumChainPredsLeft != 0) {
|
|
|
|
if (!AnyNotSched)
|
|
|
|
std::cerr << "*** List scheduling failed! ***\n";
|
|
|
|
SU->dump(&DAG);
|
|
|
|
std::cerr << "has not been scheduled!\n";
|
|
|
|
AnyNotSched = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert(!AnyNotSched);
|
|
|
|
#endif
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
|
2006-03-06 14:08:54 +08:00
|
|
|
/// CalcNodePriority - Priority is the Sethi Ullman number.
|
|
|
|
/// Smaller number is the higher priority.
|
2006-01-25 17:14:32 +08:00
|
|
|
int ScheduleDAGList::CalcNodePriority(SUnit *SU) {
|
2006-03-06 14:08:54 +08:00
|
|
|
if (SU->SethiUllman != INT_MIN)
|
|
|
|
return SU->SethiUllman;
|
2006-01-25 17:14:32 +08:00
|
|
|
|
|
|
|
if (SU->Preds.size() == 0) {
|
2006-03-06 14:08:54 +08:00
|
|
|
SU->SethiUllman = 1;
|
2006-01-25 17:14:32 +08:00
|
|
|
} else {
|
|
|
|
int Extra = 0;
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
for (std::set<SUnit*>::iterator I = SU->Preds.begin(),
|
|
|
|
E = SU->Preds.end(); I != E; ++I) {
|
|
|
|
SUnit *PredSU = *I;
|
2006-03-06 14:08:54 +08:00
|
|
|
int PredSethiUllman = CalcNodePriority(PredSU);
|
|
|
|
if (PredSethiUllman > SU->SethiUllman) {
|
|
|
|
SU->SethiUllman = PredSethiUllman;
|
2006-01-25 17:14:32 +08:00
|
|
|
Extra = 0;
|
2006-03-06 14:08:54 +08:00
|
|
|
} else if (PredSethiUllman == SU->SethiUllman)
|
2006-01-25 17:14:32 +08:00
|
|
|
Extra++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SU->Node->getOpcode() != ISD::TokenFactor)
|
2006-03-06 14:08:54 +08:00
|
|
|
SU->SethiUllman += Extra;
|
2006-01-25 17:14:32 +08:00
|
|
|
else
|
2006-03-06 14:08:54 +08:00
|
|
|
SU->SethiUllman = (Extra == 1) ? 0 : Extra-1;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
|
2006-03-06 14:08:54 +08:00
|
|
|
return SU->SethiUllman;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// CalculatePriorities - Calculate priorities of all scheduling units.
|
|
|
|
void ScheduleDAGList::CalculatePriorities() {
|
2006-01-26 08:30:29 +08:00
|
|
|
for (SUnit *SU = HeadSUnit; SU != NULL; SU = SU->Next) {
|
2006-01-25 17:14:32 +08:00
|
|
|
// FIXME: assumes uniform latency for now.
|
|
|
|
SU->Latency = 1;
|
|
|
|
(void)CalcNodePriority(SU);
|
2006-01-26 08:30:29 +08:00
|
|
|
DEBUG(SU->dump(&DAG));
|
2006-01-25 17:14:32 +08:00
|
|
|
DEBUG(std::cerr << "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScheduleDAGList::BuildSchedUnits() {
|
2006-01-26 08:30:29 +08:00
|
|
|
// Pass 1: create the SUnit's.
|
2006-01-26 01:17:49 +08:00
|
|
|
for (unsigned i = 0, NC = NodeCount; i < NC; i++) {
|
2006-01-25 17:14:32 +08:00
|
|
|
NodeInfo *NI = &Info[i];
|
|
|
|
SDNode *N = NI->Node;
|
2006-01-26 08:30:29 +08:00
|
|
|
if (isPassiveNode(N))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
SUnit *SU;
|
|
|
|
if (NI->isInGroup()) {
|
|
|
|
if (NI != NI->Group->getBottom()) // Bottom up, so only look at bottom
|
|
|
|
continue; // node of the NodeGroup
|
|
|
|
|
|
|
|
SU = NewSUnit(N);
|
|
|
|
// Find the flagged nodes.
|
|
|
|
SDOperand FlagOp = N->getOperand(N->getNumOperands() - 1);
|
|
|
|
SDNode *Flag = FlagOp.Val;
|
|
|
|
unsigned ResNo = FlagOp.ResNo;
|
|
|
|
while (Flag->getValueType(ResNo) == MVT::Flag) {
|
|
|
|
NodeInfo *FNI = getNI(Flag);
|
|
|
|
assert(FNI->Group == NI->Group);
|
|
|
|
SU->FlaggedNodes.insert(SU->FlaggedNodes.begin(), Flag);
|
|
|
|
SUnitMap[Flag] = SU;
|
|
|
|
|
|
|
|
FlagOp = Flag->getOperand(Flag->getNumOperands() - 1);
|
|
|
|
Flag = FlagOp.Val;
|
|
|
|
ResNo = FlagOp.ResNo;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
SU = NewSUnit(N);
|
|
|
|
}
|
|
|
|
SUnitMap[N] = SU;
|
|
|
|
}
|
2006-01-25 17:14:32 +08:00
|
|
|
|
2006-01-26 08:30:29 +08:00
|
|
|
// Pass 2: add the preds, succs, etc.
|
|
|
|
for (SUnit *SU = HeadSUnit; SU != NULL; SU = SU->Next) {
|
|
|
|
SDNode *N = SU->Node;
|
|
|
|
NodeInfo *NI = getNI(N);
|
2006-03-03 14:23:43 +08:00
|
|
|
|
|
|
|
if (N->isTargetOpcode() && TII->isTwoAddrInstr(N->getTargetOpcode()))
|
|
|
|
SU->isTwoAddress = true;
|
2006-01-26 08:30:29 +08:00
|
|
|
|
|
|
|
if (NI->isInGroup()) {
|
|
|
|
// Find all predecessors (of the group).
|
|
|
|
NodeGroupOpIterator NGOI(NI);
|
|
|
|
while (!NGOI.isEnd()) {
|
|
|
|
SDOperand Op = NGOI.next();
|
|
|
|
SDNode *OpN = Op.Val;
|
|
|
|
MVT::ValueType VT = OpN->getValueType(Op.ResNo);
|
|
|
|
NodeInfo *OpNI = getNI(OpN);
|
|
|
|
if (OpNI->Group != NI->Group && !isPassiveNode(OpN)) {
|
|
|
|
assert(VT != MVT::Flag);
|
|
|
|
SUnit *OpSU = SUnitMap[OpN];
|
|
|
|
if (VT == MVT::Other) {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
if (SU->ChainPreds.insert(OpSU).second)
|
|
|
|
SU->NumChainPredsLeft++;
|
|
|
|
if (OpSU->ChainSuccs.insert(SU).second)
|
|
|
|
OpSU->NumChainSuccsLeft++;
|
2006-01-26 08:30:29 +08:00
|
|
|
} else {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
if (SU->Preds.insert(OpSU).second)
|
|
|
|
SU->NumPredsLeft++;
|
|
|
|
if (OpSU->Succs.insert(SU).second)
|
|
|
|
OpSU->NumSuccsLeft++;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
2006-01-26 08:30:29 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Find node predecessors.
|
|
|
|
for (unsigned j = 0, e = N->getNumOperands(); j != e; j++) {
|
|
|
|
SDOperand Op = N->getOperand(j);
|
|
|
|
SDNode *OpN = Op.Val;
|
|
|
|
MVT::ValueType VT = OpN->getValueType(Op.ResNo);
|
|
|
|
if (!isPassiveNode(OpN)) {
|
|
|
|
assert(VT != MVT::Flag);
|
|
|
|
SUnit *OpSU = SUnitMap[OpN];
|
|
|
|
if (VT == MVT::Other) {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
if (SU->ChainPreds.insert(OpSU).second)
|
|
|
|
SU->NumChainPredsLeft++;
|
|
|
|
if (OpSU->ChainSuccs.insert(SU).second)
|
|
|
|
OpSU->NumChainSuccsLeft++;
|
2006-01-26 08:30:29 +08:00
|
|
|
} else {
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
if (SU->Preds.insert(OpSU).second)
|
|
|
|
SU->NumPredsLeft++;
|
|
|
|
if (OpSU->Succs.insert(SU).second)
|
|
|
|
OpSU->NumSuccsLeft++;
|
2006-03-03 14:23:43 +08:00
|
|
|
if (j == 0 && SU->isTwoAddress)
|
- Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
multiple predecessor; priority1 should be updated during scheduling;
CycleBound was updated after the node is inserted into priority queue; one
of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
.text
.align 4
.globl _f
_f:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %eax, %eax
imull %ecx, %ecx
addl %eax, %ecx
leal (%ecx,%edx,2), %eax
ret
It is also a slight performance win (1% - 3%) for most tests.
llvm-svn: 26470
2006-03-03 05:38:29 +08:00
|
|
|
OpSU->isDefNUseOperand = true;
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// EmitSchedule - Emit the machine code in scheduled order.
|
|
|
|
void ScheduleDAGList::EmitSchedule() {
|
|
|
|
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
|
2006-03-06 07:51:47 +08:00
|
|
|
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();
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// dump - dump the schedule.
|
|
|
|
void ScheduleDAGList::dump() const {
|
|
|
|
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
|
2006-03-06 07:51:47 +08:00
|
|
|
if (SUnit *SU = Sequence[i])
|
|
|
|
SU->dump(&DAG, false);
|
|
|
|
else
|
|
|
|
std::cerr << "**** NOOP ****\n";
|
2006-01-25 17:14:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Schedule - Schedule the DAG using list scheduling.
|
|
|
|
/// FIXME: Right now it only supports the burr (bottom up register reducing)
|
|
|
|
/// heuristic.
|
2006-01-23 16:26:10 +08:00
|
|
|
void ScheduleDAGList::Schedule() {
|
2006-01-25 17:14:32 +08:00
|
|
|
DEBUG(std::cerr << "********** List Scheduling **********\n");
|
|
|
|
|
|
|
|
// Build scheduling units.
|
|
|
|
BuildSchedUnits();
|
|
|
|
|
2006-03-06 08:22:00 +08:00
|
|
|
// Calculate node priorities.
|
2006-01-25 17:14:32 +08:00
|
|
|
CalculatePriorities();
|
|
|
|
|
2006-03-06 05:10:33 +08:00
|
|
|
// Execute the actual scheduling loop Top-Down or Bottom-Up as appropriate.
|
|
|
|
if (isBottomUp)
|
|
|
|
ListScheduleBottomUp();
|
|
|
|
else
|
|
|
|
ListScheduleTopDown();
|
|
|
|
|
|
|
|
DEBUG(std::cerr << "*** Final schedule ***\n");
|
|
|
|
DEBUG(dump());
|
|
|
|
DEBUG(std::cerr << "\n");
|
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
// Emit in scheduled order
|
|
|
|
EmitSchedule();
|
2006-01-23 16:26:10 +08:00
|
|
|
}
|
2006-03-06 05:10:33 +08:00
|
|
|
|
2006-01-25 17:14:32 +08:00
|
|
|
llvm::ScheduleDAG* llvm::createBURRListDAGScheduler(SelectionDAG &DAG,
|
|
|
|
MachineBasicBlock *BB) {
|
2006-03-06 08:22:00 +08:00
|
|
|
HazardRecognizer HR;
|
|
|
|
return new ScheduleDAGList(DAG, BB, DAG.getTarget(), true, HR);
|
2006-03-06 05:10:33 +08:00
|
|
|
}
|
|
|
|
|
2006-03-06 08:22:00 +08:00
|
|
|
/// createTDListDAGScheduler - This creates a top-down list scheduler with the
|
|
|
|
/// specified hazard recognizer.
|
|
|
|
ScheduleDAG* llvm::createTDListDAGScheduler(SelectionDAG &DAG,
|
|
|
|
MachineBasicBlock *BB,
|
|
|
|
HazardRecognizer &HR) {
|
|
|
|
return new ScheduleDAGList(DAG, BB, DAG.getTarget(), false, HR);
|
2006-01-23 16:26:10 +08:00
|
|
|
}
|