[RISCV][NFC] Use bitmasks generated by TableGen#135600
Merged
Conversation
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1
Member
|
@llvm/pr-subscribers-backend-risc-v Author: Pengcheng Wang (wangpc-pp) ChangesSo that we don't need to sync-up the table manually. Full diff: https://github.com/llvm/llvm-project/pull/135600.diff 3 Files Affected:
diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index 6e231d32e7897..e0105685c210d 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -24,14 +24,6 @@ class Triple;
namespace RISCV {
-namespace RISCVExtensionBitmaskTable {
-struct RISCVExtensionBitmask {
- const char *Name;
- unsigned GroupID;
- unsigned BitPosition;
-};
-} // namespace RISCVExtensionBitmaskTable
-
struct CPUModel {
uint32_t MVendorID;
uint64_t MArchID;
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 4ff2fb11b1b00..524d6dc01e8aa 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -1048,41 +1048,21 @@ struct RISCVExtBit {
uint8_t bitpos;
};
-constexpr static RISCVExtBit RISCVBitPositions[] = {
- {"a", 0, 0}, {"c", 0, 2},
- {"d", 0, 3}, {"f", 0, 5},
- {"i", 0, 8}, {"m", 0, 12},
- {"v", 0, 21}, {"zacas", 0, 26},
- {"zba", 0, 27}, {"zbb", 0, 28},
- {"zbc", 0, 29}, {"zbkb", 0, 30},
- {"zbkc", 0, 31}, {"zbkx", 0, 32},
- {"zbs", 0, 33}, {"zfa", 0, 34},
- {"zfh", 0, 35}, {"zfhmin", 0, 36},
- {"zicboz", 0, 37}, {"zicond", 0, 38},
- {"zihintntl", 0, 39}, {"zihintpause", 0, 40},
- {"zknd", 0, 41}, {"zkne", 0, 42},
- {"zknh", 0, 43}, {"zksed", 0, 44},
- {"zksh", 0, 45}, {"zkt", 0, 46},
- {"ztso", 0, 47}, {"zvbb", 0, 48},
- {"zvbc", 0, 49}, {"zvfh", 0, 50},
- {"zvfhmin", 0, 51}, {"zvkb", 0, 52},
- {"zvkg", 0, 53}, {"zvkned", 0, 54},
- {"zvknha", 0, 55}, {"zvknhb", 0, 56},
- {"zvksed", 0, 57}, {"zvksh", 0, 58},
- {"zvkt", 0, 59}, {"zve32x", 0, 60},
- {"zve32f", 0, 61}, {"zve64x", 0, 62},
- {"zve64f", 0, 63}, {"zve64d", 1, 0},
- {"zimop", 1, 1}, {"zca", 1, 2},
- {"zcb", 1, 3}, {"zcd", 1, 4},
- {"zcf", 1, 5}, {"zcmop", 1, 6},
- {"zawrs", 1, 7}};
+struct RISCVExtensionBitmask {
+ const char *Name;
+ unsigned GroupID;
+ unsigned BitPosition;
+};
+
+#define GET_RISCVExtensionBitmaskTable_IMPL
+#include "llvm/TargetParser/RISCVTargetParserDef.inc"
std::pair<int, int> RISCVISAInfo::getRISCVFeaturesBitsInfo(StringRef Ext) {
// Note that this code currently accepts mixed case extension names, but
// does not handle extension versions at all. That's probably fine because
// there's only one extension version in the __riscv_feature_bits vector.
- for (auto E : RISCVBitPositions)
- if (E.ext.equals_insensitive(Ext))
- return std::make_pair(E.groupid, E.bitpos);
+ for (auto E : ExtensionBitmask)
+ if (Ext.equals_insensitive(E.Name))
+ return std::make_pair(E.GroupID, E.BitPosition);
return std::make_pair(-1, -1);
}
diff --git a/llvm/lib/TargetParser/RISCVTargetParser.cpp b/llvm/lib/TargetParser/RISCVTargetParser.cpp
index 4111f8bfd2662..5bd7de1d3ca46 100644
--- a/llvm/lib/TargetParser/RISCVTargetParser.cpp
+++ b/llvm/lib/TargetParser/RISCVTargetParser.cpp
@@ -138,21 +138,6 @@ void getFeaturesForCPU(StringRef CPU,
EnabledFeatures.push_back(F.substr(1));
}
-namespace RISCVExtensionBitmaskTable {
-#define GET_RISCVExtensionBitmaskTable_IMPL
-#include "llvm/TargetParser/RISCVTargetParserDef.inc"
-
-} // namespace RISCVExtensionBitmaskTable
-
-namespace {
-struct LessExtName {
- bool operator()(const RISCVExtensionBitmaskTable::RISCVExtensionBitmask &LHS,
- StringRef RHS) {
- return StringRef(LHS.Name) < RHS;
- }
-};
-} // namespace
-
} // namespace RISCV
namespace RISCVVType {
|
Contributor
|
Is |
Contributor
Author
Oh I forgot to say that this PR is stacked on #135599. |
Created using spr 1.3.6-beta.1 [skip ci]
llvm-sync bot
pushed a commit
to arm/arm-toolchain
that referenced
this pull request
Apr 14, 2025
So that we don't need to sync-up the table manually. Reviewers: BeMg, preames, lenary Reviewed By: BeMg Pull Request: llvm/llvm-project#135600
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So that we don't need to sync-up the table manually.