|
LLZK 0.1.0
Veridise's ZK Language IR
|
Builds out a LLZK-compliant module and provides utilities for populating that module. More...
#include <Builders.h>
Public Member Functions | |
| ModuleBuilder (mlir::ModuleOp m) | |
| mlir::Location | getUnknownLoc () |
| ModuleBuilder & | insertEmptyStruct (std::string_view structName, mlir::Location loc, int numStructParams=-1) |
| ModuleBuilder & | insertEmptyStruct (std::string_view structName, int numStructParams=-1) |
| ModuleBuilder & | insertComputeOnlyStruct (std::string_view structName, mlir::Location structLoc, mlir::Location computeLoc) |
| ModuleBuilder & | insertComputeOnlyStruct (std::string_view structName) |
| ModuleBuilder & | insertConstrainOnlyStruct (std::string_view structName, mlir::Location structLoc, mlir::Location constrainLoc) |
| ModuleBuilder & | insertConstrainOnlyStruct (std::string_view structName) |
| ModuleBuilder & | insertFullStruct (std::string_view structName, mlir::Location structLoc, mlir::Location computeLoc, mlir::Location constrainLoc, int numStructParams=-1) |
| ModuleBuilder & | insertFullStruct (std::string_view structName, int numStructParams=-1) |
| Inserts a struct with both compute and constrain functions. | |
| ModuleBuilder & | insertProductStruct (std::string_view structName, mlir::Location structLoc, mlir::Location productLoc) |
| ModuleBuilder & | insertProductStruct (std::string_view structName) |
| ModuleBuilder & | insertComputeFn (component::StructDefOp op, mlir::Location loc) |
| ModuleBuilder & | insertComputeFn (std::string_view structName, mlir::Location loc) |
| ModuleBuilder & | insertComputeFn (std::string_view structName) |
| ModuleBuilder & | insertConstrainFn (component::StructDefOp op, mlir::Location loc) |
| ModuleBuilder & | insertConstrainFn (std::string_view structName, mlir::Location loc) |
| ModuleBuilder & | insertConstrainFn (std::string_view structName) |
| ModuleBuilder & | insertProductFn (component::StructDefOp op, mlir::Location loc) |
| ModuleBuilder & | insertProductFn (std::string_view structName, mlir::Location loc) |
| ModuleBuilder & | insertProductFn (std::string_view structName) |
| ModuleBuilder & | insertComputeCall (component::StructDefOp caller, component::StructDefOp callee, mlir::Location callLoc) |
| Only requirement for compute is the call itself. | |
| ModuleBuilder & | insertComputeCall (std::string_view caller, std::string_view callee, mlir::Location callLoc) |
| ModuleBuilder & | insertComputeCall (std::string_view caller, std::string_view callee) |
| ModuleBuilder & | insertConstrainCall (component::StructDefOp caller, component::StructDefOp callee, mlir::Location callLoc, mlir::Location fieldDefLoc) |
| To call a constraint function, you must: | |
| ModuleBuilder & | insertConstrainCall (std::string_view caller, std::string_view callee, mlir::Location callLoc, mlir::Location fieldDefLoc) |
| ModuleBuilder & | insertConstrainCall (std::string_view caller, std::string_view callee) |
| ModuleBuilder & | insertFreeFunc (std::string_view funcName, ::mlir::FunctionType type, mlir::Location loc) |
| ModuleBuilder & | insertFreeFunc (std::string_view funcName, ::mlir::FunctionType type) |
| ModuleBuilder & | insertFreeCall (function::FuncDefOp caller, std::string_view callee, mlir::Location callLoc) |
| ModuleBuilder & | insertFreeCall (function::FuncDefOp caller, std::string_view callee) |
| mlir::ModuleOp & | getRootModule () |
| Get the top-level LLZK module. | |
| 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 |
| mlir::FailureOr< function::FuncDefOp > | getFunc (function::FunctionKind kind, std::string_view name) const |
| bool | computeReachable (component::StructDefOp caller, component::StructDefOp callee) |
| Returns if the callee compute function is reachable by the caller by construction. | |
| bool | computeReachable (std::string_view caller, std::string_view callee) |
| bool | constrainReachable (component::StructDefOp caller, component::StructDefOp callee) |
| Returns if the callee compute function is reachable by the caller by construction. | |
| bool | constrainReachable (std::string_view caller, std::string_view callee) |
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. | |
Builds out a LLZK-compliant module and provides utilities for populating that module.
This class is designed to be used by front-ends looking to generate LLZK IR programmatically and is also a useful unit testing facility. TODO: this is a WIP, flesh this class out as needed.
Definition at line 41 of file Builders.h.
|
inline |
Definition at line 43 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 125 of file Builders.cpp.
|
static |
constrain accepts the struct type as the first argument.
Definition at line 143 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 161 of file Builders.cpp.
|
inline |
Returns if the callee compute function is reachable by the caller by construction.
Definition at line 265 of file Builders.h.
|
inline |
Definition at line 268 of file Builders.h.
|
inline |
Returns if the callee compute function is reachable by the caller by construction.
Definition at line 275 of file Builders.h.
|
inline |
Definition at line 278 of file Builders.h.
|
inline |
Definition at line 214 of file Builders.h.
|
inline |
Definition at line 208 of file Builders.h.
|
inline |
Definition at line 224 of file Builders.h.
|
inline |
Definition at line 218 of file Builders.h.
|
inline |
Definition at line 238 of file Builders.h.
|
inline |
Definition at line 246 of file Builders.h.
|
inline |
Definition at line 234 of file Builders.h.
|
inline |
Definition at line 228 of file Builders.h.
|
inline |
Get the top-level LLZK module.
Definition at line 199 of file Builders.h.
|
inline |
Definition at line 201 of file Builders.h.
|
inline |
Definition at line 47 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::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 160 of file Builders.h.
|
inline |
Definition at line 157 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertComputeFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 119 of file Builders.h.
|
inline |
Definition at line 116 of file Builders.h.
|
inline |
Definition at line 63 of file Builders.h.
|
inline |
Definition at line 55 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertConstrainCall | ( | component::StructDefOp | caller, |
| component::StructDefOp | callee, | ||
| mlir::Location | callLoc, | ||
| mlir::Location | fieldDefLoc ) |
To call a constraint function, you must:
|
inline |
Definition at line 180 of file Builders.h.
|
inline |
Definition at line 174 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertConstrainFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 131 of file Builders.h.
|
inline |
Definition at line 128 of file Builders.h.
|
inline |
Definition at line 76 of file Builders.h.
|
inline |
Definition at line 68 of file Builders.h.
|
inline |
Definition at line 51 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertEmptyStruct | ( | std::string_view | structName, |
| mlir::Location | loc, | ||
| int | numStructParams = -1 ) |
|
inline |
Definition at line 192 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertFreeCall | ( | function::FuncDefOp | caller, |
| std::string_view | callee, | ||
| mlir::Location | callLoc ) |
|
inline |
Definition at line 186 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertFreeFunc | ( | std::string_view | funcName, |
| ::mlir::FunctionType | type, | ||
| mlir::Location | loc ) |
|
inline |
Inserts a struct with both compute and constrain functions.
Definition at line 92 of file Builders.h.
|
inline |
Definition at line 81 of file Builders.h.
| ModuleBuilder & llzk::ModuleBuilder::insertProductFn | ( | component::StructDefOp | op, |
| mlir::Location | loc ) |
|
inline |
Definition at line 144 of file Builders.h.
|
inline |
Definition at line 141 of file Builders.h.
|
inline |
Definition at line 105 of file Builders.h.
|
inline |
Definition at line 97 of file Builders.h.