44 lines · plain
1//===- StandaloneOps.td - Standalone dialect ops -----------*- tablegen -*-===//2//3// This file is licensed 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 STANDALONE_OPS10#define STANDALONE_OPS11 12include "Standalone/StandaloneTypes.td"13include "mlir/Interfaces/InferTypeOpInterface.td"14include "mlir/Interfaces/SideEffectInterfaces.td"15 16def Standalone_FooOp : Standalone_Op<"foo", [Pure,17 SameOperandsAndResultType]> {18 let summary = "Illustrates how to define an operation.";19 let description = [{20 The `standalone.foo` operation illustrates how to define a new21 operation in a dialect. It uses an operation trait to declare that it22 has no side effects.23 24 This operation takes an integer argument and returns an integer.25 26 Example:27 28 ```mlir29 %0 = arith.constant 2 : i3230 // Apply the foo operation to %031 %1 = standalone.foo %0 : i3232 ```33 }];34 35 let arguments = (ins I32:$input);36 let results = (outs I32:$res);37 38 let assemblyFormat = [{39 $input attr-dict `:` type($input)40 }];41}42 43#endif // STANDALONE_OPS44