[llvm] 4c66b03 - [NFC] make TypeInfer::expandOverloads const
Tomas Matheson via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 9 02:10:14 PDT 2023
Author: Tomas Matheson
Date: 2023-07-09T09:19:06+01:00
New Revision: 4c66b0325905bdb367a5453574c10e535b900b5e
URL: https://github.com/llvm/llvm-project/commit/4c66b0325905bdb367a5453574c10e535b900b5e
DIFF: https://github.com/llvm/llvm-project/commit/4c66b0325905bdb367a5453574c10e535b900b5e.diff
LOG: [NFC] make TypeInfer::expandOverloads const
Differential Revision: https://reviews.llvm.org/D154780
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.h
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 4d64bdf52f7571..3260d025e82462 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -807,7 +807,7 @@ bool TypeInfer::EnforceSameSize(TypeSetByHwMode &A, TypeSetByHwMode &B) {
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 &VTS) {
}
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 @@ void TypeInfer::expandOverloads(TypeSetByHwMode::SetType &Out,
}
}
-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.
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index 9b4f7218c3e2e5..1579409dbb67b5 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -330,9 +330,9 @@ struct TypeInfer {
/// 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 @@ struct TypeInfer {
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
More information about the llvm-commits
mailing list