diff --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst --- a/llvm/docs/WritingAnLLVMBackend.rst +++ b/llvm/docs/WritingAnLLVMBackend.rst @@ -1760,24 +1760,24 @@ TableGen uses definitions in the ``Target.td`` and ``Sparc.td`` files to generate code in ``SparcGenSubtarget.inc``. In ``Target.td``, shown below, the ``SubtargetFeature`` interface is defined. The first 4 string parameters of -the ``SubtargetFeature`` interface are a feature name, an attribute set by the -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.) +the ``SubtargetFeature`` interface are a feature name, a XXXSubtarget field set +by the feature, the value of the XXXSubtarget field, 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 +If the value for the field is the string "true" or "false", the field 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. +of an enum constant. If multiple features use the same integer field, the +field will be set to the maximum value of all enabled features that share +the field. .. code-block:: text - class SubtargetFeature i = []> { string Name = n; - string Attribute = a; + string FieldName = f; string Value = v; string Desc = d; list Implies = i; diff --git a/llvm/include/llvm/Target/Target.td b/llvm/include/llvm/Target/Target.td --- a/llvm/include/llvm/Target/Target.td +++ b/llvm/include/llvm/Target/Target.td @@ -1657,24 +1657,24 @@ //===----------------------------------------------------------------------===// // SubtargetFeature - A characteristic of the chip set. // -class SubtargetFeature i = []> { // Name - Feature name. Used by command line (-mattr=) to determine the // appropriate target chip. // string Name = n; - // Attribute - Attribute to be set by feature. + // FieldName - Field in XXXSubtarget to be set by feature. // - string Attribute = a; + string FieldName = f; - // Value - Value the attribute to be set to by feature. + // Value - Value the XXXSubtarget field to be set to by feature. // - // A value of "true" or "false" implies the attribute is a bool. Otherwise, + // A value of "true" or "false" implies the field 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. + // enum constant. If multiple features use the same integer field, the + // field will be set to the maximum value of all enabled features that + // share the field. // string Value = v; diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp --- a/llvm/utils/TableGen/SubtargetEmitter.cpp +++ b/llvm/utils/TableGen/SubtargetEmitter.cpp @@ -205,12 +205,12 @@ llvm::sort(FeatureList, LessRecordFieldName()); for (const Record *Feature : FeatureList) { - const StringRef Attribute = Feature->getValueAsString("Attribute"); + const StringRef FieldName = Feature->getValueAsString("FieldName"); const StringRef Value = Feature->getValueAsString("Value"); // Only handle boolean features for now, excluding BitVectors and enums. const bool IsBool = (Value == "false" || Value == "true") && - !StringRef(Attribute).contains('['); + !StringRef(FieldName).contains('['); if (!IsBool) continue; @@ -219,9 +219,9 @@ // Define the getter with lowercased first char: xxxYyy() { return XxxYyy; } const std::string Getter = - Attribute.substr(0, 1).lower() + Attribute.substr(1).str(); + FieldName.substr(0, 1).lower() + FieldName.substr(1).str(); - OS << "GET_SUBTARGETINFO_MACRO(" << Attribute << ", " << Default << ", " + OS << "GET_SUBTARGETINFO_MACRO(" << FieldName << ", " << Default << ", " << Getter << ")\n"; } OS << "#undef GET_SUBTARGETINFO_MACRO\n"; @@ -1804,17 +1804,17 @@ // Next record StringRef Instance = R->getName(); StringRef Value = R->getValueAsString("Value"); - StringRef Attribute = R->getValueAsString("Attribute"); + StringRef FieldName = R->getValueAsString("FieldName"); if (Value=="true" || Value=="false") OS << " if (Bits[" << Target << "::" << Instance << "]) " - << Attribute << " = " << Value << ";\n"; + << FieldName << " = " << Value << ";\n"; else OS << " if (Bits[" << Target << "::" << Instance << "] && " - << Attribute << " < " << Value << ") " - << Attribute << " = " << Value << ";\n"; + << FieldName << " < " << Value << ") " + << FieldName << " = " << Value << ";\n"; } OS << "}\n";