1//===-- OpInterfaces.td ------------------------------------*- tablegen -*-===//
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
8//===----------------------------------------------------------------------===//
10#ifndef LLZK_GLOBAL_OP_INTERFACES
11#define LLZK_GLOBAL_OP_INTERFACES
13include "mlir/IR/Interfaces.td"
14include "mlir/Interfaces/SideEffectInterfaces.td"
16def GlobalMemoryResource : Resource<"::llzk::global::GlobalMemoryResource">;
18def GlobalRefOpInterface : OpInterface<"GlobalRefOpInterface"> {
20 Common interface for operations that read or write from a global.
22 let cppNamespace = "::llzk::global";
25 // Requires implementors to have a '$val' argument.
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.
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)>,
38 let extraClassDeclaration = [{
39 /// Gets the definition for the `global` referenced in this op.
40 ::mlir::FailureOr<SymbolLookupResult<GlobalDefOp>> getGlobalDefOp(::mlir::SymbolTableCollection &tables);
44#endif // LLZK_GLOBAL_OP_INTERFACES