#include "DialectGenUtilities.h"
#include "mlir/TableGen/Class.h"
#include "mlir/TableGen/CodeGenHelpers.h"
#include "mlir/TableGen/Format.h"
#include "mlir/TableGen/GenInfo.h"
#include "mlir/TableGen/Interfaces.h"
#include "mlir/TableGen/Operator.h"
#include "mlir/TableGen/Trait.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Signals.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#define DEBUG_TYPE …
usingnamespacemlir;
usingnamespacemlir::tblgen;
static llvm::cl::OptionCategory dialectGenCat("Options for -gen-dialect-*");
llvm::cl::opt<std::string>
selectedDialect("dialect", llvm::cl::desc("The dialect to gen for"),
llvm::cl::cat(dialectGenCat), llvm::cl::CommaSeparated);
namespace {
DialectFilterIterator;
}
static void populateDiscardableAttributes(
Dialect &dialect, llvm::DagInit *discardableAttrDag,
SmallVector<std::pair<std::string, std::string>> &discardableAttributes) { … }
template <typename T>
static iterator_range<DialectFilterIterator>
filterForDialect(ArrayRef<llvm::Record *> records, Dialect &dialect) { … }
std::optional<Dialect>
tblgen::findDialectToGenerate(ArrayRef<Dialect> dialects) { … }
static const char *const dialectDeclBeginStr = …;
const char *const dialectRegistrationTemplate = …;
static const char *const attrParserDecl = …;
static const char *const typeParserDecl = …;
static const char *const canonicalizerDecl = …;
static const char *const constantMaterializerDecl = …;
static const char *const opAttrVerifierDecl = …;
static const char *const regionArgAttrVerifierDecl = …;
static const char *const regionResultAttrVerifierDecl = …;
static const char *const operationInterfaceFallbackDecl = …;
static const char *const discardableAttrHelperDecl = …;
static void emitDialectDecl(Dialect &dialect, raw_ostream &os) { … }
static bool emitDialectDecls(const llvm::RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static const char *const dialectConstructorStr = …;
static const char *const dialectDestructorStr = …;
static void emitDialectDef(Dialect &dialect,
const llvm::RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static bool emitDialectDefs(const llvm::RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static mlir::GenRegistration
genDialectDecls("gen-dialect-decls", "Generate dialect declarations",
[](const llvm::RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genDialectDefs("gen-dialect-defs", "Generate dialect definitions",
[](const llvm::RecordKeeper &records, raw_ostream &os) { … });