now removes deleted nops from MachineCodeForInstruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehwish Nagda
2002-07-25 17:31:05 +00:00
parent 0009c2e8b3
commit e95ce74b80
2 changed files with 40 additions and 16 deletions

View File

@ -79,7 +79,7 @@ private:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template<class _NodeType> template<class _NodeType>
class ScheduleIterator : public forward_iterator<_NodeType, ptrdiff_t> { class ScheduleIterator: public std::forward_iterator<_NodeType, ptrdiff_t> {
private: private:
unsigned cycleNum; unsigned cycleNum;
unsigned slotNum; unsigned slotNum;
@ -352,18 +352,18 @@ private:
unsigned int totalInstrCount; unsigned int totalInstrCount;
cycles_t curTime; cycles_t curTime;
cycles_t nextEarliestIssueTime; // next cycle we can issue cycles_t nextEarliestIssueTime; // next cycle we can issue
vector<hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot# vector<std::hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot#
vector<const SchedGraphNode*> choiceVec; // indexed by node ptr vector<const SchedGraphNode*> choiceVec; // indexed by node ptr
vector<int> numInClass; // indexed by sched class vector<int> numInClass; // indexed by sched class
vector<cycles_t> nextEarliestStartTime; // indexed by opCode vector<cycles_t> nextEarliestStartTime; // indexed by opCode
hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches; std::hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches;
// indexed by branch node ptr // indexed by branch node ptr
public: public:
SchedulingManager(const TargetMachine& _target, const SchedGraph* graph, SchedulingManager(const TargetMachine& _target, const SchedGraph* graph,
SchedPriorities& schedPrio); SchedPriorities& schedPrio);
~SchedulingManager() { ~SchedulingManager() {
for (hash_map<const SchedGraphNode*, for (std::hash_map<const SchedGraphNode*,
DelaySlotInfo*>::iterator I = delaySlotInfoForBranches.begin(), DelaySlotInfo*>::iterator I = delaySlotInfoForBranches.begin(),
E = delaySlotInfoForBranches.end(); I != E; ++I) E = delaySlotInfoForBranches.end(); I != E; ++I)
delete I->second; delete I->second;
@ -422,7 +422,7 @@ public:
return choiceVec[i]; return choiceVec[i];
} }
inline hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) { inline std::hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) {
assert(slotNum < nslots); assert(slotNum < nslots);
return choicesForSlot[slotNum]; return choicesForSlot[slotNum];
} }
@ -497,7 +497,7 @@ public:
inline DelaySlotInfo* getDelaySlotInfoForInstr(const SchedGraphNode* bn, inline DelaySlotInfo* getDelaySlotInfoForInstr(const SchedGraphNode* bn,
bool createIfMissing=false) bool createIfMissing=false)
{ {
hash_map<const SchedGraphNode*, DelaySlotInfo*>::const_iterator std::hash_map<const SchedGraphNode*, DelaySlotInfo*>::const_iterator
I = delaySlotInfoForBranches.find(bn); I = delaySlotInfoForBranches.find(bn);
if (I != delaySlotInfoForBranches.end()) if (I != delaySlotInfoForBranches.end())
return I->second; return I->second;
@ -1243,8 +1243,20 @@ ReplaceNopsWithUsefulInstr(SchedulingManager& S,
if (sdelayNodeVec.size() < ndelays) if (sdelayNodeVec.size() < ndelays)
sdelayNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); sdelayNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i]));
else else
{
nopNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); nopNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i]));
//remove the MI from the Machine Code For Instruction
MachineCodeForInstruction& llvmMvec =
MachineCodeForInstruction::get((Instruction *)
(node->getBB()->getTerminator()));
for(MachineCodeForInstruction::iterator mciI=llvmMvec.begin(),
mciE=llvmMvec.end(); mciI!=mciE; ++mciI){
if(*mciI==bbMvec[i])
llvmMvec.erase(mciI);
}
}
assert(sdelayNodeVec.size() >= ndelays); assert(sdelayNodeVec.size() >= ndelays);
// If some delay slots were already filled, throw away that many new choices // If some delay slots were already filled, throw away that many new choices

View File

@ -79,7 +79,7 @@ private:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template<class _NodeType> template<class _NodeType>
class ScheduleIterator : public forward_iterator<_NodeType, ptrdiff_t> { class ScheduleIterator: public std::forward_iterator<_NodeType, ptrdiff_t> {
private: private:
unsigned cycleNum; unsigned cycleNum;
unsigned slotNum; unsigned slotNum;
@ -352,18 +352,18 @@ private:
unsigned int totalInstrCount; unsigned int totalInstrCount;
cycles_t curTime; cycles_t curTime;
cycles_t nextEarliestIssueTime; // next cycle we can issue cycles_t nextEarliestIssueTime; // next cycle we can issue
vector<hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot# vector<std::hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot#
vector<const SchedGraphNode*> choiceVec; // indexed by node ptr vector<const SchedGraphNode*> choiceVec; // indexed by node ptr
vector<int> numInClass; // indexed by sched class vector<int> numInClass; // indexed by sched class
vector<cycles_t> nextEarliestStartTime; // indexed by opCode vector<cycles_t> nextEarliestStartTime; // indexed by opCode
hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches; std::hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches;
// indexed by branch node ptr // indexed by branch node ptr
public: public:
SchedulingManager(const TargetMachine& _target, const SchedGraph* graph, SchedulingManager(const TargetMachine& _target, const SchedGraph* graph,
SchedPriorities& schedPrio); SchedPriorities& schedPrio);
~SchedulingManager() { ~SchedulingManager() {
for (hash_map<const SchedGraphNode*, for (std::hash_map<const SchedGraphNode*,
DelaySlotInfo*>::iterator I = delaySlotInfoForBranches.begin(), DelaySlotInfo*>::iterator I = delaySlotInfoForBranches.begin(),
E = delaySlotInfoForBranches.end(); I != E; ++I) E = delaySlotInfoForBranches.end(); I != E; ++I)
delete I->second; delete I->second;
@ -422,7 +422,7 @@ public:
return choiceVec[i]; return choiceVec[i];
} }
inline hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) { inline std::hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) {
assert(slotNum < nslots); assert(slotNum < nslots);
return choicesForSlot[slotNum]; return choicesForSlot[slotNum];
} }
@ -497,7 +497,7 @@ public:
inline DelaySlotInfo* getDelaySlotInfoForInstr(const SchedGraphNode* bn, inline DelaySlotInfo* getDelaySlotInfoForInstr(const SchedGraphNode* bn,
bool createIfMissing=false) bool createIfMissing=false)
{ {
hash_map<const SchedGraphNode*, DelaySlotInfo*>::const_iterator std::hash_map<const SchedGraphNode*, DelaySlotInfo*>::const_iterator
I = delaySlotInfoForBranches.find(bn); I = delaySlotInfoForBranches.find(bn);
if (I != delaySlotInfoForBranches.end()) if (I != delaySlotInfoForBranches.end())
return I->second; return I->second;
@ -1243,8 +1243,20 @@ ReplaceNopsWithUsefulInstr(SchedulingManager& S,
if (sdelayNodeVec.size() < ndelays) if (sdelayNodeVec.size() < ndelays)
sdelayNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); sdelayNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i]));
else else
{
nopNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i])); nopNodeVec.push_back(graph->getGraphNodeForInstr(bbMvec[i]));
//remove the MI from the Machine Code For Instruction
MachineCodeForInstruction& llvmMvec =
MachineCodeForInstruction::get((Instruction *)
(node->getBB()->getTerminator()));
for(MachineCodeForInstruction::iterator mciI=llvmMvec.begin(),
mciE=llvmMvec.end(); mciI!=mciE; ++mciI){
if(*mciI==bbMvec[i])
llvmMvec.erase(mciI);
}
}
assert(sdelayNodeVec.size() >= ndelays); assert(sdelayNodeVec.size() >= ndelays);
// If some delay slots were already filled, throw away that many new choices // If some delay slots were already filled, throw away that many new choices