[llvm-commits] CVS: llvm/include/llvm/Target/MachineSchedInfo.h
Vikram Adve
vadve at cs.uiuc.edu
Sat Oct 12 19:37:01 PDT 2002
Changes in directory llvm/include/llvm/Target:
MachineSchedInfo.h updated: 1.8 -> 1.9
---
Log message:
Use vectors instead of hash_maps for issueGaps and conflictLists.
These hash lookups were a major sink of time because they happen so often!
---
Diffs of the changes:
Index: llvm/include/llvm/Target/MachineSchedInfo.h
diff -u llvm/include/llvm/Target/MachineSchedInfo.h:1.8 llvm/include/llvm/Target/MachineSchedInfo.h:1.9
--- llvm/include/llvm/Target/MachineSchedInfo.h:1.8 Wed Jul 24 17:20:06 2002
+++ llvm/include/llvm/Target/MachineSchedInfo.h Sat Oct 12 19:36:36 2002
@@ -242,21 +242,20 @@
inline int getLongestIssueConflict () const {
return longestIssueConflict;
}
-
+
inline int getMinIssueGap (MachineOpCode fromOp,
MachineOpCode toOp) const {
- hash_map<OpCodePair,int>::const_iterator
- I = issueGaps.find(OpCodePair(fromOp, toOp));
- return (I == issueGaps.end())? 0 : (*I).second;
+ assert(fromOp < (int) issueGaps.size());
+ const std::vector<int>& toGaps = issueGaps[fromOp];
+ return (toOp < (int) toGaps.size())? toGaps[toOp] : 0;
}
-
- inline const std::vector<MachineOpCode>*
+
+ inline const std::vector<MachineOpCode>&
getConflictList(MachineOpCode opCode) const {
- hash_map<MachineOpCode, std::vector<MachineOpCode> >::const_iterator
- I = conflictLists.find(opCode);
- return (I == conflictLists.end())? NULL : & (*I).second;
+ assert(opCode < (int) conflictLists.size());
+ return conflictLists[opCode];
}
-
+
inline bool isSingleIssue (MachineOpCode opCode) const {
return getInstrRUsage(opCode).isSingleIssue;
}
@@ -276,6 +275,13 @@
void computeInstrResources(const std::vector<InstrRUsage>& instrRUForClasses);
void computeIssueGaps(const std::vector<InstrRUsage>& instrRUForClasses);
+ void setGap(int gap, MachineOpCode fromOp, MachineOpCode toOp) {
+ std::vector<int>& toGaps = issueGaps[fromOp];
+ if (toOp >= (int) toGaps.size())
+ toGaps.resize(toOp+1);
+ toGaps[toOp] = gap;
+ }
+
protected:
int numSchedClasses;
const MachineInstrInfo* mii;
@@ -285,10 +291,10 @@
unsigned numUsageDeltas;
unsigned numIssueDeltas;
- std::vector<InstrRUsage> instrRUsages; // indexed by opcode
- hash_map<OpCodePair,int> issueGaps; // indexed by opcode pair
- hash_map<MachineOpCode, std::vector<MachineOpCode> >
- conflictLists; // indexed by opcode
+ std::vector<InstrRUsage> instrRUsages; // indexed by opcode
+ std::vector<std::vector<int> > issueGaps; // indexed by [opcode1][opcode2]
+ std::vector<std::vector<MachineOpCode> >
+ conflictLists; // indexed by [opcode]
};
#endif
More information about the llvm-commits
mailing list