mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Rename SDep's isSpecial to isArtificial, to make this field a little
less mysterious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59782 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52a5899fd9
commit
98adea1149
@ -42,12 +42,14 @@ namespace llvm {
|
||||
/// cost of the depdenency, etc.
|
||||
struct SDep {
|
||||
SUnit *Dep; // Dependent - either a predecessor or a successor.
|
||||
unsigned Reg; // If non-zero, this dep is a phy register dependency.
|
||||
unsigned Reg; // If non-zero, this dep is a physreg dependency.
|
||||
int Cost; // Cost of the dependency.
|
||||
bool isCtrl : 1; // True iff it's a control dependency.
|
||||
bool isSpecial : 1; // True iff it's a special ctrl dep added during sched.
|
||||
SDep(SUnit *d, unsigned r, int t, bool c, bool s)
|
||||
: Dep(d), Reg(r), Cost(t), isCtrl(c), isSpecial(s) {}
|
||||
bool isArtificial : 1; // True iff it's an artificial ctrl dep added
|
||||
// during sched that may be safely deleted if
|
||||
// necessary.
|
||||
SDep(SUnit *d, unsigned r, int t, bool c, bool a)
|
||||
: Dep(d), Reg(r), Cost(t), isCtrl(c), isArtificial(a) {}
|
||||
};
|
||||
|
||||
/// SUnit - Scheduling unit. This is a node in the scheduling DAG.
|
||||
@ -139,14 +141,14 @@ namespace llvm {
|
||||
|
||||
/// 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.
|
||||
bool addPred(SUnit *N, bool isCtrl, bool isSpecial,
|
||||
bool addPred(SUnit *N, bool isCtrl, bool isArtificial,
|
||||
unsigned PhyReg = 0, int Cost = 1) {
|
||||
for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
|
||||
if (Preds[i].Dep == N &&
|
||||
Preds[i].isCtrl == isCtrl && Preds[i].isSpecial == isSpecial)
|
||||
Preds[i].isCtrl == isCtrl && Preds[i].isArtificial == isArtificial)
|
||||
return false;
|
||||
Preds.push_back(SDep(N, PhyReg, Cost, isCtrl, isSpecial));
|
||||
N->Succs.push_back(SDep(this, PhyReg, Cost, isCtrl, isSpecial));
|
||||
Preds.push_back(SDep(N, PhyReg, Cost, isCtrl, isArtificial));
|
||||
N->Succs.push_back(SDep(this, PhyReg, Cost, isCtrl, isArtificial));
|
||||
if (!isCtrl) {
|
||||
++NumPreds;
|
||||
++N->NumSuccs;
|
||||
@ -158,15 +160,15 @@ namespace llvm {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool removePred(SUnit *N, bool isCtrl, bool isSpecial) {
|
||||
bool removePred(SUnit *N, bool isCtrl, bool isArtificial) {
|
||||
for (SmallVector<SDep, 4>::iterator I = Preds.begin(), E = Preds.end();
|
||||
I != E; ++I)
|
||||
if (I->Dep == N && I->isCtrl == isCtrl && I->isSpecial == isSpecial) {
|
||||
if (I->Dep == N && I->isCtrl == isCtrl && I->isArtificial == isArtificial) {
|
||||
bool FoundSucc = false;
|
||||
for (SmallVector<SDep, 4>::iterator II = N->Succs.begin(),
|
||||
EE = N->Succs.end(); II != EE; ++II)
|
||||
if (II->Dep == this &&
|
||||
II->isCtrl == isCtrl && II->isSpecial == isSpecial) {
|
||||
II->isCtrl == isCtrl && II->isArtificial == isArtificial) {
|
||||
FoundSucc = true;
|
||||
N->Succs.erase(II);
|
||||
break;
|
||||
@ -373,7 +375,7 @@ namespace llvm {
|
||||
unsigned getOperand() const { return Operand; }
|
||||
const SUnit *getNode() const { return Node; }
|
||||
bool isCtrlDep() const { return Node->Preds[Operand].isCtrl; }
|
||||
bool isSpecialDep() const { return Node->Preds[Operand].isSpecial; }
|
||||
bool isArtificialDep() const { return Node->Preds[Operand].isArtificial; }
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<SUnit*> {
|
||||
|
@ -188,7 +188,7 @@ void SUnit::dumpAll(const ScheduleDAG *G) const {
|
||||
else
|
||||
cerr << " val #";
|
||||
cerr << I->Dep << " - SU(" << I->Dep->NodeNum << ")";
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
cerr << " *";
|
||||
cerr << "\n";
|
||||
}
|
||||
@ -202,7 +202,7 @@ void SUnit::dumpAll(const ScheduleDAG *G) const {
|
||||
else
|
||||
cerr << " val #";
|
||||
cerr << I->Dep << " - SU(" << I->Dep->NodeNum << ")";
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
cerr << " *";
|
||||
cerr << "\n";
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace llvm {
|
||||
/// edge, override this method.
|
||||
template<typename EdgeIter>
|
||||
static std::string getEdgeAttributes(const void *Node, EdgeIter EI) {
|
||||
if (EI.isSpecialDep())
|
||||
if (EI.isArtificialDep())
|
||||
return "color=cyan,style=dashed";
|
||||
if (EI.isCtrlDep())
|
||||
return "color=blue,style=dashed";
|
||||
|
@ -80,12 +80,12 @@ public:
|
||||
/// AddPred - This adds the specified node X as a predecessor of
|
||||
/// the current node Y if not already.
|
||||
/// This returns true if this is a new predecessor.
|
||||
bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
|
||||
bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isArtificial,
|
||||
unsigned PhyReg = 0, int Cost = 1);
|
||||
|
||||
/// RemovePred - This removes the specified node N from the predecessors of
|
||||
/// the current node M.
|
||||
bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isSpecial);
|
||||
bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isArtificial);
|
||||
|
||||
private:
|
||||
void ReleasePred(SUnit *SU, SUnit *PredSU, bool isChain);
|
||||
@ -189,16 +189,16 @@ void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
|
||||
}
|
||||
|
||||
/// AddPred - adds an edge from SUnit X to SUnit Y.
|
||||
bool ScheduleDAGFast::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
|
||||
unsigned PhyReg, int Cost) {
|
||||
return Y->addPred(X, isCtrl, isSpecial, PhyReg, Cost);
|
||||
bool ScheduleDAGFast::AddPred(SUnit *Y, SUnit *X, bool isCtrl,
|
||||
bool isArtificial, unsigned PhyReg, int Cost) {
|
||||
return Y->addPred(X, isCtrl, isArtificial, PhyReg, Cost);
|
||||
}
|
||||
|
||||
/// RemovePred - This removes the specified node N from the predecessors of
|
||||
/// the current node M.
|
||||
bool ScheduleDAGFast::RemovePred(SUnit *M, SUnit *N,
|
||||
bool isCtrl, bool isSpecial) {
|
||||
return M->removePred(N, isCtrl, isSpecial);
|
||||
bool isCtrl, bool isArtificial) {
|
||||
return M->removePred(N, isCtrl, isArtificial);
|
||||
}
|
||||
|
||||
/// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
|
||||
@ -295,10 +295,10 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
I != E; ++I) {
|
||||
if (I->isCtrl)
|
||||
ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
|
||||
I->isCtrl, I->isSpecial));
|
||||
I->isCtrl, I->isArtificial));
|
||||
else
|
||||
NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
|
||||
I->isCtrl, I->isSpecial));
|
||||
I->isCtrl, I->isArtificial));
|
||||
}
|
||||
|
||||
if (ChainPred) {
|
||||
@ -308,29 +308,29 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
}
|
||||
for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
|
||||
SDep *Pred = &LoadPreds[i];
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isArtificial);
|
||||
if (isNewLoad) {
|
||||
AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
|
||||
AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isArtificial,
|
||||
Pred->Reg, Pred->Cost);
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
|
||||
SDep *Pred = &NodePreds[i];
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
|
||||
AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isArtificial);
|
||||
AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isArtificial,
|
||||
Pred->Reg, Pred->Cost);
|
||||
}
|
||||
for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
|
||||
SDep *Succ = &NodeSuccs[i];
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
|
||||
AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isSpecial,
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isArtificial);
|
||||
AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isArtificial,
|
||||
Succ->Reg, Succ->Cost);
|
||||
}
|
||||
for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
|
||||
SDep *Succ = &ChainSuccs[i];
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isArtificial);
|
||||
if (isNewLoad) {
|
||||
AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isSpecial,
|
||||
AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isArtificial,
|
||||
Succ->Reg, Succ->Cost);
|
||||
}
|
||||
}
|
||||
@ -353,7 +353,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
// New SUnit has the exact same predecessors.
|
||||
for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
|
||||
I != E; ++I)
|
||||
if (!I->isSpecial) {
|
||||
if (!I->isArtificial) {
|
||||
AddPred(NewSU, I->Dep, I->isCtrl, false, I->Reg, I->Cost);
|
||||
NewSU->Depth = std::max(NewSU->Depth, I->Dep->Depth+1);
|
||||
}
|
||||
@ -363,7 +363,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
SmallVector<std::pair<SUnit*, bool>, 4> DelDeps;
|
||||
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||
I != E; ++I) {
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
continue;
|
||||
if (I->Dep->isScheduled) {
|
||||
NewSU->Height = std::max(NewSU->Height, I->Dep->Height+1);
|
||||
@ -400,7 +400,7 @@ void ScheduleDAGFast::InsertCCCopiesAndMoveSuccs(SUnit *SU, unsigned Reg,
|
||||
SmallVector<std::pair<SUnit*, bool>, 4> DelDeps;
|
||||
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||
I != E; ++I) {
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
continue;
|
||||
if (I->Dep->isScheduled) {
|
||||
AddPred(I->Dep, CopyToSU, I->isCtrl, false, I->Reg, I->Cost);
|
||||
|
@ -94,12 +94,12 @@ public:
|
||||
/// the current node Y if not already.
|
||||
/// This returns true if this is a new predecessor.
|
||||
/// Updates the topological ordering if required.
|
||||
bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
|
||||
bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isArtificial,
|
||||
unsigned PhyReg = 0, int Cost = 1);
|
||||
|
||||
/// RemovePred - This removes the specified node N from the predecessors of
|
||||
/// the current node M. Updates the topological ordering if required.
|
||||
bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isSpecial);
|
||||
bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isArtificial);
|
||||
|
||||
private:
|
||||
void ReleasePred(SUnit *SU, SUnit *PredSU, bool isChain);
|
||||
@ -482,8 +482,8 @@ void ScheduleDAGRRList::InitDAGTopologicalSorting() {
|
||||
|
||||
/// AddPred - adds an edge from SUnit X to SUnit Y.
|
||||
/// Updates the topological ordering if required.
|
||||
bool ScheduleDAGRRList::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
|
||||
unsigned PhyReg, int Cost) {
|
||||
bool ScheduleDAGRRList::AddPred(SUnit *Y, SUnit *X, bool isCtrl,
|
||||
bool isArtificial, unsigned PhyReg, int Cost) {
|
||||
int UpperBound, LowerBound;
|
||||
LowerBound = Node2Index[Y->NodeNum];
|
||||
UpperBound = Node2Index[X->NodeNum];
|
||||
@ -498,15 +498,15 @@ bool ScheduleDAGRRList::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
|
||||
Shift(Visited, LowerBound, UpperBound);
|
||||
}
|
||||
// Now really insert the edge.
|
||||
return Y->addPred(X, isCtrl, isSpecial, PhyReg, Cost);
|
||||
return Y->addPred(X, isCtrl, isArtificial, PhyReg, Cost);
|
||||
}
|
||||
|
||||
/// RemovePred - This removes the specified node N from the predecessors of
|
||||
/// the current node M. Updates the topological ordering if required.
|
||||
bool ScheduleDAGRRList::RemovePred(SUnit *M, SUnit *N,
|
||||
bool isCtrl, bool isSpecial) {
|
||||
bool isCtrl, bool isArtificial) {
|
||||
// InitDAGTopologicalSorting();
|
||||
return M->removePred(N, isCtrl, isSpecial);
|
||||
return M->removePred(N, isCtrl, isArtificial);
|
||||
}
|
||||
|
||||
/// DFS - Make a DFS traversal to mark all nodes reachable from SU and mark
|
||||
@ -696,10 +696,10 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
I != E; ++I) {
|
||||
if (I->isCtrl)
|
||||
ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
|
||||
I->isCtrl, I->isSpecial));
|
||||
I->isCtrl, I->isArtificial));
|
||||
else
|
||||
NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
|
||||
I->isCtrl, I->isSpecial));
|
||||
I->isCtrl, I->isArtificial));
|
||||
}
|
||||
|
||||
if (ChainPred) {
|
||||
@ -709,29 +709,29 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
}
|
||||
for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
|
||||
SDep *Pred = &LoadPreds[i];
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isArtificial);
|
||||
if (isNewLoad) {
|
||||
AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
|
||||
AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isArtificial,
|
||||
Pred->Reg, Pred->Cost);
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
|
||||
SDep *Pred = &NodePreds[i];
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
|
||||
AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
|
||||
RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isArtificial);
|
||||
AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isArtificial,
|
||||
Pred->Reg, Pred->Cost);
|
||||
}
|
||||
for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
|
||||
SDep *Succ = &NodeSuccs[i];
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
|
||||
AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isSpecial,
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isArtificial);
|
||||
AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isArtificial,
|
||||
Succ->Reg, Succ->Cost);
|
||||
}
|
||||
for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
|
||||
SDep *Succ = &ChainSuccs[i];
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
|
||||
RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isArtificial);
|
||||
if (isNewLoad) {
|
||||
AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isSpecial,
|
||||
AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isArtificial,
|
||||
Succ->Reg, Succ->Cost);
|
||||
}
|
||||
}
|
||||
@ -758,7 +758,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
// New SUnit has the exact same predecessors.
|
||||
for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
|
||||
I != E; ++I)
|
||||
if (!I->isSpecial) {
|
||||
if (!I->isArtificial) {
|
||||
AddPred(NewSU, I->Dep, I->isCtrl, false, I->Reg, I->Cost);
|
||||
NewSU->Depth = std::max(NewSU->Depth, I->Dep->Depth+1);
|
||||
}
|
||||
@ -768,7 +768,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
|
||||
SmallVector<std::pair<SUnit*, bool>, 4> DelDeps;
|
||||
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||
I != E; ++I) {
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
continue;
|
||||
if (I->Dep->isScheduled) {
|
||||
NewSU->Height = std::max(NewSU->Height, I->Dep->Height+1);
|
||||
@ -810,7 +810,7 @@ void ScheduleDAGRRList::InsertCCCopiesAndMoveSuccs(SUnit *SU, unsigned Reg,
|
||||
SmallVector<std::pair<SUnit*, bool>, 4> DelDeps;
|
||||
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||
I != E; ++I) {
|
||||
if (I->isSpecial)
|
||||
if (I->isArtificial)
|
||||
continue;
|
||||
if (I->Dep->isScheduled) {
|
||||
CopyToSU->Height = std::max(CopyToSU->Height, I->Dep->Height+1);
|
||||
|
Loading…
Reference in New Issue
Block a user