LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
TemplateInstantiation.h File Reference

Private parameter substitution helpers shared by polymorphic transformations. More...

#include "llzk/Dialect/Function/IR/Ops.h"
#include "llzk/Dialect/Polymorphic/IR/Ops.h"
#include "llzk/Dialect/Struct/IR/Ops.h"
#include "llzk/Util/TypeHelper.h"
#include <mlir/IR/Diagnostics.h>
#include <mlir/Transforms/DialectConversion.h>
#include <llvm/ADT/DenseMap.h>
#include <llvm/ADT/SmallVector.h>
#include <optional>
Include dependency graph for TemplateInstantiation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  llzk::polymorphic::detail::TemplateTypeConverter
 Substitute known template bindings in function types and inference candidates. More...

Namespaces

namespace  llzk
namespace  llzk::polymorphic
namespace  llzk::polymorphic::detail
 Common interface for constant parameter-like symbol operations that can be defined within a TemplateOp.

Functions

mlir::FailureOr< mlir::ArrayAttr > llzk::polymorphic::detail::rebaseTemplateParams (mlir::SymbolTableCollection &tables, mlir::ArrayAttr templateParams, mlir::Operation *lookupFrom, mlir::ModuleOp destinationRoot, mlir::Operation *requestSite)
 Re-spell struct types nested in templateParams for destinationRoot, resolving their current names from lookupFrom.
void llzk::polymorphic::detail::reportDelayedDiagnostics (mlir::Operation *site, llvm::SmallVector< mlir::Diagnostic > &&diagnostics)
 Report diagnostics emitted while substituting a clone, preserving notes and moving notes with unknown locations to the instantiation site.
void llzk::polymorphic::detail::convertCalleesInPlace (mlir::Operation *op, const llvm::DenseMap< mlir::Attribute, mlir::Attribute > &bindings)
 Rewrite callees rooted at a type parameter using that parameter's struct binding.
void llzk::polymorphic::detail::evaluateTemplateExprs (TemplateOp templateOp, llvm::DenseMap< mlir::Attribute, mlir::Attribute > &bindings)
 Add foldable template-expression results to bindings in declaration order.
std::optional< mlir::Attribute > llzk::polymorphic::detail::inferUnifiedParam (const UnificationMap &unifyResult, mlir::SymbolRefAttr paramName)
 Return the callee-side unification-derived value for a template parameter, if any.
mlir::LogicalResult llzk::polymorphic::detail::substituteStructBody (component::StructDefOp clone, component::StructType originalType, const llvm::DenseMap< mlir::Attribute, mlir::Attribute > &bindings, llvm::SmallVector< mlir::Diagnostic > &diagnostics)
 Substitute bindings and self-type references in an already inserted struct clone.
mlir::LogicalResult llzk::polymorphic::detail::substituteFunctionBody (function::FuncDefOp clone, const llvm::DenseMap< mlir::Attribute, mlir::Attribute > &bindings, llvm::SmallVector< mlir::Diagnostic > &diagnostics)
 Substitute bindings in a function clone, including constants and array accesses.

Detailed Description

Private parameter substitution helpers shared by polymorphic transformations.

Callers own cloning, symbol insertion, specialization identity and scheduling.

Definition in file TemplateInstantiation.h.