[clang] [llvm] [NFC] [RISCV] Refactor class RISCVExtension (PR #120040)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 01:06:53 PST 2024
================
@@ -12,21 +12,32 @@
// Subclass of SubtargetFeature to be used when the feature is also a RISC-V
// extension. Extensions have a version and may be experimental.
+// NOTE: The extension name must start with
+// - "FeatureStdExt" for standard extensions
+// - "FeatureVendor" for vendor-specific extensions
//
-// name - Name of the extension in lower case.
// major - Major version of extension.
// minor - Minor version of extension.
-// desc - Description of extension.
// implies - Extensions or features implied by this extension.
// fieldname - name of field to create in RISCVSubtarget. By default replaces
// uses the record name by replacing Feature with Has.
// value - Value to assign to the field in RISCVSubtarget when this
// extension is enabled. Usually "true", but can be changed.
-class RISCVExtension<string name, int major, int minor, string desc,
+// IsExperimental
+// - Indicates whether the extension is experimental
+class RISCVExtension<int major, int minor, string desc,
list<SubtargetFeature> implies = [],
string fieldname = !subst("Feature", "Has", NAME),
- string value = "true">
- : SubtargetFeature<name, fieldname, value, desc, implies> {
+ string value = "true", bit IsExperimental = false>
+ : SubtargetFeature<"", fieldname, value, "", implies> {
+ defvar N = !subst("FeatureVendor", "", !subst("FeatureStdExt", "", NAME));
----------------
wangpc-pp wrote:
These globals start with captical letter I think, but not for locals.
https://github.com/llvm/llvm-project/pull/120040
More information about the llvm-commits
mailing list