//===- DetailedRecordBackend.cpp - Detailed Records Report -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This Tablegen backend prints a report that includes all the global // variables, classes, and records in complete detail. It includes more // detail than the default TableGen printer backend. // //===----------------------------------------------------------------------===// #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include <string> #include <utility> usingnamespacellvm; namespace { class DetailedRecordsEmitter { … }; // emitter class } // anonymous namespace // Print the report. void DetailedRecordsEmitter::run(raw_ostream &OS) { … } // Print the report heading, including the source file name. void DetailedRecordsEmitter::printReportHeading(raw_ostream &OS) { … } // Print a section heading with the name of the section and the item count. void DetailedRecordsEmitter::printSectionHeading(StringRef Title, int Count, raw_ostream &OS) { … } // Print the global variables. void DetailedRecordsEmitter::printVariables(raw_ostream &OS) { … } // Print classes, including the template arguments, superclasses, and fields. void DetailedRecordsEmitter::printClasses(raw_ostream &OS) { … } // Print the records, including the defm sequences, supercasses, and fields. void DetailedRecordsEmitter::printRecords(raw_ostream &OS) { … } // Print memory allocation related stats. void DetailedRecordsEmitter::printAllocationStats(raw_ostream &OS) { … } // Print the record's defm source locations, if any. Note that they // are stored in the reverse order of their invocation. void DetailedRecordsEmitter::printDefms(const Record &Rec, raw_ostream &OS) { … } // Print the template arguments of a class. void DetailedRecordsEmitter::printTemplateArgs(const Record &Rec, raw_ostream &OS) { … } // Print the superclasses of a class or record. Indirect superclasses // are enclosed in parentheses. void DetailedRecordsEmitter::printSuperclasses(const Record &Rec, raw_ostream &OS) { … } // Print the fields of a class or record, including their source locations. void DetailedRecordsEmitter::printFields(const Record &Rec, raw_ostream &OS) { … } // This function is called by TableGen after parsing the files. void llvm::EmitDetailedRecords(const RecordKeeper &RK, raw_ostream &OS) { … }