#include "DocGenUtilities.h"
#include "mlir/TableGen/Format.h"
#include "mlir/TableGen/GenInfo.h"
#include "mlir/TableGen/Interfaces.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
usingnamespacemlir;
Interface;
InterfaceMethod;
OpInterface;
static raw_ostream &emitCPPType(StringRef type, raw_ostream &os) { … }
static void emitMethodNameAndArgs(const InterfaceMethod &method,
raw_ostream &os, StringRef valueType,
bool addThisArg, bool addConst) { … }
static std::vector<const llvm::Record *>
getAllInterfaceDefinitions(const llvm::RecordKeeper &recordKeeper,
StringRef name) { … }
namespace {
class InterfaceGenerator { … };
struct AttrInterfaceGenerator : public InterfaceGenerator { … };
struct OpInterfaceGenerator : public InterfaceGenerator { … };
struct TypeInterfaceGenerator : public InterfaceGenerator { … };
}
static void emitInterfaceMethodDoc(const InterfaceMethod &method,
raw_ostream &os, StringRef prefix = "") { … }
static void emitInterfaceDefMethods(StringRef interfaceQualName,
const Interface &interface,
StringRef valueType, const Twine &implValue,
raw_ostream &os, bool isOpInterface) { … }
static void emitInterfaceDef(const Interface &interface, StringRef valueType,
raw_ostream &os) { … }
bool InterfaceGenerator::emitInterfaceDefs() { … }
void InterfaceGenerator::emitConceptDecl(const Interface &interface) { … }
void InterfaceGenerator::emitModelDecl(const Interface &interface) { … }
void InterfaceGenerator::emitModelMethodsDef(const Interface &interface) { … }
void InterfaceGenerator::emitTraitDecl(const Interface &interface,
StringRef interfaceName,
StringRef interfaceTraitsName) { … }
static void emitInterfaceDeclMethods(const Interface &interface,
raw_ostream &os, StringRef valueType,
bool isOpInterface,
tblgen::FmtContext &extraDeclsFmt) { … }
void InterfaceGenerator::emitInterfaceDecl(const Interface &interface) { … }
bool InterfaceGenerator::emitInterfaceDecls() { … }
static void emitInterfaceDoc(const llvm::Record &interfaceDef,
raw_ostream &os) { … }
bool InterfaceGenerator::emitInterfaceDocs() { … }
namespace {
template <typename GeneratorT>
struct InterfaceGenRegistration { … };
}
static InterfaceGenRegistration<AttrInterfaceGenerator> attrGen("attr",
"attribute");
static InterfaceGenRegistration<OpInterfaceGenerator> opGen("op", "op");
static InterfaceGenRegistration<TypeInterfaceGenerator> typeGen("type", "type");