diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-09-19 01:38:40 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-09-19 01:38:40 +0000 |
commit | e795947c884a4b47ed678c2c1e371141cae76ef7 (patch) | |
tree | 54c0efe9349233ea62e126f50444d2eddbdddb95 /include | |
parent | 3a4f9ed7de6dba678e5a3c2b84b3146f242abbf5 (diff) | |
download | external_llvm-e795947c884a4b47ed678c2c1e371141cae76ef7.zip external_llvm-e795947c884a4b47ed678c2c1e371141cae76ef7.tar.gz external_llvm-e795947c884a4b47ed678c2c1e371141cae76ef7.tar.bz2 |
Use struct SDep instead of std::pair for SUnit pred and succ lists. First step
in tracking physical register output dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/ScheduleDAG.h | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index fdae927..17938d7 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -22,6 +22,7 @@ namespace llvm { struct InstrStage; + struct SUnit; class MachineConstantPool; class MachineModuleInfo; class MachineInstr; @@ -74,7 +75,18 @@ namespace llvm { virtual void EmitNoop() { } }; - + + /// SDep - Scheduling dependency. It keeps track of dependent nodes, + /// cost of the depdenency, etc. + struct SDep { + SUnit *Dep; // Dependent - either a predecessor or a successor. + bool isCtrl; // True iff it's a control dependency. + unsigned PhyReg; // If non-zero, this dep is a phy register dependency. + int Cost; // Cost of the dependency. + SDep(SUnit *d, bool c, unsigned r, int t) + : Dep(d), isCtrl(c), PhyReg(r), Cost(t) {} + }; + /// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or /// a group of nodes flagged together. struct SUnit { @@ -83,15 +95,13 @@ namespace llvm { // Preds/Succs - The SUnits before/after us in the graph. The boolean value // is true if the edge is a token chain edge, false if it is a value edge. - SmallVector<std::pair<SUnit*,bool>, 4> Preds; // All sunit predecessors. - SmallVector<std::pair<SUnit*,bool>, 4> Succs; // All sunit successors. - - typedef SmallVector<std::pair<SUnit*,bool>, 4>::iterator pred_iterator; - typedef SmallVector<std::pair<SUnit*,bool>, 4>::iterator succ_iterator; - typedef SmallVector<std::pair<SUnit*,bool>, 4>::const_iterator - const_pred_iterator; - typedef SmallVector<std::pair<SUnit*,bool>, 4>::const_iterator - const_succ_iterator; + SmallVector<SDep, 4> Preds; // All sunit predecessors. + SmallVector<SDep, 4> Succs; // All sunit successors. + + typedef SmallVector<SDep, 4>::iterator pred_iterator; + typedef SmallVector<SDep, 4>::iterator succ_iterator; + typedef SmallVector<SDep, 4>::const_iterator const_pred_iterator; + typedef SmallVector<SDep, 4>::const_iterator const_succ_iterator; short NumPreds; // # of preds. short NumSuccs; // # of sucss. @@ -121,21 +131,21 @@ 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 isChain) { + bool addPred(SUnit *N, bool isCtrl, unsigned PhyReg = 0, int Cost = 1) { for (unsigned i = 0, e = Preds.size(); i != e; ++i) - if (Preds[i].first == N && Preds[i].second == isChain) + if (Preds[i].Dep == N && Preds[i].isCtrl == isCtrl) return false; - Preds.push_back(std::make_pair(N, isChain)); + Preds.push_back(SDep(N, isCtrl, PhyReg, Cost)); return true; } /// addSucc - This adds the specified node as a succ of the current node if /// not already. This returns true if this is a new succ. - bool addSucc(SUnit *N, bool isChain) { + bool addSucc(SUnit *N, bool isCtrl, unsigned PhyReg = 0, int Cost = 1) { for (unsigned i = 0, e = Succs.size(); i != e; ++i) - if (Succs[i].first == N && Succs[i].second == isChain) + if (Succs[i].Dep == N && Succs[i].isCtrl == isCtrl) return false; - Succs.push_back(std::make_pair(N, isChain)); + Succs.push_back(SDep(N, isCtrl, PhyReg, Cost)); return true; } @@ -340,7 +350,7 @@ namespace llvm { } pointer operator*() const { - return Node->Preds[Operand].first; + return Node->Preds[Operand].Dep; } pointer operator->() const { return operator*(); } @@ -359,7 +369,7 @@ namespace llvm { unsigned getOperand() const { return Operand; } const SUnit *getNode() const { return Node; } - bool isChain() const { return Node->Preds[Operand].second; } + bool isCtrlDep() const { return Node->Preds[Operand].isCtrl; } }; template <> struct GraphTraits<SUnit*> { |