[llvm] b1cab31 - [docs][TableGen][Target] Improve the documentation of the attribute value for SubtargetFeature.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 20 20:57:48 PDT 2023
Author: Craig Topper
Date: 2023-06-20T20:57:36-07:00
New Revision: b1cab310739cd9f14e094b73dfe8301b8bb83b70
URL: https://github.com/llvm/llvm-project/commit/b1cab310739cd9f14e094b73dfe8301b8bb83b70
DIFF: https://github.com/llvm/llvm-project/commit/b1cab310739cd9f14e094b73dfe8301b8bb83b70.diff
LOG: [docs][TableGen][Target] Improve the documentation of the attribute value for SubtargetFeature.
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
Added:
Modified:
llvm/docs/WritingAnLLVMBackend.rst
llvm/include/llvm/Target/Target.td
Removed:
################################################################################
diff --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst
index c270164444b4b..12da372520af8 100644
--- a/llvm/docs/WritingAnLLVMBackend.rst
+++ b/llvm/docs/WritingAnLLVMBackend.rst
@@ -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,
diff --git a/llvm/include/llvm/Target/Target.td b/llvm/include/llvm/Target/Target.td
index d71336466b5c6..5db0ec675051a 100644
--- a/llvm/include/llvm/Target/Target.td
+++ b/llvm/include/llvm/Target/Target.td
@@ -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
More information about the llvm-commits
mailing list