Add a flag to SDep for tracking which edges are anti-dependence edges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59785 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2008-11-21 02:27:52 +00:00
parent e1a6d160e5
commit cddd428459
3 changed files with 18 additions and 14 deletions

View File

@@ -48,8 +48,10 @@ namespace llvm {
bool isArtificial : 1; // True iff it's an artificial ctrl dep added bool isArtificial : 1; // True iff it's an artificial ctrl dep added
// during sched that may be safely deleted if // during sched that may be safely deleted if
// necessary. // necessary.
SDep(SUnit *d, unsigned r, int t, bool c, bool a) bool isAntiDep : 1; // True iff it's an anti-dependency (on a physical
: Dep(d), Reg(r), Cost(t), isCtrl(c), isArtificial(a) {} // register.
SDep(SUnit *d, unsigned r, int t, bool c, bool a, bool anti)
: Dep(d), Reg(r), Cost(t), isCtrl(c), isArtificial(a), isAntiDep(anti) {}
}; };
/// SUnit - Scheduling unit. This is a node in the scheduling DAG. /// SUnit - Scheduling unit. This is a node in the scheduling DAG.
@@ -140,15 +142,17 @@ namespace llvm {
} }
/// addPred - This adds the specified node as a pred of the current node if /// addPred - This adds the specified node as a pred of the current node if
/// not already. This returns true if this is a new pred. /// not already. It also adds the current node as a successor of the
/// specified node. This returns true if this is a new pred.
bool addPred(SUnit *N, bool isCtrl, bool isArtificial, bool addPred(SUnit *N, bool isCtrl, bool isArtificial,
unsigned PhyReg = 0, int Cost = 1) { unsigned PhyReg = 0, int Cost = 1, bool isAntiDep = false) {
for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i) for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
if (Preds[i].Dep == N && if (Preds[i].Dep == N &&
Preds[i].isCtrl == isCtrl && Preds[i].isArtificial == isArtificial) Preds[i].isCtrl == isCtrl && Preds[i].isArtificial == isArtificial)
return false; return false;
Preds.push_back(SDep(N, PhyReg, Cost, isCtrl, isArtificial)); Preds.push_back(SDep(N, PhyReg, Cost, isCtrl, isArtificial, isAntiDep));
N->Succs.push_back(SDep(this, PhyReg, Cost, isCtrl, isArtificial)); N->Succs.push_back(SDep(this, PhyReg, Cost, isCtrl,
isArtificial, isAntiDep));
if (!isCtrl) { if (!isCtrl) {
++NumPreds; ++NumPreds;
++N->NumSuccs; ++N->NumSuccs;

View File

@@ -287,18 +287,18 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
if (I->isCtrl) if (I->isCtrl)
ChainPred = I->Dep; ChainPred = I->Dep;
else if (I->Dep->getNode() && I->Dep->getNode()->isOperandOf(LoadNode)) else if (I->Dep->getNode() && I->Dep->getNode()->isOperandOf(LoadNode))
LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false)); LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false, false));
else else
NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false)); NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false, false));
} }
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) { I != E; ++I) {
if (I->isCtrl) if (I->isCtrl)
ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost, ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
I->isCtrl, I->isArtificial)); I->isCtrl, I->isArtificial, I->isAntiDep));
else else
NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost, NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
I->isCtrl, I->isArtificial)); I->isCtrl, I->isArtificial, I->isAntiDep));
} }
if (ChainPred) { if (ChainPred) {

View File

@@ -688,18 +688,18 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
if (I->isCtrl) if (I->isCtrl)
ChainPred = I->Dep; ChainPred = I->Dep;
else if (I->Dep->getNode() && I->Dep->getNode()->isOperandOf(LoadNode)) else if (I->Dep->getNode() && I->Dep->getNode()->isOperandOf(LoadNode))
LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false)); LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false, false));
else else
NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false)); NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false, false));
} }
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) { I != E; ++I) {
if (I->isCtrl) if (I->isCtrl)
ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost, ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
I->isCtrl, I->isArtificial)); I->isCtrl, I->isArtificial, I->isAntiDep));
else else
NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost, NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
I->isCtrl, I->isArtificial)); I->isCtrl, I->isArtificial, I->isAntiDep));
} }
if (ChainPred) { if (ChainPred) {