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/Transform/IR/TransformOps.h"
11 
12 using namespace mlir;
13 
14 #include "mlir/Dialect/Transform/IR/TransformDialect.cpp.inc"
15 
16 void transform::TransformDialect::initialize() {
17   // Using the checked version to enable the same assertions as for the ops from
18   // extensions.
19   addOperationsChecked<
20 #define GET_OP_LIST
21 #include "mlir/Dialect/Transform/IR/TransformOps.cpp.inc"
22       >();
23 }
24 
25 void transform::TransformDialect::mergeInPDLMatchHooks(
26     llvm::StringMap<PDLConstraintFunction> &&constraintFns) {
27   // Steal the constraint functions form the given map.
28   for (auto &it : constraintFns)
29     pdlMatchHooks.registerConstraintFunction(it.getKey(), std::move(it.second));
30 }
31 
32 const llvm::StringMap<PDLConstraintFunction> &
33 transform::TransformDialect::getPDLConstraintHooks() const {
34   return pdlMatchHooks.getConstraintFunctions();
35 }
36