diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-11-12 14:18:01 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-11-12 14:18:01 +0000 |
commit | af00d485a409983639881b4d34f0cd89e1eb4d38 (patch) | |
tree | add356970280a6bc2a82ca2faf1e19900aa2f652 /lib/CodeGen/InstrSched/InstrScheduling.cpp | |
parent | 5567e942c03056cc566225e93a93f6516d73f305 (diff) |
Major improvement to how nodes are built for a BB.
LLVM instruction is no longer recorded in each node, but BB is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InstrSched/InstrScheduling.cpp')
-rw-r--r-- | lib/CodeGen/InstrSched/InstrScheduling.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp index 7a9a801715..0ba218da1c 100644 --- a/lib/CodeGen/InstrSched/InstrScheduling.cpp +++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp @@ -1235,33 +1235,27 @@ ReplaceNopsWithUsefulInstr(SchedulingManager& S, // If not enough useful instructions were found, use the NOPs to // fill delay slots, otherwise, just discard them. // - MachineCodeForVMInstr& termMvec = node->getInstr()->getMachineInstrVec(); - unsigned int firstDelaySlotIdx; - for (unsigned i=0; i < termMvec.size(); ++i) - if (termMvec[i] == brInstr) - { - firstDelaySlotIdx = i+1; - break; - } - assert(firstDelaySlotIdx <= termMvec.size()-1 && - "This sucks! Where's that delay slot instruction?"); + unsigned int firstDelaySlotIdx = node->getOrigIndexInBB() + 1; + MachineCodeForBasicBlock& bbMvec = node->getBB()->getMachineInstrVec(); + assert(bbMvec[firstDelaySlotIdx - 1] == brInstr && + "Incorrect instr. index in basic block for brInstr"); // First find all useful instructions already in the delay slots // and USE THEM. We'll throw away the unused alternatives below // for (unsigned i=firstDelaySlotIdx; i < firstDelaySlotIdx + ndelays; ++i) - if (! mii.isNop(termMvec[i]->getOpCode())) + if (! mii.isNop(bbMvec[i]->getOpCode())) sdelayNodeVec.insert(sdelayNodeVec.begin(), - graph->getGraphNodeForInstr(termMvec[i])); + graph->getGraphNodeForInstr(bbMvec[i])); // Then find the NOPs and keep only as many as are needed. // Put the rest in nopNodeVec to be deleted. for (unsigned i=firstDelaySlotIdx; i < firstDelaySlotIdx + ndelays; ++i) - if (mii.isNop(termMvec[i]->getOpCode())) + if (mii.isNop(bbMvec[i]->getOpCode())) if (sdelayNodeVec.size() < ndelays) - sdelayNodeVec.push_back(graph->getGraphNodeForInstr(termMvec[i])); + sdelayNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); else - nopNodeVec.push_back(graph->getGraphNodeForInstr(termMvec[i])); + nopNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); assert(sdelayNodeVec.size() >= ndelays); |