Files
clang-p2996/mlir/lib/Dialect/Transform/IRDLExtension/IRDLExtension.cpp
Oleksandr "Alex" Zinenko 105c992c83 [mlir] use irdl as matcher description in transform (#89779)
Introduce a new Transform dialect extension that uses IRDL op
definitions as matcher descriptors. IRDL allows one to essentially
define additional op constraits to be verified and, unlike PDL, does not
assume rewriting will happen. Leverage IRDL verification capability to
filter out ops that match an IRDL definition without actually
registering the corresponding operation with the system.
2024-05-02 15:03:30 +02:00

35 lines
1.1 KiB
C++

//===- IRDLExtension.cpp - IRDL extension for the Transform dialect -------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Transform/IRDLExtension/IRDLExtension.h"
#include "mlir/Dialect/IRDL/IR/IRDL.h"
#include "mlir/Dialect/Transform/IR/TransformDialect.h"
#include "mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.h"
#include "mlir/IR/DialectRegistry.h"
using namespace mlir;
namespace {
class IRDLExtension
: public transform::TransformDialectExtension<IRDLExtension> {
public:
void init() {
registerTransformOps<
#define GET_OP_LIST
#include "mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.cpp.inc"
>();
declareDependentDialect<irdl::IRDLDialect>();
}
};
} // namespace
void mlir::transform::registerIRDLExtension(DialectRegistry &dialectRegistry) {
dialectRegistry.addExtensions<IRDLExtension>();
}