#include "DialectGenUtilities.h"
#include "DocGenUtilities.h"
#include "OpGenHelpers.h"
#include "mlir/Support/IndentedOstream.h"
#include "mlir/TableGen/AttrOrTypeDef.h"
#include "mlir/TableGen/Attribute.h"
#include "mlir/TableGen/GenInfo.h"
#include "mlir/TableGen/Operator.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <set>
#include <string>
static llvm::cl::OptionCategory
docCat("Options for -gen-(attrdef|typedef|enum|op|dialect)-doc");
llvm::cl::opt<std::string>
stripPrefix("strip-prefix",
llvm::cl::desc("Strip prefix of the fully qualified names"),
llvm::cl::init("::mlir::"), llvm::cl::cat(docCat));
llvm::cl::opt<bool> allowHugoSpecificFeatures(
"allow-hugo-specific-features",
llvm::cl::desc("Allows using features specific to Hugo"),
llvm::cl::init(false), llvm::cl::cat(docCat));
usingnamespacellvm;
usingnamespacemlir;
usingnamespacemlir::tblgen;
Operator;
void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) { … }
void mlir::tblgen::emitDescription(StringRef description, raw_ostream &os) { … }
void mlir::tblgen::emitDescriptionComment(StringRef description,
raw_ostream &os, StringRef prefix) { … }
static void emitIfNotEmpty(StringRef str, raw_ostream &os) { … }
template <typename T>
static void emitNamedConstraint(const T &it, raw_ostream &os) { … }
static void emitAssemblyFormat(StringRef opName, StringRef format,
raw_ostream &os) { … }
static std::string backticks(const std::string &text) { … }
static void emitOpTraitsDoc(const Operator &op, raw_ostream &os) { … }
static StringRef resolveAttrDescription(const Attribute &attr) { … }
static void emitOpDoc(const Operator &op, raw_ostream &os) { … }
static void emitSourceLink(StringRef inputFilename, raw_ostream &os) { … }
static void emitOpDoc(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
static void emitAttrDoc(const Attribute &attr, raw_ostream &os) { … }
static void emitTypeDoc(const Type &type, raw_ostream &os) { … }
static void emitAttrOrTypeDefAssemblyFormat(const AttrOrTypeDef &def,
raw_ostream &os) { … }
static void emitAttrOrTypeDefDoc(const AttrOrTypeDef &def, raw_ostream &os) { … }
static void emitAttrOrTypeDefDoc(const RecordKeeper &recordKeeper,
raw_ostream &os, StringRef recordTypeName) { … }
static void emitEnumDoc(const EnumAttr &def, raw_ostream &os) { … }
static void emitEnumDoc(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
struct OpDocGroup { … };
static void maybeNest(bool nest, llvm::function_ref<void(raw_ostream &os)> fn,
raw_ostream &os) { … }
static void emitBlock(ArrayRef<Attribute> attributes, StringRef inputFilename,
ArrayRef<AttrDef> attrDefs, ArrayRef<OpDocGroup> ops,
ArrayRef<Type> types, ArrayRef<TypeDef> typeDefs,
ArrayRef<EnumAttr> enums, raw_ostream &os) { … }
static void emitDialectDoc(const Dialect &dialect, StringRef inputFilename,
ArrayRef<Attribute> attributes,
ArrayRef<AttrDef> attrDefs, ArrayRef<OpDocGroup> ops,
ArrayRef<Type> types, ArrayRef<TypeDef> typeDefs,
ArrayRef<EnumAttr> enums, raw_ostream &os) { … }
static bool emitDialectDoc(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
static mlir::GenRegistration
genAttrRegister("gen-attrdef-doc",
"Generate dialect attribute documentation",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genOpRegister("gen-op-doc", "Generate dialect documentation",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genTypeRegister("gen-typedef-doc", "Generate dialect type documentation",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genEnumRegister("gen-enum-doc", "Generate dialect enum documentation",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genRegister("gen-dialect-doc", "Generate dialect documentation",
[](const RecordKeeper &records, raw_ostream &os) { … });