LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
StructSpecializationDiscovery.h
Go to the documentation of this file.
1//===-- StructSpecializationDiscovery.h -------------------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2026 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#pragma once
11
15
16#include <llvm/ADT/DenseMap.h>
17#include <llvm/ADT/SmallVector.h>
18
19#include <cstdint>
20
22
27mlir::FailureOr<mlir::Attribute>
28resolveConstReadBinding(ConstReadOp read, mlir::Attribute binding, mlir::Type readType);
29
37 enum class Kind : std::uint8_t { Plain, ArrayElement, RolledCallResult };
38
39 mlir::Operation *site;
41 llvm::SmallVector<int64_t> arrayIndices;
44};
45
49 mlir::Operation *site;
50 llvm::SmallVector<component::StructType> candidates;
51};
52
129public:
130 using Bindings = llvm::DenseMap<mlir::Attribute, mlir::Attribute>;
131 using Requests = llvm::SmallVector<StructSpecializationRequest>;
132 using CallTargets = llvm::SmallVector<RolledCallTargets>;
133
137 mlir::FailureOr<Bindings>
138 evaluateBindings(mlir::Operation *source, const Bindings &bindings) const;
139
146 mlir::FailureOr<Requests> discover(
147 mlir::Operation *source, const Bindings &bindings,
148 llvm::SmallVectorImpl<mlir::Operation *> *visitedOperations = nullptr,
149 CallTargets *callTargets = nullptr
150 ) const;
151};
152
153} // namespace llzk::polymorphic::detail
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Definition LICENSE.txt:28
Determine which concrete struct definitions are needed when instantiating a struct or free function w...
mlir::FailureOr< Requests > discover(mlir::Operation *source, const Bindings &bindings, llvm::SmallVectorImpl< mlir::Operation * > *visitedOperations=nullptr, CallTargets *callTargets=nullptr) const
Return ordered, deduplicated requests for a struct or free-function source, or diagnose an unresolved...
llvm::DenseMap< mlir::Attribute, mlir::Attribute > Bindings
mlir::FailureOr< Bindings > evaluateBindings(mlir::Operation *source, const Bindings &bindings) const
Evaluate enclosing template expressions in declaration order and return an extended copy of bindings ...
llvm::SmallVector< StructSpecializationRequest > Requests
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
mlir::FailureOr< mlir::Attribute > resolveConstReadBinding(ConstReadOp read, mlir::Attribute binding, mlir::Type readType)
Materialize a binding with the resolved read type for evaluation or cloning.
A rolled method call and the concrete specializations it may target.
llvm::SmallVector< component::StructType > candidates
A struct type that the caller must instantiate, paired with the source use that needs it.