diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-14 13:24:17 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-14 13:24:17 +0000 |
commit | 4d7af65903cbc858464362e70a6adf499982ec8a (patch) | |
tree | 5f40fb851e4f08c9aa8ebe952bb876ccb02c2ffb /lib/CodeGen/InstrSched/SchedGraph.cpp | |
parent | 97323a47d88315b98e5ac38d64ba2a9e3f02b501 (diff) |
Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
b) add isUse(), isDef()
c) rename opHiBits32() to isHiBits32(),
opLoBits32() to isLoBits32(),
opHiBits64() to isHiBits64(),
opLoBits64() to isLoBits64().
This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InstrSched/SchedGraph.cpp')
-rw-r--r-- | lib/CodeGen/InstrSched/SchedGraph.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp index 3a8088043b..2dafe62c72 100644 --- a/lib/CodeGen/InstrSched/SchedGraph.cpp +++ b/lib/CodeGen/InstrSched/SchedGraph.cpp @@ -342,8 +342,8 @@ void SchedGraph::addMachineRegEdges(RegToRefVecMap& regToRefVecMap, unsigned int opNum = regRefVec[i].second; const MachineOperand& mop = node->getMachineInstr()->getExplOrImplOperand(opNum); - bool isDef = mop.opIsDefOnly(); - bool isDefAndUse = mop.opIsDefAndUse(); + bool isDef = mop.isDef() && !mop.isUse(); + bool isDefAndUse = mop.isDef() && mop.isUse(); for (unsigned p=0; p < i; ++p) { SchedGraphNode* prevNode = regRefVec[p].first; @@ -351,8 +351,8 @@ void SchedGraph::addMachineRegEdges(RegToRefVecMap& regToRefVecMap, unsigned int prevOpNum = regRefVec[p].second; const MachineOperand& prevMop = prevNode->getMachineInstr()->getExplOrImplOperand(prevOpNum); - bool prevIsDef = prevMop.opIsDefOnly(); - bool prevIsDefAndUse = prevMop.opIsDefAndUse(); + bool prevIsDef = prevMop.isDef() && !prevMop.isUse(); + bool prevIsDefAndUse = prevMop.isDef() && prevMop.isUse(); if (isDef) { if (prevIsDef) new SchedGraphEdge(prevNode, node, regNum, @@ -381,10 +381,8 @@ void SchedGraph::addEdgesForValue(SchedGraphNode* refNode, const RefVec& defVec, const Value* defValue, bool refNodeIsDef, - bool refNodeIsDefAndUse, + bool refNodeIsUse, const TargetMachine& target) { - bool refNodeIsUse = !refNodeIsDef || refNodeIsDefAndUse; - // Add true or output dep edges from all def nodes before refNode in BB. // Add anti or output dep edges to all def nodes after refNode. for (RefVec::const_iterator I=defVec.begin(), E=defVec.end(); I != E; ++I) { @@ -393,7 +391,7 @@ void SchedGraph::addEdgesForValue(SchedGraphNode* refNode, if ((*I).first->getOrigIndexInBB() < refNode->getOrigIndexInBB()) { // (*).first is before refNode - if (refNodeIsDef) + if (refNodeIsDef && !refNodeIsUse) (void) new SchedGraphEdge((*I).first, refNode, defValue, SchedGraphEdge::OutputDep); if (refNodeIsUse) @@ -401,7 +399,7 @@ void SchedGraph::addEdgesForValue(SchedGraphNode* refNode, SchedGraphEdge::TrueDep); } else { // (*).first is after refNode - if (refNodeIsDef) + if (refNodeIsDef && !refNodeIsUse) (void) new SchedGraphEdge(refNode, (*I).first, defValue, SchedGraphEdge::OutputDep); if (refNodeIsUse) @@ -429,8 +427,8 @@ void SchedGraph::addEdgesForInstruction(const MachineInstr& MI, ValueToDefVecMap::const_iterator I = valueToDefVecMap.find(srcI); if (I != valueToDefVecMap.end()) addEdgesForValue(node, I->second, srcI, - MI.getOperand(i).opIsDefOnly(), - MI.getOperand(i).opIsDefAndUse(), target); + MI.getOperand(i).isDef(), MI.getOperand(i).isUse(), + target); } break; @@ -454,13 +452,13 @@ void SchedGraph::addEdgesForInstruction(const MachineInstr& MI, // value of a Ret instruction. // for (unsigned i=0, N=MI.getNumImplicitRefs(); i < N; ++i) - if (MI.getImplicitOp(i).opIsUse() || MI.getImplicitOp(i).opIsDefAndUse()) + if (MI.getImplicitOp(i).isUse()) if (const Value* srcI = MI.getImplicitRef(i)) { ValueToDefVecMap::const_iterator I = valueToDefVecMap.find(srcI); if (I != valueToDefVecMap.end()) addEdgesForValue(node, I->second, srcI, - MI.getImplicitOp(i).opIsDefOnly(), - MI.getImplicitOp(i).opIsDefAndUse(), target); + MI.getImplicitOp(i).isDef(), + MI.getImplicitOp(i).isUse(), target); } } @@ -512,8 +510,7 @@ void SchedGraph::findDefUseInfoAtInstr(const TargetMachine& target, } // ignore all other non-def operands - if (!MI.getOperand(i).opIsDefOnly() && - !MI.getOperand(i).opIsDefAndUse()) + if (!MI.getOperand(i).isDef()) continue; // We must be defining a value. @@ -539,10 +536,10 @@ void SchedGraph::findDefUseInfoAtInstr(const TargetMachine& target, continue; // nothing more to do } - if (mop.opIsDefOnly() || mop.opIsDefAndUse()) { + if (mop.isDef()) { assert(MI.getImplicitRef(i) != NULL && "Null value being defined?"); - valueToDefVecMap[MI.getImplicitRef(i)].push_back(std::make_pair(node, - -i)); + valueToDefVecMap[MI.getImplicitRef(i)].push_back( + std::make_pair(node, -i)); } } } |