xref: /llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.td (revision 660f714e26999d266232a1fbb02712bb879bd34e)
1//===- BytecodeOpInterface.td - Bytecode OpInterface -------*- 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 contains an interface for operation interactions with the bytecode
10// serialization/deserialization, in particular for properties.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_BYTECODE_BYTECODEOPINTERFACES
15#define MLIR_BYTECODE_BYTECODEOPINTERFACES
16
17include "mlir/IR/OpBase.td"
18
19// `BytecodeOpInterface`
20def BytecodeOpInterface : OpInterface<"BytecodeOpInterface"> {
21  let description = [{
22    This interface allows operation to control the serialization of their
23    properties.
24  }];
25  let cppNamespace = "::mlir";
26
27  let methods = [
28    StaticInterfaceMethod<[{
29      Read the properties for this operation from the bytecode and populate the state.
30      }],
31      "LogicalResult", "readProperties", (ins
32          "::mlir::DialectBytecodeReader &":$reader,
33          "::mlir::OperationState &":$state)
34    >,
35    InterfaceMethod<[{
36      Write the properties for this operation to the bytecode.
37      }],
38      "void", "writeProperties", (ins "::mlir::DialectBytecodeWriter &":$writer)
39    >,
40  ];
41}
42
43#endif // MLIR_BYTECODE_BYTECODEOPINTERFACES
44