91 lines · plain
1//===- TestTransformOps.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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef TEST_TRANSFORM_OPS10#define TEST_TRANSFORM_OPS11 12include "mlir/Dialect/Transform/IR/TransformDialect.td"13include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.td"14include "mlir/Dialect/Transform/IR/TransformTypes.td"15include "mlir/Interfaces/SideEffectInterfaces.td"16include "mlir/IR/OpBase.td"17 18/// Transform dialect operations for testing transformations in MLIR19 20def TestMoveOperandDeps :21 Op<Transform_Dialect, "test.move_operand_deps",22 [FunctionalStyleTransformOpTrait, MemoryEffectsOpInterface,23 DeclareOpInterfaceMethods<TransformOpInterface>,24 ReportTrackingListenerFailuresOpTrait]> {25 let description = [{26 Moves all dependencies of on operation before another operation.27 }];28 29 let arguments =30 (ins TransformHandleTypeInterface:$op,31 TransformHandleTypeInterface:$insertion_point);32 33 let results = (outs);34 35 let assemblyFormat = [{36 $op `before` $insertion_point attr-dict37 `:` type($op) `,` type($insertion_point)38 }];39}40 41def TestMoveValueDefns :42 Op<Transform_Dialect, "test.move_value_defns",43 [FunctionalStyleTransformOpTrait, MemoryEffectsOpInterface,44 DeclareOpInterfaceMethods<TransformOpInterface>,45 ReportTrackingListenerFailuresOpTrait]> {46 let description = [{47 Moves all dependencies of on operation before another operation.48 }];49 50 let arguments =51 (ins Variadic<TransformValueHandleTypeInterface>:$values,52 TransformHandleTypeInterface:$insertion_point);53 54 let results = (outs);55 56 let assemblyFormat = [{57 $values `before` $insertion_point attr-dict58 `:` `(` type($values) `)` `` `,` type($insertion_point)59 }];60}61 62//===----------------------------------------------------------------------===//63// Test affine functionality.64//===----------------------------------------------------------------------===//65 66def TestMakeComposedFoldedAffineApply :67 Op<Transform_Dialect, "test.make_composed_folded_affine_apply",68 [FunctionalStyleTransformOpTrait, 69 MemoryEffectsOpInterface,70 TransformOpInterface,71 TransformEachOpTrait,72 ReportTrackingListenerFailuresOpTrait]> {73 let description = [{74 Rewrite an affine_apply by using the makeComposedFoldedAffineApply API.75 }];76 let arguments = (ins TransformHandleTypeInterface:$op);77 let results = (outs TransformHandleTypeInterface:$composed);78 let assemblyFormat = [{79 $op attr-dict `:` functional-type(operands, results)80 }];81 let extraClassDeclaration = [{82 ::mlir::DiagnosedSilenceableFailure applyToOne(83 ::mlir::transform::TransformRewriter &rewriter,84 ::mlir::affine::AffineApplyOp affineApplyOp,85 ::mlir::transform::ApplyToEachResultList &results,86 ::mlir::transform::TransformState &state);87 }];88}89 90#endif // TEST_TRANSFORM_OPS91