mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 05:40:09 +00:00
[llvm][tblgen] Add Source Filename
for emitSourceFileHeader
(#65744)
I think this is very helpful for reading generated `.inc` files.
This commit is contained in:
parent
f74e274af7
commit
b0e28eb832
@ -169,7 +169,7 @@ void ClangASTNodesEmitter::deriveChildTree() {
|
|||||||
void ClangASTNodesEmitter::run(raw_ostream &OS) {
|
void ClangASTNodesEmitter::run(raw_ostream &OS) {
|
||||||
deriveChildTree();
|
deriveChildTree();
|
||||||
|
|
||||||
emitSourceFileHeader("List of AST nodes of a particular kind", OS);
|
emitSourceFileHeader("List of AST nodes of a particular kind", OS, Records);
|
||||||
|
|
||||||
// Write the preamble
|
// Write the preamble
|
||||||
OS << "#ifndef ABSTRACT_" << macroHierarchyName() << "\n";
|
OS << "#ifndef ABSTRACT_" << macroHierarchyName() << "\n";
|
||||||
@ -205,7 +205,7 @@ void clang::EmitClangASTNodes(RecordKeeper &RK, raw_ostream &OS,
|
|||||||
void clang::EmitClangDeclContext(RecordKeeper &Records, raw_ostream &OS) {
|
void clang::EmitClangDeclContext(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
// FIXME: Find a .td file format to allow for this to be represented better.
|
// FIXME: Find a .td file format to allow for this to be represented better.
|
||||||
|
|
||||||
emitSourceFileHeader("List of AST Decl nodes", OS);
|
emitSourceFileHeader("List of AST Decl nodes", OS, Records);
|
||||||
|
|
||||||
OS << "#ifndef DECL_CONTEXT\n";
|
OS << "#ifndef DECL_CONTEXT\n";
|
||||||
OS << "# define DECL_CONTEXT(DECL)\n";
|
OS << "# define DECL_CONTEXT(DECL)\n";
|
||||||
|
@ -593,7 +593,7 @@ void ASTPropsEmitter::emitWriteOfProperty(StringRef writerName,
|
|||||||
template <class NodeClass>
|
template <class NodeClass>
|
||||||
static void emitASTReader(RecordKeeper &records, raw_ostream &out,
|
static void emitASTReader(RecordKeeper &records, raw_ostream &out,
|
||||||
StringRef description) {
|
StringRef description) {
|
||||||
emitSourceFileHeader(description, out);
|
emitSourceFileHeader(description, out, records);
|
||||||
|
|
||||||
ASTPropsEmitter(records, out).emitNodeReaderClass<NodeClass>();
|
ASTPropsEmitter(records, out).emitNodeReaderClass<NodeClass>();
|
||||||
}
|
}
|
||||||
@ -607,7 +607,7 @@ void clang::EmitClangTypeReader(RecordKeeper &records, raw_ostream &out) {
|
|||||||
template <class NodeClass>
|
template <class NodeClass>
|
||||||
static void emitASTWriter(RecordKeeper &records, raw_ostream &out,
|
static void emitASTWriter(RecordKeeper &records, raw_ostream &out,
|
||||||
StringRef description) {
|
StringRef description) {
|
||||||
emitSourceFileHeader(description, out);
|
emitSourceFileHeader(description, out, records);
|
||||||
|
|
||||||
ASTPropsEmitter(records, out).emitNodeWriterClass<NodeClass>();
|
ASTPropsEmitter(records, out).emitNodeWriterClass<NodeClass>();
|
||||||
}
|
}
|
||||||
@ -852,7 +852,7 @@ void ASTPropsEmitter::emitBasicReaderWriterFile(const ReaderWriterInfo &info) {
|
|||||||
/// Emit an .inc file that defines some helper classes for reading
|
/// Emit an .inc file that defines some helper classes for reading
|
||||||
/// basic values.
|
/// basic values.
|
||||||
void clang::EmitClangBasicReader(RecordKeeper &records, raw_ostream &out) {
|
void clang::EmitClangBasicReader(RecordKeeper &records, raw_ostream &out) {
|
||||||
emitSourceFileHeader("Helper classes for BasicReaders", out);
|
emitSourceFileHeader("Helper classes for BasicReaders", out, records);
|
||||||
|
|
||||||
// Use any property, we won't be using those properties.
|
// Use any property, we won't be using those properties.
|
||||||
auto info = ReaderWriterInfo::forReader<TypeNode>();
|
auto info = ReaderWriterInfo::forReader<TypeNode>();
|
||||||
@ -862,7 +862,7 @@ void clang::EmitClangBasicReader(RecordKeeper &records, raw_ostream &out) {
|
|||||||
/// Emit an .inc file that defines some helper classes for writing
|
/// Emit an .inc file that defines some helper classes for writing
|
||||||
/// basic values.
|
/// basic values.
|
||||||
void clang::EmitClangBasicWriter(RecordKeeper &records, raw_ostream &out) {
|
void clang::EmitClangBasicWriter(RecordKeeper &records, raw_ostream &out) {
|
||||||
emitSourceFileHeader("Helper classes for BasicWriters", out);
|
emitSourceFileHeader("Helper classes for BasicWriters", out, records);
|
||||||
|
|
||||||
// Use any property, we won't be using those properties.
|
// Use any property, we won't be using those properties.
|
||||||
auto info = ReaderWriterInfo::forWriter<TypeNode>();
|
auto info = ReaderWriterInfo::forWriter<TypeNode>();
|
||||||
|
@ -2921,7 +2921,7 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
|
|||||||
}
|
}
|
||||||
// Emits the class definitions for attributes.
|
// Emits the class definitions for attributes.
|
||||||
void clang::EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
void clang::EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute classes' definitions", OS);
|
emitSourceFileHeader("Attribute classes' definitions", OS, Records);
|
||||||
|
|
||||||
OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
|
OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
|
||||||
OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
|
OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
|
||||||
@ -2933,7 +2933,8 @@ void clang::EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the class method definitions for attributes.
|
// Emits the class method definitions for attributes.
|
||||||
void clang::EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
void clang::EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute classes' member function definitions", OS);
|
emitSourceFileHeader("Attribute classes' member function definitions", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
emitAttributes(Records, OS, false);
|
emitAttributes(Records, OS, false);
|
||||||
|
|
||||||
@ -3169,7 +3170,8 @@ namespace clang {
|
|||||||
|
|
||||||
// Emits the enumeration list for attributes.
|
// Emits the enumeration list for attributes.
|
||||||
void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
|
emitSourceFileHeader("List of all attributes that Clang recognizes", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
AttrClassHierarchy Hierarchy(Records);
|
AttrClassHierarchy Hierarchy(Records);
|
||||||
|
|
||||||
@ -3211,7 +3213,8 @@ void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
void EmitClangAttrPrintList(const std::string &FieldName, RecordKeeper &Records,
|
void EmitClangAttrPrintList(const std::string &FieldName, RecordKeeper &Records,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
emitSourceFileHeader(
|
emitSourceFileHeader(
|
||||||
"List of attributes that can be print on the left side of a decl", OS);
|
"List of attributes that can be print on the left side of a decl", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
AttrClassHierarchy Hierarchy(Records);
|
AttrClassHierarchy Hierarchy(Records);
|
||||||
|
|
||||||
@ -3240,7 +3243,8 @@ void EmitClangAttrPrintList(const std::string &FieldName, RecordKeeper &Records,
|
|||||||
// Emits the enumeration list for attributes.
|
// Emits the enumeration list for attributes.
|
||||||
void EmitClangAttrSubjectMatchRuleList(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrSubjectMatchRuleList(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader(
|
emitSourceFileHeader(
|
||||||
"List of all attribute subject matching rules that Clang recognizes", OS);
|
"List of all attribute subject matching rules that Clang recognizes", OS,
|
||||||
|
Records);
|
||||||
PragmaClangAttributeSupport &PragmaAttributeSupport =
|
PragmaClangAttributeSupport &PragmaAttributeSupport =
|
||||||
getPragmaAttributeSupport(Records);
|
getPragmaAttributeSupport(Records);
|
||||||
emitDefaultDefine(OS, "ATTR_MATCH_RULE", nullptr);
|
emitDefaultDefine(OS, "ATTR_MATCH_RULE", nullptr);
|
||||||
@ -3250,7 +3254,7 @@ void EmitClangAttrSubjectMatchRuleList(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the code to read an attribute from a precompiled header.
|
// Emits the code to read an attribute from a precompiled header.
|
||||||
void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute deserialization code", OS);
|
emitSourceFileHeader("Attribute deserialization code", OS, Records);
|
||||||
|
|
||||||
Record *InhClass = Records.getClass("InheritableAttr");
|
Record *InhClass = Records.getClass("InheritableAttr");
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"),
|
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"),
|
||||||
@ -3305,7 +3309,7 @@ void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the code to write an attribute to a precompiled header.
|
// Emits the code to write an attribute to a precompiled header.
|
||||||
void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute serialization code", OS);
|
emitSourceFileHeader("Attribute serialization code", OS, Records);
|
||||||
|
|
||||||
Record *InhClass = Records.getClass("InheritableAttr");
|
Record *InhClass = Records.getClass("InheritableAttr");
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
||||||
@ -3506,7 +3510,8 @@ void EmitClangAttrTokenKinds(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the list of spellings for attributes.
|
// Emits the list of spellings for attributes.
|
||||||
void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Code to implement the __has_attribute logic", OS);
|
emitSourceFileHeader("Code to implement the __has_attribute logic", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
// Separate all of the attributes out into four group: generic, C++11, GNU,
|
// Separate all of the attributes out into four group: generic, C++11, GNU,
|
||||||
// and declspecs. Then generate a big switch statement for each of them.
|
// and declspecs. Then generate a big switch statement for each of them.
|
||||||
@ -3586,9 +3591,9 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Code to translate different attribute spellings "
|
emitSourceFileHeader("Code to translate different attribute spellings into "
|
||||||
"into internal identifiers",
|
"internal identifiers",
|
||||||
OS);
|
OS, Records);
|
||||||
|
|
||||||
OS << " switch (getParsedKind()) {\n";
|
OS << " switch (getParsedKind()) {\n";
|
||||||
OS << " case IgnoredAttribute:\n";
|
OS << " case IgnoredAttribute:\n";
|
||||||
@ -3618,7 +3623,8 @@ void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits code used by RecursiveASTVisitor to visit attributes
|
// Emits code used by RecursiveASTVisitor to visit attributes
|
||||||
void EmitClangAttrASTVisitor(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrASTVisitor(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Used by RecursiveASTVisitor to visit attributes.", OS);
|
emitSourceFileHeader("Used by RecursiveASTVisitor to visit attributes.", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||||
|
|
||||||
@ -3743,7 +3749,8 @@ void EmitClangAttrTemplateInstantiateHelper(const std::vector<Record *> &Attrs,
|
|||||||
|
|
||||||
// Emits code to instantiate dependent attributes on templates.
|
// Emits code to instantiate dependent attributes on templates.
|
||||||
void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Template instantiation code for attributes", OS);
|
emitSourceFileHeader("Template instantiation code for attributes", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||||
|
|
||||||
@ -3765,7 +3772,8 @@ void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the list of parsed attributes.
|
// Emits the list of parsed attributes.
|
||||||
void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
|
emitSourceFileHeader("List of all attributes that Clang recognizes", OS,
|
||||||
|
Records);
|
||||||
|
|
||||||
OS << "#ifndef PARSED_ATTR\n";
|
OS << "#ifndef PARSED_ATTR\n";
|
||||||
OS << "#define PARSED_ATTR(NAME) NAME\n";
|
OS << "#define PARSED_ATTR(NAME) NAME\n";
|
||||||
@ -4351,7 +4359,7 @@ static bool IsKnownToGCC(const Record &Attr) {
|
|||||||
|
|
||||||
/// Emits the parsed attribute helpers
|
/// Emits the parsed attribute helpers
|
||||||
void EmitClangAttrParsedAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrParsedAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Parsed attribute helpers", OS);
|
emitSourceFileHeader("Parsed attribute helpers", OS, Records);
|
||||||
|
|
||||||
OS << "#if !defined(WANT_DECL_MERGE_LOGIC) && "
|
OS << "#if !defined(WANT_DECL_MERGE_LOGIC) && "
|
||||||
<< "!defined(WANT_STMT_MERGE_LOGIC)\n";
|
<< "!defined(WANT_STMT_MERGE_LOGIC)\n";
|
||||||
@ -4513,7 +4521,7 @@ void EmitClangAttrParsedAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the kind list of parsed attributes
|
// Emits the kind list of parsed attributes
|
||||||
void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute name matcher", OS);
|
emitSourceFileHeader("Attribute name matcher", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
|
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||||
std::vector<StringMatcher::StringPair> GNU, Declspec, Microsoft, CXX11,
|
std::vector<StringMatcher::StringPair> GNU, Declspec, Microsoft, CXX11,
|
||||||
@ -4614,7 +4622,7 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emits the code to dump an attribute.
|
// Emits the code to dump an attribute.
|
||||||
void EmitClangAttrTextNodeDump(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrTextNodeDump(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute text node dumper", OS);
|
emitSourceFileHeader("Attribute text node dumper", OS, Records);
|
||||||
|
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
||||||
for (const auto *Attr : Attrs) {
|
for (const auto *Attr : Attrs) {
|
||||||
@ -4653,7 +4661,7 @@ void EmitClangAttrTextNodeDump(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitClangAttrNodeTraverse(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrNodeTraverse(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute text node traverser", OS);
|
emitSourceFileHeader("Attribute text node traverser", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
||||||
for (const auto *Attr : Attrs) {
|
for (const auto *Attr : Attrs) {
|
||||||
@ -4682,7 +4690,7 @@ void EmitClangAttrNodeTraverse(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitClangAttrParserStringSwitches(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrParserStringSwitches(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Parser-related llvm::StringSwitch cases", OS);
|
emitSourceFileHeader("Parser-related llvm::StringSwitch cases", OS, Records);
|
||||||
emitClangAttrArgContextList(Records, OS);
|
emitClangAttrArgContextList(Records, OS);
|
||||||
emitClangAttrIdentifierArgList(Records, OS);
|
emitClangAttrIdentifierArgList(Records, OS);
|
||||||
emitClangAttrUnevaluatedStringLiteralList(Records, OS);
|
emitClangAttrUnevaluatedStringLiteralList(Records, OS);
|
||||||
@ -4699,7 +4707,7 @@ void EmitClangAttrSubjectMatchRulesParserStringSwitches(RecordKeeper &Records,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitClangAttrDocTable(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrDocTable(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Clang attribute documentation", OS);
|
emitSourceFileHeader("Clang attribute documentation", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
|
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||||
for (const auto *A : Attrs) {
|
for (const auto *A : Attrs) {
|
||||||
|
@ -22,9 +22,8 @@ using namespace llvm;
|
|||||||
|
|
||||||
void clang::EmitClangCommentCommandInfo(RecordKeeper &Records,
|
void clang::EmitClangCommentCommandInfo(RecordKeeper &Records,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
emitSourceFileHeader("A list of commands useable in documentation "
|
emitSourceFileHeader("A list of commands useable in documentation comments",
|
||||||
"comments",
|
OS, Records);
|
||||||
OS);
|
|
||||||
|
|
||||||
OS << "namespace {\n"
|
OS << "namespace {\n"
|
||||||
"const CommandInfo Commands[] = {\n";
|
"const CommandInfo Commands[] = {\n";
|
||||||
@ -116,9 +115,8 @@ static std::string MangleName(StringRef Str) {
|
|||||||
|
|
||||||
void clang::EmitClangCommentCommandList(RecordKeeper &Records,
|
void clang::EmitClangCommentCommandList(RecordKeeper &Records,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
emitSourceFileHeader("A list of commands useable in documentation "
|
emitSourceFileHeader("A list of commands useable in documentation comments",
|
||||||
"comments",
|
OS, Records);
|
||||||
OS);
|
|
||||||
|
|
||||||
OS << "#ifndef COMMENT_COMMAND\n"
|
OS << "#ifndef COMMENT_COMMAND\n"
|
||||||
<< "# define COMMENT_COMMAND(NAME)\n"
|
<< "# define COMMENT_COMMAND(NAME)\n"
|
||||||
|
@ -70,9 +70,8 @@ void clang::EmitClangCommentHTMLNamedCharacterReferences(RecordKeeper &Records,
|
|||||||
NameToUTF8.push_back(Match);
|
NameToUTF8.push_back(Match);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitSourceFileHeader("HTML named character reference to UTF-8 "
|
emitSourceFileHeader("HTML named character reference to UTF-8 translation",
|
||||||
"translation",
|
OS, Records);
|
||||||
OS);
|
|
||||||
|
|
||||||
OS << "StringRef translateHTMLNamedCharacterReferenceToUTF8(\n"
|
OS << "StringRef translateHTMLNamedCharacterReferenceToUTF8(\n"
|
||||||
" StringRef Name) {\n";
|
" StringRef Name) {\n";
|
||||||
|
@ -27,7 +27,7 @@ void clang::EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
"return true;");
|
"return true;");
|
||||||
}
|
}
|
||||||
|
|
||||||
emitSourceFileHeader("HTML tag name matcher", OS);
|
emitSourceFileHeader("HTML tag name matcher", OS, Records);
|
||||||
|
|
||||||
OS << "bool isHTMLTagName(StringRef Name) {\n";
|
OS << "bool isHTMLTagName(StringRef Name) {\n";
|
||||||
StringMatcher("Name", Matches, OS).Emit();
|
StringMatcher("Name", Matches, OS).Emit();
|
||||||
@ -49,7 +49,7 @@ void clang::EmitClangCommentHTMLTagsProperties(RecordKeeper &Records,
|
|||||||
MatchesEndTagForbidden.push_back(Match);
|
MatchesEndTagForbidden.push_back(Match);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitSourceFileHeader("HTML tag properties", OS);
|
emitSourceFileHeader("HTML tag properties", OS, Records);
|
||||||
|
|
||||||
OS << "bool isHTMLEndTagOptional(StringRef Name) {\n";
|
OS << "bool isHTMLEndTagOptional(StringRef Name) {\n";
|
||||||
StringMatcher("Name", MatchesEndTagOptional, OS).Emit();
|
StringMatcher("Name", MatchesEndTagOptional, OS).Emit();
|
||||||
|
@ -339,7 +339,7 @@ public:
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void BuiltinNameEmitter::Emit() {
|
void BuiltinNameEmitter::Emit() {
|
||||||
emitSourceFileHeader("OpenCL Builtin handling", OS);
|
emitSourceFileHeader("OpenCL Builtin handling", OS, Records);
|
||||||
|
|
||||||
OS << "#include \"llvm/ADT/StringRef.h\"\n";
|
OS << "#include \"llvm/ADT/StringRef.h\"\n";
|
||||||
OS << "using namespace clang;\n\n";
|
OS << "using namespace clang;\n\n";
|
||||||
@ -1215,7 +1215,7 @@ StringRef OpenCLBuiltinFileEmitterBase::emitTypeExtensionGuards(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenCLBuiltinTestEmitter::emit() {
|
void OpenCLBuiltinTestEmitter::emit() {
|
||||||
emitSourceFileHeader("OpenCL Builtin exhaustive testing", OS);
|
emitSourceFileHeader("OpenCL Builtin exhaustive testing", OS, Records);
|
||||||
|
|
||||||
emitExtensionSetup();
|
emitExtensionSetup();
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ void OpenCLBuiltinTestEmitter::emit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenCLBuiltinHeaderEmitter::emit() {
|
void OpenCLBuiltinHeaderEmitter::emit() {
|
||||||
emitSourceFileHeader("OpenCL Builtin declarations", OS);
|
emitSourceFileHeader("OpenCL Builtin declarations", OS, Records);
|
||||||
|
|
||||||
emitExtensionSetup();
|
emitExtensionSetup();
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ struct SyntaxConstraint {
|
|||||||
|
|
||||||
void clang::EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
|
void clang::EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
|
||||||
llvm::raw_ostream &OS) {
|
llvm::raw_ostream &OS) {
|
||||||
llvm::emitSourceFileHeader("Syntax tree node list", OS);
|
llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
|
||||||
Hierarchy H(Records);
|
Hierarchy H(Records);
|
||||||
OS << R"cpp(
|
OS << R"cpp(
|
||||||
#ifndef NODE
|
#ifndef NODE
|
||||||
@ -188,7 +188,7 @@ static void printDoc(llvm::StringRef Doc, llvm::raw_ostream &OS) {
|
|||||||
|
|
||||||
void clang::EmitClangSyntaxNodeClasses(llvm::RecordKeeper &Records,
|
void clang::EmitClangSyntaxNodeClasses(llvm::RecordKeeper &Records,
|
||||||
llvm::raw_ostream &OS) {
|
llvm::raw_ostream &OS) {
|
||||||
llvm::emitSourceFileHeader("Syntax tree node list", OS);
|
llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
|
||||||
Hierarchy H(Records);
|
Hierarchy H(Records);
|
||||||
|
|
||||||
OS << "\n// Forward-declare node types so we don't have to carefully "
|
OS << "\n// Forward-declare node types so we don't have to carefully "
|
||||||
|
@ -104,7 +104,7 @@ void TypeNodeEmitter::emit() {
|
|||||||
if (Types.empty())
|
if (Types.empty())
|
||||||
PrintFatalError("no Type records in input!");
|
PrintFatalError("no Type records in input!");
|
||||||
|
|
||||||
emitSourceFileHeader("An x-macro database of Clang type nodes", Out);
|
emitSourceFileHeader("An x-macro database of Clang type nodes", Out, Records);
|
||||||
|
|
||||||
// Preamble
|
// Preamble
|
||||||
addMacroToUndef(TypeMacroName);
|
addMacroToUndef(TypeMacroName);
|
||||||
|
@ -171,7 +171,7 @@ static void emitOptions(std::string Command, std::vector<Record *> Records,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lldb_private::EmitOptionDefs(RecordKeeper &Records, raw_ostream &OS) {
|
void lldb_private::EmitOptionDefs(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Options for LLDB command line commands.", OS);
|
emitSourceFileHeader("Options for LLDB command line commands.", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Options = Records.getAllDerivedDefinitions("Option");
|
std::vector<Record *> Options = Records.getAllDerivedDefinitions("Option");
|
||||||
for (auto &CommandRecordPair : getRecordsByName(Options, "Command")) {
|
for (auto &CommandRecordPair : getRecordsByName(Options, "Command")) {
|
||||||
|
@ -168,7 +168,7 @@ static void emitPropertyEnum(std::string PropertyName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lldb_private::EmitPropertyDefs(RecordKeeper &Records, raw_ostream &OS) {
|
void lldb_private::EmitPropertyDefs(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Property definitions for LLDB.", OS);
|
emitSourceFileHeader("Property definitions for LLDB.", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Properties =
|
std::vector<Record *> Properties =
|
||||||
Records.getAllDerivedDefinitions("Property");
|
Records.getAllDerivedDefinitions("Property");
|
||||||
@ -179,7 +179,7 @@ void lldb_private::EmitPropertyDefs(RecordKeeper &Records, raw_ostream &OS) {
|
|||||||
|
|
||||||
void lldb_private::EmitPropertyEnumDefs(RecordKeeper &Records,
|
void lldb_private::EmitPropertyEnumDefs(RecordKeeper &Records,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Property definition enum for LLDB.", OS);
|
emitSourceFileHeader("Property definition enum for LLDB.", OS, Records);
|
||||||
|
|
||||||
std::vector<Record *> Properties =
|
std::vector<Record *> Properties =
|
||||||
Records.getAllDerivedDefinitions("Property");
|
Records.getAllDerivedDefinitions("Property");
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
#include "llvm/TableGen/Record.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ public:
|
|||||||
|
|
||||||
/// emitSourceFileHeader - Output an LLVM style file header to the specified
|
/// emitSourceFileHeader - Output an LLVM style file header to the specified
|
||||||
/// raw_ostream.
|
/// raw_ostream.
|
||||||
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
|
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
|
||||||
|
const RecordKeeper &Record = RecordKeeper());
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "llvm/TableGen/TableGenBackend.h"
|
#include "llvm/TableGen/TableGenBackend.h"
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
|
#include "llvm/Support/Path.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -40,7 +41,8 @@ static void printLine(raw_ostream &OS, const Twine &Prefix, char Fill,
|
|||||||
OS << Suffix << '\n';
|
OS << Suffix << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) {
|
void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
|
||||||
|
const RecordKeeper &Record) {
|
||||||
printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\");
|
printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\");
|
||||||
StringRef Prefix("|* ");
|
StringRef Prefix("|* ");
|
||||||
StringRef Suffix(" *|");
|
StringRef Suffix(" *|");
|
||||||
@ -56,6 +58,12 @@ void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) {
|
|||||||
printLine(OS, Prefix, ' ', Suffix);
|
printLine(OS, Prefix, ' ', Suffix);
|
||||||
printLine(OS, Prefix + "Automatically generated file, do not edit!", ' ',
|
printLine(OS, Prefix + "Automatically generated file, do not edit!", ' ',
|
||||||
Suffix);
|
Suffix);
|
||||||
|
|
||||||
|
// Print the filename of source file
|
||||||
|
if (!Record.getInputFilename().empty())
|
||||||
|
printLine(
|
||||||
|
OS, Prefix + "From: " + sys::path::filename(Record.getInputFilename()),
|
||||||
|
' ', Suffix);
|
||||||
printLine(OS, Prefix, ' ', Suffix);
|
printLine(OS, Prefix, ' ', Suffix);
|
||||||
printLine(OS, "\\*===", '-', "===*/");
|
printLine(OS, "\\*===", '-', "===*/");
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
|
@ -3204,7 +3204,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
Record *AsmParser = Target.getAsmParser();
|
Record *AsmParser = Target.getAsmParser();
|
||||||
StringRef ClassName = AsmParser->getValueAsString("AsmParserClassName");
|
StringRef ClassName = AsmParser->getValueAsString("AsmParserClassName");
|
||||||
|
|
||||||
emitSourceFileHeader("Assembly Matcher Source Fragment", OS);
|
emitSourceFileHeader("Assembly Matcher Source Fragment", OS, Records);
|
||||||
|
|
||||||
// Compute the information on the instructions to match.
|
// Compute the information on the instructions to match.
|
||||||
AsmMatcherInfo Info(AsmParser, Target, Records);
|
AsmMatcherInfo Info(AsmParser, Target, Records);
|
||||||
|
@ -1302,7 +1302,7 @@ void AsmWriterEmitter::run(raw_ostream &O) {
|
|||||||
std::vector<std::vector<std::string>> TableDrivenOperandPrinters;
|
std::vector<std::vector<std::string>> TableDrivenOperandPrinters;
|
||||||
unsigned BitsLeft = 0;
|
unsigned BitsLeft = 0;
|
||||||
unsigned AsmStrBits = 0;
|
unsigned AsmStrBits = 0;
|
||||||
emitSourceFileHeader("Assembly Writer Source Fragment", O);
|
emitSourceFileHeader("Assembly Writer Source Fragment", O, Records);
|
||||||
EmitGetMnemonic(O, TableDrivenOperandPrinters, BitsLeft, AsmStrBits);
|
EmitGetMnemonic(O, TableDrivenOperandPrinters, BitsLeft, AsmStrBits);
|
||||||
EmitPrintInstruction(O, TableDrivenOperandPrinters, BitsLeft, AsmStrBits);
|
EmitPrintInstruction(O, TableDrivenOperandPrinters, BitsLeft, AsmStrBits);
|
||||||
EmitGetRegisterName(O);
|
EmitGetRegisterName(O);
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
void VTEmitter::run(raw_ostream &OS) {
|
void VTEmitter::run(raw_ostream &OS) {
|
||||||
emitSourceFileHeader("ValueTypes Source Fragment", OS);
|
emitSourceFileHeader("ValueTypes Source Fragment", OS, Records);
|
||||||
|
|
||||||
std::array<const Record *, 256> VTsByNumber = {};
|
std::array<const Record *, 256> VTsByNumber = {};
|
||||||
auto ValueTypes = Records.getAllDerivedDefinitions("ValueType");
|
auto ValueTypes = Records.getAllDerivedDefinitions("ValueType");
|
||||||
|
@ -229,7 +229,7 @@ static void emitDialectDecl(Dialect &dialect, raw_ostream &os) {
|
|||||||
|
|
||||||
static bool emitDialectDecls(const llvm::RecordKeeper &recordKeeper,
|
static bool emitDialectDecls(const llvm::RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
emitSourceFileHeader("Dialect Declarations", os);
|
emitSourceFileHeader("Dialect Declarations", os, recordKeeper);
|
||||||
|
|
||||||
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
|
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
|
||||||
if (dialectDefs.empty())
|
if (dialectDefs.empty())
|
||||||
@ -300,7 +300,7 @@ static void emitDialectDef(Dialect &dialect, raw_ostream &os) {
|
|||||||
|
|
||||||
static bool emitDialectDefs(const llvm::RecordKeeper &recordKeeper,
|
static bool emitDialectDefs(const llvm::RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
emitSourceFileHeader("Dialect Definitions", os);
|
emitSourceFileHeader("Dialect Definitions", os, recordKeeper);
|
||||||
|
|
||||||
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
|
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
|
||||||
if (dialectDefs.empty())
|
if (dialectDefs.empty())
|
||||||
|
@ -643,7 +643,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("Enum Utility Declarations", os);
|
llvm::emitSourceFileHeader("Enum Utility Declarations", os, recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
|
auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
|
||||||
for (const auto *def : defs)
|
for (const auto *def : defs)
|
||||||
@ -681,7 +681,7 @@ static void emitEnumDef(const Record &enumDef, raw_ostream &os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("Enum Utility Definitions", os);
|
llvm::emitSourceFileHeader("Enum Utility Definitions", os, recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
|
auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
|
||||||
for (const auto *def : defs)
|
for (const auto *def : defs)
|
||||||
|
@ -249,7 +249,7 @@ static bool emitIntrinsic(const llvm::Record &record, llvm::raw_ostream &os) {
|
|||||||
/// the name matching the filter.
|
/// the name matching the filter.
|
||||||
static bool emitIntrinsics(const llvm::RecordKeeper &records,
|
static bool emitIntrinsics(const llvm::RecordKeeper &records,
|
||||||
llvm::raw_ostream &os) {
|
llvm::raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("Operations for LLVM intrinsics", os);
|
llvm::emitSourceFileHeader("Operations for LLVM intrinsics", os, records);
|
||||||
os << "include \"mlir/Dialect/LLVMIR/LLVMOpBase.td\"\n";
|
os << "include \"mlir/Dialect/LLVMIR/LLVMOpBase.td\"\n";
|
||||||
os << "include \"mlir/Interfaces/SideEffectInterfaces.td\"\n\n";
|
os << "include \"mlir/Interfaces/SideEffectInterfaces.td\"\n\n";
|
||||||
|
|
||||||
|
@ -4225,7 +4225,7 @@ static void emitOpList(const std::vector<Record *> &defs, raw_ostream &os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitOpDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitOpDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
emitSourceFileHeader("Op Declarations", os);
|
emitSourceFileHeader("Op Declarations", os, recordKeeper);
|
||||||
|
|
||||||
std::vector<Record *> defs = getRequestedOpDefinitions(recordKeeper);
|
std::vector<Record *> defs = getRequestedOpDefinitions(recordKeeper);
|
||||||
emitOpClasses(recordKeeper, defs, os, /*emitDecl=*/true);
|
emitOpClasses(recordKeeper, defs, os, /*emitDecl=*/true);
|
||||||
@ -4234,7 +4234,7 @@ static bool emitOpDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitOpDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitOpDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
emitSourceFileHeader("Op Definitions", os);
|
emitSourceFileHeader("Op Definitions", os, recordKeeper);
|
||||||
|
|
||||||
std::vector<Record *> defs = getRequestedOpDefinitions(recordKeeper);
|
std::vector<Record *> defs = getRequestedOpDefinitions(recordKeeper);
|
||||||
emitOpList(defs, os);
|
emitOpList(defs, os);
|
||||||
|
@ -1873,7 +1873,7 @@ StringRef StaticMatcherHelper::getVerifierName(DagLeaf leaf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void emitRewriters(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static void emitRewriters(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
emitSourceFileHeader("Rewriters", os);
|
emitSourceFileHeader("Rewriters", os, recordKeeper);
|
||||||
|
|
||||||
const auto &patterns = recordKeeper.getAllDerivedDefinitions("Pattern");
|
const auto &patterns = recordKeeper.getAllDerivedDefinitions("Pattern");
|
||||||
|
|
||||||
|
@ -197,7 +197,8 @@ static void emitInterfaceDef(const Availability &availability,
|
|||||||
|
|
||||||
static bool emitInterfaceDefs(const RecordKeeper &recordKeeper,
|
static bool emitInterfaceDefs(const RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("Availability Interface Definitions", os);
|
llvm::emitSourceFileHeader("Availability Interface Definitions", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("Availability");
|
auto defs = recordKeeper.getAllDerivedDefinitions("Availability");
|
||||||
SmallVector<const Record *, 1> handledClasses;
|
SmallVector<const Record *, 1> handledClasses;
|
||||||
@ -286,7 +287,8 @@ static void emitInterfaceDecl(const Availability &availability,
|
|||||||
|
|
||||||
static bool emitInterfaceDecls(const RecordKeeper &recordKeeper,
|
static bool emitInterfaceDecls(const RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("Availability Interface Declarations", os);
|
llvm::emitSourceFileHeader("Availability Interface Declarations", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("Availability");
|
auto defs = recordKeeper.getAllDerivedDefinitions("Availability");
|
||||||
SmallVector<const Record *, 4> handledClasses;
|
SmallVector<const Record *, 4> handledClasses;
|
||||||
@ -449,7 +451,8 @@ static void emitEnumDecl(const Record &enumDef, raw_ostream &os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Enum Availability Declarations", os);
|
llvm::emitSourceFileHeader("SPIR-V Enum Availability Declarations", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
||||||
for (const auto *def : defs)
|
for (const auto *def : defs)
|
||||||
@ -480,7 +483,8 @@ static void emitEnumDef(const Record &enumDef, raw_ostream &os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Enum Availability Definitions", os);
|
llvm::emitSourceFileHeader("SPIR-V Enum Availability Definitions", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
||||||
for (const auto *def : defs)
|
for (const auto *def : defs)
|
||||||
@ -1178,7 +1182,8 @@ emitExtendedSetDeserializationDispatch(const RecordKeeper &recordKeeper,
|
|||||||
/// SPIRV_Ops.
|
/// SPIRV_Ops.
|
||||||
static bool emitSerializationFns(const RecordKeeper &recordKeeper,
|
static bool emitSerializationFns(const RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Serialization Utilities/Functions", os);
|
llvm::emitSourceFileHeader("SPIR-V Serialization Utilities/Functions", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
std::string dSerFnString, dDesFnString, serFnString, deserFnString,
|
std::string dSerFnString, dDesFnString, serFnString, deserFnString,
|
||||||
utilsString;
|
utilsString;
|
||||||
@ -1257,7 +1262,7 @@ static void emitEnumGetAttrNameFnDefn(const EnumAttr &enumAttr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool emitAttrUtils(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
static bool emitAttrUtils(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Attribute Utilities", os);
|
llvm::emitSourceFileHeader("SPIR-V Attribute Utilities", os, recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
auto defs = recordKeeper.getAllDerivedDefinitions("EnumAttrInfo");
|
||||||
os << "#ifndef MLIR_DIALECT_SPIRV_IR_ATTR_UTILS_H_\n";
|
os << "#ifndef MLIR_DIALECT_SPIRV_IR_ATTR_UTILS_H_\n";
|
||||||
@ -1402,7 +1407,8 @@ static void emitAvailabilityImpl(const Operator &srcOp, raw_ostream &os) {
|
|||||||
|
|
||||||
static bool emitAvailabilityImpl(const RecordKeeper &recordKeeper,
|
static bool emitAvailabilityImpl(const RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Op Availability Implementations", os);
|
llvm::emitSourceFileHeader("SPIR-V Op Availability Implementations", os,
|
||||||
|
recordKeeper);
|
||||||
|
|
||||||
auto defs = recordKeeper.getAllDerivedDefinitions("SPIRV_Op");
|
auto defs = recordKeeper.getAllDerivedDefinitions("SPIRV_Op");
|
||||||
for (const auto *def : defs) {
|
for (const auto *def : defs) {
|
||||||
@ -1430,7 +1436,7 @@ static mlir::GenRegistration
|
|||||||
|
|
||||||
static bool emitCapabilityImplication(const RecordKeeper &recordKeeper,
|
static bool emitCapabilityImplication(const RecordKeeper &recordKeeper,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
llvm::emitSourceFileHeader("SPIR-V Capability Implication", os);
|
llvm::emitSourceFileHeader("SPIR-V Capability Implication", os, recordKeeper);
|
||||||
|
|
||||||
EnumAttr enumAttr(
|
EnumAttr enumAttr(
|
||||||
recordKeeper.getDef("SPIRV_CapabilityAttr")->getValueAsDef("enum"));
|
recordKeeper.getDef("SPIRV_CapabilityAttr")->getValueAsDef("enum"));
|
||||||
|
Loading…
Reference in New Issue
Block a user