#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/AttributeSupport.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/StorageUniquerSupport.h"
usingnamespacemlir;
static LogicalResult
typeOrAttrParser(AsmParser &parser, SmallVectorImpl<Attribute> &parsedParams) { … }
static void typeOrAttrPrinter(AsmPrinter &printer, ArrayRef<Attribute> params) { … }
std::unique_ptr<DynamicTypeDefinition>
DynamicTypeDefinition::get(StringRef name, ExtensibleDialect *dialect,
VerifierFn &&verifier) { … }
std::unique_ptr<DynamicTypeDefinition>
DynamicTypeDefinition::get(StringRef name, ExtensibleDialect *dialect,
VerifierFn &&verifier, ParserFn &&parser,
PrinterFn &&printer) { … }
DynamicTypeDefinition::DynamicTypeDefinition(StringRef nameRef,
ExtensibleDialect *dialect,
VerifierFn &&verifier,
ParserFn &&parser,
PrinterFn &&printer)
: … { … }
DynamicTypeDefinition::DynamicTypeDefinition(ExtensibleDialect *dialect,
StringRef nameRef)
: … { … }
void DynamicTypeDefinition::registerInTypeUniquer() { … }
namespace mlir {
namespace detail {
struct DynamicTypeStorage : public TypeStorage { … };
}
}
DynamicType DynamicType::get(DynamicTypeDefinition *typeDef,
ArrayRef<Attribute> params) { … }
DynamicType
DynamicType::getChecked(function_ref<InFlightDiagnostic()> emitError,
DynamicTypeDefinition *typeDef,
ArrayRef<Attribute> params) { … }
DynamicTypeDefinition *DynamicType::getTypeDef() { … }
ArrayRef<Attribute> DynamicType::getParams() { … }
bool DynamicType::classof(Type type) { … }
ParseResult DynamicType::parse(AsmParser &parser,
DynamicTypeDefinition *typeDef,
DynamicType &parsedType) { … }
void DynamicType::print(AsmPrinter &printer) { … }
std::unique_ptr<DynamicAttrDefinition>
DynamicAttrDefinition::get(StringRef name, ExtensibleDialect *dialect,
VerifierFn &&verifier) { … }
std::unique_ptr<DynamicAttrDefinition>
DynamicAttrDefinition::get(StringRef name, ExtensibleDialect *dialect,
VerifierFn &&verifier, ParserFn &&parser,
PrinterFn &&printer) { … }
DynamicAttrDefinition::DynamicAttrDefinition(StringRef nameRef,
ExtensibleDialect *dialect,
VerifierFn &&verifier,
ParserFn &&parser,
PrinterFn &&printer)
: … { … }
DynamicAttrDefinition::DynamicAttrDefinition(ExtensibleDialect *dialect,
StringRef nameRef)
: … { … }
void DynamicAttrDefinition::registerInAttrUniquer() { … }
namespace mlir {
namespace detail {
struct DynamicAttrStorage : public AttributeStorage { … };
}
}
DynamicAttr DynamicAttr::get(DynamicAttrDefinition *attrDef,
ArrayRef<Attribute> params) { … }
DynamicAttr
DynamicAttr::getChecked(function_ref<InFlightDiagnostic()> emitError,
DynamicAttrDefinition *attrDef,
ArrayRef<Attribute> params) { … }
DynamicAttrDefinition *DynamicAttr::getAttrDef() { … }
ArrayRef<Attribute> DynamicAttr::getParams() { … }
bool DynamicAttr::classof(Attribute attr) { … }
ParseResult DynamicAttr::parse(AsmParser &parser,
DynamicAttrDefinition *attrDef,
DynamicAttr &parsedAttr) { … }
void DynamicAttr::print(AsmPrinter &printer) { … }
DynamicOpDefinition::DynamicOpDefinition(
StringRef name, ExtensibleDialect *dialect,
OperationName::VerifyInvariantsFn &&verifyFn,
OperationName::VerifyRegionInvariantsFn &&verifyRegionFn,
OperationName::ParseAssemblyFn &&parseFn,
OperationName::PrintAssemblyFn &&printFn,
OperationName::FoldHookFn &&foldHookFn,
GetCanonicalizationPatternsFn &&getCanonicalizationPatternsFn,
OperationName::PopulateDefaultAttrsFn &&populateDefaultAttrsFn)
: … { … }
std::unique_ptr<DynamicOpDefinition> DynamicOpDefinition::get(
StringRef name, ExtensibleDialect *dialect,
OperationName::VerifyInvariantsFn &&verifyFn,
OperationName::VerifyRegionInvariantsFn &&verifyRegionFn) { … }
std::unique_ptr<DynamicOpDefinition> DynamicOpDefinition::get(
StringRef name, ExtensibleDialect *dialect,
OperationName::VerifyInvariantsFn &&verifyFn,
OperationName::VerifyRegionInvariantsFn &&verifyRegionFn,
OperationName::ParseAssemblyFn &&parseFn,
OperationName::PrintAssemblyFn &&printFn) { … }
std::unique_ptr<DynamicOpDefinition> DynamicOpDefinition::get(
StringRef name, ExtensibleDialect *dialect,
OperationName::VerifyInvariantsFn &&verifyFn,
OperationName::VerifyInvariantsFn &&verifyRegionFn,
OperationName::ParseAssemblyFn &&parseFn,
OperationName::PrintAssemblyFn &&printFn,
OperationName::FoldHookFn &&foldHookFn,
GetCanonicalizationPatternsFn &&getCanonicalizationPatternsFn,
OperationName::PopulateDefaultAttrsFn &&populateDefaultAttrsFn) { … }
namespace {
class IsExtensibleDialect : public DialectInterface::Base<IsExtensibleDialect> { … };
}
ExtensibleDialect::ExtensibleDialect(StringRef name, MLIRContext *ctx,
TypeID typeID)
: … { … }
void ExtensibleDialect::registerDynamicType(
std::unique_ptr<DynamicTypeDefinition> &&type) { … }
void ExtensibleDialect::registerDynamicAttr(
std::unique_ptr<DynamicAttrDefinition> &&attr) { … }
void ExtensibleDialect::registerDynamicOp(
std::unique_ptr<DynamicOpDefinition> &&op) { … }
bool ExtensibleDialect::classof(const Dialect *dialect) { … }
OptionalParseResult ExtensibleDialect::parseOptionalDynamicType(
StringRef typeName, AsmParser &parser, Type &resultType) const { … }
LogicalResult ExtensibleDialect::printIfDynamicType(Type type,
AsmPrinter &printer) { … }
OptionalParseResult ExtensibleDialect::parseOptionalDynamicAttr(
StringRef attrName, AsmParser &parser, Attribute &resultAttr) const { … }
LogicalResult ExtensibleDialect::printIfDynamicAttr(Attribute attribute,
AsmPrinter &printer) { … }
namespace {
class IsDynamicDialect : public DialectInterface::Base<IsDynamicDialect> { … };
}
DynamicDialect::DynamicDialect(StringRef name, MLIRContext *ctx)
: … { … }
bool DynamicDialect::classof(const Dialect *dialect) { … }
Type DynamicDialect::parseType(DialectAsmParser &parser) const { … }
void DynamicDialect::printType(Type type, DialectAsmPrinter &printer) const { … }
Attribute DynamicDialect::parseAttribute(DialectAsmParser &parser,
Type type) const { … }
void DynamicDialect::printAttribute(Attribute attr,
DialectAsmPrinter &printer) const { … }