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-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef STANDALONE_OPS 10#define STANDALONE_OPS 11 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 new 21 operation in a dialect. It uses an operation trait to declare that it 22 has no side effects. 23 24 This operation takes an integer argument and returns an integer. 25 26 Example: 27 28 ```mlir 29 %0 = arith.constant 2 : i32 30 // Apply the foo operation to %0 31 %1 = standalone.foo %0 : i32 32 ``` 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_OPS 44