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   addOperations<
18 #define GET_OP_LIST
19 #include "mlir/Dialect/Transform/IR/TransformOps.cpp.inc"
20       >();
21 }
22 
23 void transform::TransformDialect::mergeInPDLMatchHooks(
24     llvm::StringMap<PDLConstraintFunction> &&constraintFns) {
25   // Steal the constraint functions form the given map.
26   for (auto &it : constraintFns)
27     pdlMatchHooks.registerConstraintFunction(it.getKey(), std::move(it.second));
28 }
29 
30 const llvm::StringMap<PDLConstraintFunction> &
31 transform::TransformDialect::getPDLConstraintHooks() const {
32   return pdlMatchHooks.getConstraintFunctions();
33 }
34