#include "mlir/Dialect/Transform/IR/TransformDialect.h"
#include "mlir/Analysis/CallGraph.h"
#include "mlir/Dialect/Transform/IR/TransformOps.h"
#include "mlir/Dialect/Transform/IR/TransformTypes.h"
#include "mlir/Dialect/Transform/IR/Utils.h"
#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/SCCIterator.h"
usingnamespacemlir;
#include "mlir/Dialect/Transform/IR/TransformDialect.cpp.inc"
#ifndef NDEBUG
void transform::detail::checkImplementsTransformOpInterface(
StringRef name, MLIRContext *context) {
RegisteredOperationName opName =
*RegisteredOperationName::lookup(name, context);
assert((opName.hasInterface<TransformOpInterface>() ||
opName.hasInterface<PatternDescriptorOpInterface>() ||
opName.hasInterface<ConversionPatternDescriptorOpInterface>() ||
opName.hasInterface<TypeConverterBuilderOpInterface>() ||
opName.hasTrait<OpTrait::IsTerminator>()) &&
"non-terminator ops injected into the transform dialect must "
"implement TransformOpInterface or PatternDescriptorOpInterface or "
"ConversionPatternDescriptorOpInterface");
if (!opName.hasInterface<PatternDescriptorOpInterface>() &&
!opName.hasInterface<ConversionPatternDescriptorOpInterface>() &&
!opName.hasInterface<TypeConverterBuilderOpInterface>()) {
assert(opName.hasInterface<MemoryEffectOpInterface>() &&
"ops injected into the transform dialect must implement "
"MemoryEffectsOpInterface");
}
}
void transform::detail::checkImplementsTransformHandleTypeInterface(
TypeID typeID, MLIRContext *context) {
const auto &abstractType = AbstractType::lookup(typeID, context);
assert((abstractType.hasInterface(
TransformHandleTypeInterface::getInterfaceID()) ||
abstractType.hasInterface(
TransformParamTypeInterface::getInterfaceID()) ||
abstractType.hasInterface(
TransformValueHandleTypeInterface::getInterfaceID())) &&
"expected Transform dialect type to implement one of the three "
"interfaces");
}
#endif
void transform::TransformDialect::initialize() { … }
Type transform::TransformDialect::parseType(DialectAsmParser &parser) const { … }
void transform::TransformDialect::printType(Type type,
DialectAsmPrinter &printer) const { … }
LogicalResult transform::TransformDialect::loadIntoLibraryModule(
::mlir::OwningOpRef<::mlir::ModuleOp> &&library) { … }
void transform::TransformDialect::initializeLibraryModule() { … }
void transform::TransformDialect::reportDuplicateTypeRegistration(
StringRef mnemonic) { … }
void transform::TransformDialect::reportDuplicateOpRegistration(
StringRef opName) { … }
LogicalResult transform::TransformDialect::verifyOperationAttribute(
Operation *op, NamedAttribute attribute) { … }