|
LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
#include <Builders.h>
Public Member Functions | |
| ModuleLikeBuilder (mlir::MLIRContext *ctx) | |
| mlir::Region & | getBodyRegion () |
| mlir::FailureOr< component::StructDefOp > | getStruct (std::string_view structName) const |
| mlir::FailureOr< function::FuncDefOp > | getComputeFn (std::string_view structName) const |
| mlir::FailureOr< function::FuncDefOp > | getComputeFn (component::StructDefOp op) const |
| mlir::FailureOr< function::FuncDefOp > | getConstrainFn (std::string_view structName) const |
| mlir::FailureOr< function::FuncDefOp > | getConstrainFn (component::StructDefOp op) const |
| mlir::FailureOr< function::FuncDefOp > | getProductFn (std::string_view structName) const |
| mlir::FailureOr< function::FuncDefOp > | getProductFn (component::StructDefOp op) const |
| mlir::FailureOr< function::FuncDefOp > | getFreeFunc (std::string_view funcName) const |
| Derived & | insertEmptyStruct (std::string_view structName, mlir::Location loc) |
| Derived & | insertEmptyStruct (std::string_view structName) |
| Derived & | insertComputeOnlyStruct (std::string_view structName, mlir::Location structLoc, mlir::Location computeLoc) |
| Derived & | insertComputeOnlyStruct (std::string_view structName) |
| Derived & | insertConstrainOnlyStruct (std::string_view structName, mlir::Location structLoc, mlir::Location constrainLoc) |
| Derived & | insertConstrainOnlyStruct (std::string_view structName) |
| Derived & | insertFullStruct (std::string_view structName, mlir::Location structLoc, mlir::Location computeLoc, mlir::Location constrainLoc) |
| Derived & | insertFullStruct (std::string_view structName) |
| Inserts a struct with both compute and constrain functions. | |
| Derived & | insertProductStruct (std::string_view structName, mlir::Location structLoc, mlir::Location productLoc) |
| Derived & | insertProductStruct (std::string_view structName) |
| Derived & | insertComputeFn (component::StructDefOp op, mlir::Location loc) |
| Derived & | insertComputeFn (std::string_view structName, mlir::Location loc) |
| Derived & | insertComputeFn (std::string_view structName) |
| Derived & | insertConstrainFn (component::StructDefOp op, mlir::Location loc) |
| Derived & | insertConstrainFn (std::string_view structName, mlir::Location loc) |
| Derived & | insertConstrainFn (std::string_view structName) |
| Derived & | insertProductFn (component::StructDefOp op, mlir::Location loc) |
| Derived & | insertProductFn (std::string_view structName, mlir::Location loc) |
| Derived & | insertProductFn (std::string_view structName) |
| Derived & | insertComputeCall (component::StructDefOp caller, component::StructDefOp callee, mlir::Location callLoc) |
| Only requirement for compute is the call itself. | |
| Derived & | insertComputeCall (std::string_view caller, std::string_view callee, mlir::Location callLoc) |
| Derived & | insertComputeCall (std::string_view caller, std::string_view callee) |
| Derived & | insertConstrainCall (component::StructDefOp caller, component::StructDefOp callee, mlir::Location callLoc, mlir::Location memberDefLoc) |
| To call a constraint function, you must: | |
| Derived & | insertConstrainCall (std::string_view caller, std::string_view callee, mlir::Location callLoc, mlir::Location memberDefLoc) |
| Derived & | insertConstrainCall (std::string_view caller, std::string_view callee) |
| Derived & | insertFreeFunc (std::string_view funcName, ::mlir::FunctionType type, mlir::Location loc) |
| Derived & | insertFreeFunc (std::string_view funcName, ::mlir::FunctionType type) |
| Derived & | insertFreeCall (function::FuncDefOp caller, std::string_view callee, mlir::Location callLoc) |
| Derived & | insertFreeCall (function::FuncDefOp caller, std::string_view callee) |
| Public Member Functions inherited from llzk::BaseBuilder | |
| BaseBuilder (mlir::MLIRContext *ctx) | |
| mlir::Location | getUnknownLoc () |
Static Public Member Functions | |
| static function::FuncDefOp | buildComputeFn (component::StructDefOp op, mlir::Location loc) |
| compute returns the type of the struct that defines it. | |
| static function::FuncDefOp | buildConstrainFn (component::StructDefOp op, mlir::Location loc) |
| constrain accepts the struct type as the first argument. | |
| static function::FuncDefOp | buildProductFn (component::StructDefOp op, mlir::Location loc) |
| product returns the type of the struct that defines it. | |
Protected Member Functions | |
| void | ensureNoSuchFreeFunc (std::string_view funcName) |
| Ensure that a global function with the given funcName has not been added, reporting a fatal error otherwise. | |
| void | ensureFreeFnExists (std::string_view funcName) |
| Ensure that a global function with the given funcName has been added, reporting a fatal error otherwise. | |
| void | ensureNoSuchStruct (std::string_view structName) |
| Ensure that a struct with the given structName has not been added, reporting a fatal error otherwise. | |
| void | ensureStructExists (std::string_view structName) |
| Ensure that a struct with the given structName exists, reporting a fatal error otherwise. | |
| void | ensureNoSuchComputeFn (std::string_view structName) |
| Ensure that the given struct does not have a compute function, reporting a fatal error otherwise. | |
| void | ensureComputeFnExists (std::string_view structName) |
| Ensure that the given struct has a compute function, reporting a fatal error otherwise. | |
| void | ensureNoSuchConstrainFn (std::string_view structName) |
| Ensure that the given struct does not have a constrain function, reporting a fatal error otherwise. | |
| void | ensureConstrainFnExists (std::string_view structName) |
| Ensure that the given struct has a constrain function, reporting a fatal error otherwise. | |
| void | ensureNoSuchProductFn (std::string_view structName) |
| Ensure that the given struct does not have a product function, reporting a fatal error otherwise. | |
| void | ensureProductFnExists (std::string_view structName) |
| Ensure that the given struct has a product function, reporting a fatal error otherwise. | |
Protected Attributes | |
| std::unordered_map< std::string_view, function::FuncDefOp > | freeFuncMap |
| std::unordered_map< std::string_view, component::StructDefOp > | structMap |
| std::unordered_map< std::string_view, function::FuncDefOp > | computeFnMap |
| std::unordered_map< std::string_view, function::FuncDefOp > | constrainFnMap |
| std::unordered_map< std::string_view, function::FuncDefOp > | productFnMap |
| Protected Attributes inherited from llzk::BaseBuilder | |
| mlir::MLIRContext * | context |
Definition at line 45 of file Builders.h.
|
inline |
Definition at line 109 of file Builders.h.
|
static |
compute returns the type of the struct that defines it.
Since this is for testing, we accept no arguments.
Definition at line 124 of file Builders.cpp.
|
static |
constrain accepts the struct type as the first argument.
Definition at line 150 of file Builders.cpp.
|
static |
product returns the type of the struct that defines it.
Since this is for testing, we accept no arguments.
Definition at line 176 of file Builders.cpp.
|
protected |
Ensure that the given struct has a compute function, reporting a fatal error otherwise.
| structName |
Definition at line 76 of file Builders.cpp.
|
protected |
Ensure that the given struct has a constrain function, reporting a fatal error otherwise.
| structName |
Definition at line 90 of file Builders.cpp.
|
protected |
Ensure that a global function with the given funcName has been added, reporting a fatal error otherwise.
| funcName |
Definition at line 48 of file Builders.cpp.
|
protected |
Ensure that the given struct does not have a compute function, reporting a fatal error otherwise.
| structName |
Definition at line 69 of file Builders.cpp.
|
protected |
Ensure that the given struct does not have a constrain function, reporting a fatal error otherwise.
| structName |
Definition at line 83 of file Builders.cpp.
|
protected |
Ensure that a global function with the given funcName has not been added, reporting a fatal error otherwise.
| funcName |
Definition at line 41 of file Builders.cpp.
|
protected |
Ensure that the given struct does not have a product function, reporting a fatal error otherwise.
| structName |
Definition at line 97 of file Builders.cpp.
|
protected |
Ensure that a struct with the given structName has not been added, reporting a fatal error otherwise.
| structName |
Definition at line 55 of file Builders.cpp.
|
protected |
Ensure that the given struct has a product function, reporting a fatal error otherwise.
| structName |
Definition at line 104 of file Builders.cpp.
|
protected |
Ensure that a struct with the given structName exists, reporting a fatal error otherwise.
| structName |
Definition at line 62 of file Builders.cpp.
|
inline |
Definition at line 113 of file Builders.h.
|
inline |
Definition at line 128 of file Builders.h.
|
inline |
Definition at line 122 of file Builders.h.
|
inline |
Definition at line 138 of file Builders.h.
|
inline |
Definition at line 132 of file Builders.h.
|
inline |
Definition at line 152 of file Builders.h.
|
inline |
Definition at line 148 of file Builders.h.
|
inline |
Definition at line 142 of file Builders.h.
|
inline |
Definition at line 115 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertComputeCall | ( | component::StructDefOp | caller, |
| component::StructDefOp | callee, | ||
| mlir::Location | callLoc ) |
Only requirement for compute is the call itself.
It should also initialize the internal member, but we can ignore those ops for the sake of testing.
|
inline |
Definition at line 263 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertComputeCall | ( | std::string_view | caller, |
| std::string_view | callee, | ||
| mlir::Location | callLoc ) |
| Derived & llzk::ModuleLikeBuilder< Derived >::insertComputeFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 228 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertComputeFn | ( | std::string_view | structName, |
| mlir::Location | loc ) |
|
inline |
Definition at line 174 of file Builders.h.
|
inline |
Definition at line 166 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertConstrainCall | ( | component::StructDefOp | caller, |
| component::StructDefOp | callee, | ||
| mlir::Location | callLoc, | ||
| mlir::Location | memberDefLoc ) |
To call a constraint function, you must:
|
inline |
Definition at line 281 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertConstrainCall | ( | std::string_view | caller, |
| std::string_view | callee, | ||
| mlir::Location | callLoc, | ||
| mlir::Location | memberDefLoc ) |
| Derived & llzk::ModuleLikeBuilder< Derived >::insertConstrainFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 238 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertConstrainFn | ( | std::string_view | structName, |
| mlir::Location | loc ) |
|
inline |
Definition at line 187 of file Builders.h.
|
inline |
Definition at line 179 of file Builders.h.
|
inline |
Definition at line 162 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertEmptyStruct | ( | std::string_view | structName, |
| mlir::Location | loc ) |
|
inline |
Definition at line 292 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertFreeCall | ( | function::FuncDefOp | caller, |
| std::string_view | callee, | ||
| mlir::Location | callLoc ) |
|
inline |
Definition at line 286 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertFreeFunc | ( | std::string_view | funcName, |
| ::mlir::FunctionType | type, | ||
| mlir::Location | loc ) |
|
inline |
Inserts a struct with both compute and constrain functions.
Definition at line 203 of file Builders.h.
|
inline |
Definition at line 192 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertProductFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 249 of file Builders.h.
| Derived & llzk::ModuleLikeBuilder< Derived >::insertProductFn | ( | std::string_view | structName, |
| mlir::Location | loc ) |
|
inline |
Definition at line 216 of file Builders.h.
|
inline |
Definition at line 208 of file Builders.h.
|
protected |
Definition at line 52 of file Builders.h.
|
protected |
Definition at line 54 of file Builders.h.
|
protected |
Definition at line 48 of file Builders.h.
|
protected |
Definition at line 56 of file Builders.h.
|
protected |
Definition at line 50 of file Builders.h.