X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FScheduleDAG.h;h=2f6fd009284b10e886602f0c3cc25623d40e7bdb;hb=c6b680eee58d27f4d38684c95e8fbfef61eb6558;hp=8ffe7f74389d16243dd45f6e1ef367c21c87a4ff;hpb=e7c1c660ad420aa49f888ce955c4d17660616505;p=oota-llvm.git diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index 8ffe7f74389..2f6fd009284 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -299,67 +299,13 @@ namespace llvm { /// addPred - This adds the specified edge as a pred of the current node if /// 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(const SDep &D) { - // If this node already has this depenence, don't add a redundant one. - for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i) - if (Preds[i] == D) - return false; - // Add a pred to this SUnit. - Preds.push_back(D); - // Now add a corresponding succ to N. - SDep P = D; - P.setSUnit(this); - SUnit *N = D.getSUnit(); - N->Succs.push_back(P); - // Update the bookkeeping. - if (D.getKind() == SDep::Data) { - ++NumPreds; - ++N->NumSuccs; - } - if (!N->isScheduled) - ++NumPredsLeft; - if (!isScheduled) - ++N->NumSuccsLeft; - return true; - } + /// specified node. + void addPred(const SDep &D); /// removePred - This removes the specified edge as a pred of the current /// node if it exists. It also removes the current node as a successor of - /// the specified node. This returns true if the edge existed and was - /// removed. - bool removePred(const SDep &D) { - // Find the matching predecessor. - for (SmallVector::iterator I = Preds.begin(), E = Preds.end(); - I != E; ++I) - if (*I == D) { - bool FoundSucc = false; - // Find the corresponding successor in N. - SDep P = D; - P.setSUnit(this); - SUnit *N = D.getSUnit(); - for (SmallVector::iterator II = N->Succs.begin(), - EE = N->Succs.end(); II != EE; ++II) - if (*II == P) { - FoundSucc = true; - N->Succs.erase(II); - break; - } - assert(FoundSucc && "Mismatching preds / succs lists!"); - Preds.erase(I); - // Update the bookkeeping; - if (D.getKind() == SDep::Data) { - --NumPreds; - --N->NumSuccs; - } - if (!N->isScheduled) - --NumPredsLeft; - if (!isScheduled) - --N->NumSuccsLeft; - return true; - } - return false; - } + /// the specified node. + void removePred(const SDep &D); bool isPred(SUnit *N) { for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i) @@ -549,10 +495,13 @@ namespace llvm { const SUnit *getNode() const { return Node; } /// isCtrlDep - Test if this is not an SDep::Data dependence. bool isCtrlDep() const { - return Node->Preds[Operand].isCtrl(); + return getSDep().isCtrl(); } bool isArtificialDep() const { - return Node->Preds[Operand].isArtificial(); + return getSDep().isArtificial(); + } + const SDep &getSDep() const { + return Node->Preds[Operand]; } };