LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
DiscardableAllocationOpInterfaces.td
Go to the documentation of this file.
1//===-- DiscardableAllocationOpInterfaces.td --------------*- tablegen -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2026 Project LLZK
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLZK_DISCARDABLE_ALLOCATION_OP_INTERFACES
11#define LLZK_DISCARDABLE_ALLOCATION_OP_INTERFACES
12
13include "mlir/IR/Interfaces.td"
14include "mlir/Interfaces/MemorySlotInterfaces.td"
15include "mlir/Interfaces/SideEffectInterfaces.td"
16
17def DiscardableAllocationResource
18 : Resource<"::llzk::DiscardableAllocationResource">;
19
20def DiscardableAllocationAccessorOpInterface
21 : OpInterface<"DiscardableAllocationAccessorOpInterface"> {
22 let description = [{
23 Provides the necessary information to the `RemoveUnusedDiscardableAllocations` pass about
24 operations that load or store values from the result of an allocator op marked with the
25 `MemAlloc<DiscardableAllocationResource>` memory effect so unused allocators and stores can be
26 removed.
27 }];
28 let cppNamespace = "::llzk";
29
30 let methods =
31 [InterfaceMethod<
32 [{Returns true if this op reads from the allocation represented by `ptr`.}],
33 "bool", "loadsFromDiscardableAllocation",
34 (ins "::mlir::Value":$ptr)>,
35 InterfaceMethod<
36 [{Returns true if this op writes to the allocation represented by `ptr`.}],
37 "bool", "storesToDiscardableAllocation", (ins "::mlir::Value":$ptr)>,
38 InterfaceMethod<
39 [{Returns true if this op can be erased as a dead store to `ptr`.}],
40 "bool", "canEraseAsDeadStoreTo",
41 (ins "::mlir::Value":$ptr,
42 "const ::mlir::DataLayout &":$dataLayout)>,
43 ];
44}
45
46#endif // LLZK_DISCARDABLE_ALLOCATION_OP_INTERFACES