Constify the key in Mi2IndexMap.
authorDavid Greene <greened@obbligato.org>
Wed, 22 Jul 2009 21:56:14 +0000 (21:56 +0000)
committerDavid Greene <greened@obbligato.org>
Wed, 22 Jul 2009 21:56:14 +0000 (21:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76801 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveIntervalAnalysis.h
lib/CodeGen/LiveIntervalAnalysis.cpp

index 40991e74e3c0a77a8a0b6cfc4066ddb504afa391..32bf67b8cc0893097f9a0f68595c2d950766fa05 100644 (file)
@@ -79,7 +79,7 @@ namespace llvm {
     /// FunctionSize - The number of instructions present in the function
     uint64_t FunctionSize;
 
-    typedef DenseMap<MachineInstr*, unsigned> Mi2IndexMap;
+    typedef DenseMap<const MachineInstr*, unsigned> Mi2IndexMap;
     Mi2IndexMap mi2iMap_;
 
     typedef std::vector<MachineInstr*> Index2MiMap;
@@ -198,7 +198,7 @@ namespace llvm {
     }
 
     /// getInstructionIndex - returns the base index of instr
-    unsigned getInstructionIndex(MachineInstr* instr) const {
+    unsigned getInstructionIndex(const MachineInstr* instr) const {
       Mi2IndexMap::const_iterator it = mi2iMap_.find(instr);
       assert(it != mi2iMap_.end() && "Invalid instruction!");
       return it->second;
index 261fa5e0f865f766a631581d9b45c8f4ea808fed..ee072115df327f2f5df8b5fa93c2364160097187 100644 (file)
@@ -464,7 +464,7 @@ void LiveIntervals::scaleNumbering(int factor) {
   i2miMap_.resize(highestSlot + 1);
   for (Mi2IndexMap::iterator MI = mi2iMap_.begin(), ME = mi2iMap_.end();
        MI != ME; ++MI) {
-    i2miMap_[MI->second] = MI->first;
+    i2miMap_[MI->second] = const_cast<MachineInstr *>(MI->first);
   }
 
 }