[llvm] [Xtensa][NFC] Use compact enum for CPUNames/features (PR #206954)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 09:32:11 PDT 2026
================
@@ -19,28 +20,21 @@ namespace llvm {
namespace Xtensa {
struct CPUInfo {
- StringLiteral Name;
CPUKind Kind;
uint64_t Features;
};
-struct FeatureName {
- uint64_t ID;
- const char *NameCStr;
- size_t NameLength;
-
- StringRef getName() const { return StringRef(NameCStr, NameLength); }
-};
-
-const FeatureName XtensaFeatureNames[] = {
-#define XTENSA_FEATURE(ID, NAME) {ID, "+" NAME, sizeof(NAME)},
+constexpr EnumStringDef<uint64_t> FeatureNameDefs[] = {
+#define XTENSA_FEATURE(ID, NAME) {{NAME}, ID},
#include "llvm/TargetParser/XtensaTargetParser.def"
};
+static constexpr auto FeatureNames = BUILD_ENUM_STRINGS(FeatureNameDefs);
----------------
MaskRay wrote:
static is redundant: non-volatile const (implied by constexpr) has the internal linkage
https://github.com/llvm/llvm-project/pull/206954
More information about the llvm-commits
mailing list