aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-13 22:08:30 +0000
committerOwen Anderson <resistor@mac.com>2008-08-13 22:08:30 +0000
commit36bb2baee6402816b6a99690b05f5abd52e770d3 (patch)
tree845966a47f1465c73c0469e7cede6f549d8e2190 /include/llvm/CodeGen
parent101124c57c4e622a92f8a0275b914a7a3b5f26fa (diff)
downloadexternal_llvm-36bb2baee6402816b6a99690b05f5abd52e770d3.tar.gz
external_llvm-36bb2baee6402816b6a99690b05f5abd52e770d3.tar.bz2
external_llvm-36bb2baee6402816b6a99690b05f5abd52e770d3.zip
Move r2iMap_ over to DenseMap from std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index cf5ad63f09..e12bab18b7 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -55,6 +55,20 @@ namespace llvm {
return LHS.first < RHS.first;
}
};
+
+ // Provide DenseMapInfo for unsigned.
+ template<>
+ struct DenseMapInfo<unsigned> {
+ static inline unsigned getEmptyKey() { return (unsigned)-1; }
+ static inline unsigned getTombstoneKey() { return (unsigned)-2; }
+ static unsigned getHashValue(const unsigned Val) {
+ return Val * 37;
+ }
+ static bool isEqual(const unsigned LHS, const unsigned RHS) {
+ return LHS == RHS;
+ }
+ static bool isPod() { return true; }
+ };
class LiveIntervals : public MachineFunctionPass {
MachineFunction* mf_;
@@ -86,7 +100,7 @@ namespace llvm {
typedef std::vector<MachineInstr*> Index2MiMap;
Index2MiMap i2miMap_;
- typedef std::map<unsigned, LiveInterval*> Reg2IntervalMap;
+ typedef DenseMap<unsigned, LiveInterval*> Reg2IntervalMap;
Reg2IntervalMap r2iMap_;
BitVector allocatableRegs_;
@@ -236,7 +250,7 @@ namespace llvm {
LiveInterval &getOrCreateInterval(unsigned reg) {
Reg2IntervalMap::iterator I = r2iMap_.find(reg);
if (I == r2iMap_.end())
- I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg)));
+ I = r2iMap_.insert(std::make_pair(reg, createInterval(reg))).first;
return *I->second;
}
@@ -248,7 +262,7 @@ namespace llvm {
// Interval removal
void removeInterval(unsigned Reg) {
- std::map<unsigned, LiveInterval*>::iterator I = r2iMap_.find(Reg);
+ DenseMap<unsigned, LiveInterval*>::iterator I = r2iMap_.find(Reg);
delete I->second;
r2iMap_.erase(I);
}