[llvm] [RISCV] Add extension information to RISCVFeatures.td. NFC (PR #89326)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 23:33:45 PDT 2024


================
@@ -10,119 +10,156 @@
 // RISC-V subtarget features and instruction predicates.
 //===----------------------------------------------------------------------===//
 
+// Subclass of SubtargetFeature to be used when the feature is also a RISC-V
+// extension. Extensions have a version and may be experimental.
+//
+// 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.
+// 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,
+                     list<SubtargetFeature> implies = [],
+                     string fieldname = !subst("Feature", "Has", NAME),
----------------
wangpc-pp wrote:

Please document this behavior in the description of parameter `fieldname`.

https://github.com/llvm/llvm-project/pull/89326


More information about the llvm-commits mailing list