xref: /llvm-project/mlir/include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.td (revision 91856b34e3eddf157ab4c6ea623483b49d149e62)
1//===- DebugExtensionOps.td - Transform Debug extension ----*- 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// Defines operations of the transform dialect extension for debugging transform
10// scripts.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_DIALECT_TRANSFORM_DEBUGEXTENSION_DBEUGEXTENSIONOPS
15#define MLIR_DIALECT_TRANSFORM_DEBUGEXTENSION_DBEUGEXTENSIONOPS
16
17include "mlir/Interfaces/SideEffectInterfaces.td"
18include "mlir/IR/OpBase.td"
19include "mlir/Dialect/Transform/Interfaces/MatchInterfaces.td"
20include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.td"
21include "mlir/Dialect/Transform/IR/TransformDialect.td"
22
23def DebugEmitRemarkAtOp : TransformDialectOp<"debug.emit_remark_at",
24  [MatchOpInterface,
25   DeclareOpInterfaceMethods<TransformOpInterface>,
26   MemoryEffectsOpInterface, NavigationTransformOpTrait]> {
27  let summary = "Print a message as diagnostic remark attached to payload";
28  let description = [{
29    This operation emits a diagnostic remark with the given message at the
30    location of each payload object associated with the argument. The argument
31    may be an operation or a value handle.
32
33    This operation always succeeds.
34  }];
35
36  let arguments = (ins
37    Transform_AnyHandleType:$at,
38    StrAttr:$message);
39  let assemblyFormat = "$at `,` $message attr-dict `:` type($at)";
40}
41
42def DebugEmitParamAsRemarkOp
43  : TransformDialectOp<"debug.emit_param_as_remark",
44    [MatchOpInterface,
45     DeclareOpInterfaceMethods<TransformOpInterface>,
46     MemoryEffectsOpInterface, NavigationTransformOpTrait]> {
47  let summary = "Prints the parameter as a diagnostic remark";
48  let description = [{
49    This operation emits a diagnostic remark containing the string form of the
50    attributes associated with the parameter provided as attribute. It takes
51    as optional arguments:
52      - an additional message text to prepend;
53      - a handle pointing to operations the location of which will be used to
54        emit the diagnostic; if multiple operations are associated, the
55        diagnostic is emitted for all of their respective locations.
56
57    This operation always succeeds.
58  }];
59
60  let arguments = (ins TransformParamTypeInterface:$param,
61                       Optional<TransformHandleTypeInterface>:$anchor,
62                       OptionalAttr<StrAttr>:$message);
63  let assemblyFormat = "$param (`,` $message^)?  (`at` $anchor^)?"
64                       "attr-dict `:` type($param) (`,` type($anchor)^)?";
65}
66
67#endif // MLIR_DIALECT_TRANSFORM_DEBUGEXTENSION_DBEUGEXTENSIONOPS
68