[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)

Tomas Matheson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 06:57:24 PDT 2024


================
@@ -14,23 +14,36 @@
 class Extension<
   string TargetFeatureName,            // String used for -target-feature and -march, unless overridden.
   string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
+  string ArchitectureFeatureName,      // The extension's "FEAT_*"" name(s) defined by the architecture
   string Desc,                         // Description.
   list<SubtargetFeature> Implies = []  // List of dependent features.
 > : SubtargetFeature<TargetFeatureName, "Has" # Spelling, "true", Desc, Implies>
 {
     string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
 
-    // In general, the name written on the command line should match the name
-    // used for -target-feature. However, there are exceptions. Therefore we
-    // add a separate field for this, to allow overriding it. Strongly prefer
-    // not doing so.
-    string MArchName = TargetFeatureName;
+    string ArchFeatureName = ArchitectureFeatureName;
+
+    // By default, extensions are available as -march/-cpu command line options.
+    string MArchName = "";
 
     // An alias that can be used on the command line, if the extension has one.
     // Used for correcting historical names while remaining backwards compatible.
     string MArchAlias = "";
 }
 
+class ExtensionWithMArch<
----------------
tmatheson-arm wrote:

```suggestion
// An Extension that can be enabled via a `-march` modifier or target attribute, e.g. `+sm4`
class ExtensionWithMArch<
```

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


More information about the llvm-commits mailing list