[PATCH] D154780: [NFC] make TypeInfer::expandOverloads const

Tomas Matheson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 02:10:17 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c66b0325905: [NFC] make TypeInfer::expandOverloads const (authored by tmatheson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154780/new/

https://reviews.llvm.org/D154780

Files:
  llvm/utils/TableGen/CodeGenDAGPatterns.cpp
  llvm/utils/TableGen/CodeGenDAGPatterns.h


Index: llvm/utils/TableGen/CodeGenDAGPatterns.h
===================================================================
--- llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -330,9 +330,9 @@
 
   /// For each overloaded type (i.e. of form *Any), replace it with the
   /// corresponding subset of legal, specific types.
-  void expandOverloads(TypeSetByHwMode &VTS);
+  void expandOverloads(TypeSetByHwMode &VTS) const;
   void expandOverloads(TypeSetByHwMode::SetType &Out,
-                       const TypeSetByHwMode::SetType &Legal);
+                       const TypeSetByHwMode::SetType &Legal) const;
 
   struct ValidateOnExit {
     ValidateOnExit(const TypeSetByHwMode &T, const TypeInfer &TI)
@@ -357,11 +357,11 @@
   bool Validate = true;   // Indicate whether to validate types.
 
 private:
-  const TypeSetByHwMode &getLegalTypes();
+  const TypeSetByHwMode &getLegalTypes() const;
 
   /// Cached legal types (in default mode).
-  bool LegalTypesCached = false;
-  TypeSetByHwMode LegalCache;
+  mutable bool LegalTypesCached = false;
+  mutable TypeSetByHwMode LegalCache;
 };
 
 /// Set type used to track multiply used variables in patterns
Index: llvm/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -807,7 +807,7 @@
   return Changed;
 }
 
-void TypeInfer::expandOverloads(TypeSetByHwMode &VTS) {
+void TypeInfer::expandOverloads(TypeSetByHwMode &VTS) const {
   ValidateOnExit _1(VTS, *this);
   const TypeSetByHwMode &Legal = getLegalTypes();
   assert(Legal.isSimple() && "Default-mode only expected");
@@ -818,7 +818,7 @@
 }
 
 void TypeInfer::expandOverloads(TypeSetByHwMode::SetType &Out,
-                                const TypeSetByHwMode::SetType &Legal) {
+                                const TypeSetByHwMode::SetType &Legal) const {
   if (Out.count(MVT::iPTRAny)) {
     Out.erase(MVT::iPTRAny);
     Out.insert(MVT::iPTR);
@@ -857,7 +857,7 @@
   }
 }
 
-const TypeSetByHwMode &TypeInfer::getLegalTypes() {
+const TypeSetByHwMode &TypeInfer::getLegalTypes() const {
   if (!LegalTypesCached) {
     TypeSetByHwMode::SetType &LegalTypes = LegalCache.getOrCreate(DefaultMode);
     // Stuff all types from all modes into the default mode.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154780.538409.patch
Type: text/x-patch
Size: 2365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230709/3499bf03/attachment.bin>


More information about the llvm-commits mailing list