1 //===- TransformDialect.cpp - Transform Dialect Definition ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/Dialect/Transform/IR/TransformDialect.h"
10 #include "mlir/Dialect/PDL/IR/PDL.h"
11 #include "mlir/Dialect/PDLInterp/IR/PDLInterp.h"
12 #include "mlir/Dialect/Transform/IR/TransformOps.h"
13 
14 using namespace mlir;
15 
16 #include "mlir/Dialect/Transform/IR/TransformDialect.cpp.inc"
17 
initialize()18 void transform::TransformDialect::initialize() {
19   // Using the checked version to enable the same assertions as for the ops from
20   // extensions.
21   addOperationsChecked<
22 #define GET_OP_LIST
23 #include "mlir/Dialect/Transform/IR/TransformOps.cpp.inc"
24       >();
25 }
26 
mergeInPDLMatchHooks(llvm::StringMap<PDLConstraintFunction> && constraintFns)27 void transform::TransformDialect::mergeInPDLMatchHooks(
28     llvm::StringMap<PDLConstraintFunction> &&constraintFns) {
29   // Steal the constraint functions form the given map.
30   for (auto &it : constraintFns)
31     pdlMatchHooks.registerConstraintFunction(it.getKey(), std::move(it.second));
32 }
33 
34 const llvm::StringMap<PDLConstraintFunction> &
getPDLConstraintHooks() const35 transform::TransformDialect::getPDLConstraintHooks() const {
36   return pdlMatchHooks.getConstraintFunctions();
37 }
38