[docs][TableGen][Target] Improve the documentation of the attribute value for Subtarg...
authorCraig Topper <craig.topper@sifive.com>
Wed, 21 Jun 2023 03:45:28 +0000 (20:45 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 21 Jun 2023 03:57:36 +0000 (20:57 -0700)
The value "true" and "false" are treated specially and other values are treated as integers.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153180

llvm/docs/WritingAnLLVMBackend.rst
llvm/include/llvm/Target/Target.td

index c270164..12da372 100644 (file)
@@ -1765,6 +1765,13 @@ feature, the value of the attribute, and a description of the feature.  (The
 fifth parameter is a list of features whose presence is implied, and its
 default value is an empty array.)
 
+If the value for the attribute is the string "true" or "false", the attribute
+is assumed to be a bool and only one SubtargetFeature should refer to it.
+Otherwise, it is assumed to be an integer. The integer value may be the name
+of an enum constant. If multiple features use the same integer attribute, the
+attribute will be set to the maximum value of all enabled features that share
+the attribute.
+
 .. code-block:: text
 
   class SubtargetFeature<string n, string a, string v, string d,
index d713364..5db0ec6 100644 (file)
@@ -1670,6 +1670,12 @@ class SubtargetFeature<string n, string a,  string v, string d,
 
   // Value - Value the attribute to be set to by feature.
   //
+  // A value of "true" or "false" implies the attribute is a bool. Otherwise,
+  // it is assumed to be an integer. the integer value may be the name of an
+  // enum constant. If multiple features use the same integer attribute, the
+  // attribute will be set to the maximum value of all enabled features that
+  // share the attribute.
+  //
   string Value = v;
 
   // Desc - Feature description.  Used by command line (-mattr=) to display help