[RegisterBankInfo] Constify the member of the XXXMapping maps.
authorQuentin Colombet <qcolombet@apple.com>
Sat, 24 Sep 2016 04:54:03 +0000 (04:54 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Sat, 24 Sep 2016 04:54:03 +0000 (04:54 +0000)
This makes it obvious that items in those maps behave like statically
created objects.

llvm-svn: 282327

llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp

index 0d9df7a..757c4c4 100644 (file)
@@ -361,11 +361,11 @@ protected:
 
   /// Keep dynamically allocated PartialMapping in a separate map.
   /// This shouldn't be needed when everything gets TableGen'ed.
-  mutable DenseMap<unsigned, PartialMapping *> MapOfPartialMappings;
+  mutable DenseMap<unsigned, const PartialMapping *> MapOfPartialMappings;
 
   /// Keep dynamically allocated ValueMapping in a separate map.
   /// This shouldn't be needed when everything gets TableGen'ed.
-  mutable DenseMap<unsigned, ValueMapping *> MapOfValueMappings;
+  mutable DenseMap<unsigned, const ValueMapping *> MapOfValueMappings;
 
   /// Create a RegisterBankInfo that can accomodate up to \p NumRegBanks
   /// RegisterBank instances.
index 52963ca..bac9ba8 100644 (file)
@@ -344,7 +344,7 @@ RegisterBankInfo::getPartialMapping(unsigned StartIdx, unsigned Length,
 
   ++NumPartialMappingsCreated;
 
-  PartialMapping *&PartMapping = MapOfPartialMappings[Hash];
+  const PartialMapping *&PartMapping = MapOfPartialMappings[Hash];
   PartMapping = new PartialMapping{StartIdx, Length, RegBank};
   return *PartMapping;
 }
@@ -376,7 +376,7 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
 
   ++NumValueMappingsCreated;
 
-  ValueMapping *&ValMapping = MapOfValueMappings[Hash];
+  const ValueMapping *&ValMapping = MapOfValueMappings[Hash];
   ValMapping = new ValueMapping{BreakDown, NumBreakDowns};
   return *ValMapping;
 }