1//===- TestTransformDialectExtension.td --------------------*- tablegen -*-===//
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// This file declares the operations that are injected into the Transform
10// dialect through the extension mechanism, as a test.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_TESTTRANSFORMDIALECTEXTENSION_TD
15#define MLIR_TESTTRANSFORMDIALECTEXTENSION_TD
16
17include "mlir/IR/OpBase.td"
18include "mlir/Dialect/Transform/IR/TransformDialect.td"
19include "mlir/Dialect/Transform/IR/TransformInterfaces.td"
20include "mlir/Dialect/PDL/IR/PDLTypes.td"
21
22def TestProduceParamOrForwardOperandOp
23  : Op<Transform_Dialect, "test_produce_param_or_forward_operand",
24       [DeclareOpInterfaceMethods<TransformOpInterface>]> {
25  let arguments = (ins Optional<PDL_Operation>:$operand,
26                       OptionalAttr<I64Attr>:$parameter);
27  let results = (outs PDL_Operation:$res);
28  let assemblyFormat = "(`from` $operand^)? ($parameter^)? attr-dict";
29  let cppNamespace = "::mlir::test";
30  let hasVerifier = 1;
31}
32
33def TestConsumeOperandIfMatchesParamOrFail
34  : Op<Transform_Dialect, "test_consume_operand_if_matches_param_or_fail",
35       [DeclareOpInterfaceMethods<TransformOpInterface>]> {
36  let arguments = (ins PDL_Operation:$operand, I64Attr:$parameter);
37  let assemblyFormat = "$operand `[` $parameter `]` attr-dict";
38  let cppNamespace = "::mlir::test";
39}
40
41def TestPrintRemarkAtOperandOp
42  : Op<Transform_Dialect, "test_print_remark_at_operand",
43       [DeclareOpInterfaceMethods<TransformOpInterface>]> {
44  let arguments = (ins PDL_Operation:$operand, StrAttr:$message);
45  let assemblyFormat = "$operand `,` $message attr-dict";
46  let cppNamespace = "::mlir::test";
47}
48
49#endif // MLIR_TESTTRANSFORMDIALECTEXTENSION_TD
50