LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
OpInterfaces.td
Go to the documentation of this file.
1//===-- OpInterfaces.td ------------------------------------*- tablegen -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLZK_GLOBAL_OP_INTERFACES
11#define LLZK_GLOBAL_OP_INTERFACES
12
13include "mlir/IR/Interfaces.td"
14include "mlir/Interfaces/SideEffectInterfaces.td"
15
16def GlobalMemoryResource : Resource<"::llzk::global::GlobalMemoryResource">;
17
18def GlobalRefOpInterface : OpInterface<"GlobalRefOpInterface"> {
19 let description = [{
20 Common interface for operations that read or write from a global.
21 }];
22 let cppNamespace = "::llzk::global";
23
24 let methods = [
25 // Requires implementors to have a '$val' argument.
26 InterfaceMethod<
27 [{Gets the SSA Value that holds the read/write data for the GlobalRefOp.}],
28 "::mlir::Value", "getVal", (ins)>,
29 // Requires implementors to have a '$name_ref' argument.
30 InterfaceMethod<
31 [{Gets the name of the global reference attribute on the GlobalRefOp.}],
32 "::mlir::StringAttr", "getNameRefAttrName", (ins),
33 /*methodBody=*/[{ return $_op.getNameRefAttrName(); }]>,
34 InterfaceMethod<[{Gets the global name attribute from the GlobalRefOp.}],
35 "::mlir::SymbolRefAttr", "getNameRef", (ins)>,
36 ];
37
38 let extraClassDeclaration = [{
39 /// Gets the definition for the `global` referenced in this op.
40 ::mlir::FailureOr<SymbolLookupResult<GlobalDefOp>> getGlobalDefOp(::mlir::SymbolTableCollection &tables);
41 }];
42}
43
44#endif // LLZK_GLOBAL_OP_INTERFACES