|
LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
|
#include "llzk/CAPI/Builder.h"#include "llzk/CAPI/Support.h"#include "llzk/Dialect/Function/IR/Ops.h"#include "llzk/Dialect/Struct/IR/Dialect.h"#include "llzk/Dialect/Struct/IR/Ops.h"#include "llzk/Dialect/Struct/IR/Types.h"#include "llzk/Util/SymbolLookup.h"#include "llzk/Util/TypeHelper.h"#include "llzk-c/Dialect/Struct.h"#include <mlir/CAPI/AffineMap.h>#include <mlir/CAPI/Registration.h>#include <mlir/CAPI/Support.h>#include <mlir/CAPI/Wrap.h>#include <mlir/IR/BuiltinAttributes.h>#include <mlir/IR/SymbolTable.h>#include <mlir-c/Support.h>#include <llvm/ADT/STLExtras.h>Go to the source code of this file.
Functions | |
| MlirType | llzkStructTypeGet (MlirAttribute name) |
| Creates a llzk::component::StructType. | |
| MlirType | llzkStructTypeGetWithArrayAttr (MlirAttribute name, MlirAttribute params) |
| Creates a llzk::component::StructType with an ArrayAttr as parameters. | |
| MlirType | llzkStructTypeGetWithAttrs (MlirAttribute name, intptr_t numParams, MlirAttribute const *params) |
| Creates a llzk::component::StructType with an array of parameters. | |
| bool | llzkTypeIsAStructType (MlirType type) |
| MlirAttribute | llzkStructTypeGetName (MlirType type) |
| Returns the fully qualified name of a llzk::component::StructType. | |
| MlirAttribute | llzkStructTypeGetParams (MlirType type) |
| Returns the parameter of a llzk::component::StructType as an ArrayAttr. | |
| MlirLogicalResult | llzkStructStructTypeGetDefinition (MlirType type, MlirOperation root, LlzkSymbolLookupResult *result) |
| Lookups the definition Operation of the given StructType using the given Operation as root for the lookup. | |
| MlirLogicalResult | llzkStructStructTypeGetDefinitionFromModule (MlirType type, MlirModule root, LlzkSymbolLookupResult *result) |
| Lookups the definition Operation of the given StructType using the given Module as root for the lookup. | |
| bool | llzkOperationIsAStructDefOp (MlirOperation op) |
| MlirRegion | llzkStructDefOpGetBodyRegion (MlirOperation op) |
| Returns the single body Region of the StructDefOp. | |
| MlirBlock | llzkStructDefOpGetBody (MlirOperation op) |
| Returns the single body Block within the StructDefOp's Region. | |
| MlirType | llzkStructDefOpGetType (MlirOperation op) |
| Returns the associated StructType to this op using the const params defined by the op. | |
| MlirType | llzkStructDefOpGetTypeWithParams (MlirOperation op, MlirAttribute attr) |
| Returns the associated StructType to this op using the given const params instead of the parameters defined by the op. | |
| MlirOperation | llzkStructDefOpGetMemberDef (MlirOperation op, MlirStringRef name) |
| Returns the operation that defines the member with the given name, if present. | |
| void | llzkStructDefOpGetMemberDefs (MlirOperation op, MlirOperation *dst) |
| Fills the given array with the MemberDefOp operations inside this struct. | |
| intptr_t | llzkStructDefOpGetNumMemberDefs (MlirOperation op) |
| Returns the number of MemberDefOp operations defined in this struct. | |
| MlirLogicalResult | llzkStructDefOpGetHasColumns (MlirOperation op) |
| Returns true if the struct has members marked as columns. | |
| MlirOperation | llzkStructDefOpGetComputeFuncOp (MlirOperation op) |
| Returns the FuncDefOp operation that defines the witness computation of the struct. | |
| MlirOperation | llzkStructDefOpGetConstrainFuncOp (MlirOperation op) |
| Returns the FuncDefOp operation that defines the constraints of the struct. | |
| const char * | llzkStructDefOpGetHeaderString (MlirOperation op, intptr_t *strSize, char *(*alloc_string)(size_t)) |
| Returns the header string of the struct. | |
| bool | llzkStructDefOpGetHasParamName (MlirOperation op, MlirStringRef name) |
| MlirAttribute | llzkStructDefOpGetFullyQualifiedName (MlirOperation op) |
| Returns a StringAttr with the fully qualified name of the struct. | |
| bool | llzkStructDefOpGetIsMainComponent (MlirOperation op) |
| bool | llzkOperationIsAMemberDefOp (MlirOperation op) |
| bool | llzkMemberDefOpGetHasPublicAttr (MlirOperation op) |
| void | llzkMemberDefOpSetPublicAttr (MlirOperation op, bool value) |
| Sets the public attribute in the given member. | |
| LLZK_DEFINE_OP_BUILD_METHOD (MemberReadOp, MlirType memberType, MlirValue component, MlirStringRef name) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (MemberReadOp, WithAffineMapDistance, MlirType memberType, MlirValue component, MlirStringRef name, MlirAffineMap map, MlirValueRange mapOperands) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (MemberReadOp, WithConstParamDistance, MlirType memberType, MlirValue component, MlirStringRef name, MlirStringRef symbol) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (MemberReadOp, WithLiteralDistance, MlirType memberType, MlirValue component, MlirStringRef name, int64_t distance) | |
| LLZK_DEFINE_OP_BUILD_METHOD | ( | MemberReadOp | , |
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirStringRef | name ) |
Definition at line 189 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | MemberReadOp | , |
| WithAffineMapDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirStringRef | name, | ||
| MlirAffineMap | map, | ||
| MlirValueRange | mapOperands ) |
Definition at line 200 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | MemberReadOp | , |
| WithConstParamDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirStringRef | name, | ||
| MlirStringRef | symbol ) |
Definition at line 216 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | MemberReadOp | , |
| WithLiteralDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirStringRef | name, | ||
| int64_t | distance ) |
Definition at line 229 of file Struct.cpp.
| bool llzkMemberDefOpGetHasPublicAttr | ( | MlirOperation | op | ) |
Definition at line 177 of file Struct.cpp.
| void llzkMemberDefOpSetPublicAttr | ( | MlirOperation | op, |
| bool | value ) |
Sets the public attribute in the given member.
Definition at line 181 of file Struct.cpp.
| bool llzkOperationIsAMemberDefOp | ( | MlirOperation | op | ) |
Definition at line 175 of file Struct.cpp.
| bool llzkOperationIsAStructDefOp | ( | MlirOperation | op | ) |
Definition at line 100 of file Struct.cpp.
| MlirBlock llzkStructDefOpGetBody | ( | MlirOperation | op | ) |
Returns the single body Block within the StructDefOp's Region.
Definition at line 106 of file Struct.cpp.
| MlirRegion llzkStructDefOpGetBodyRegion | ( | MlirOperation | op | ) |
Returns the single body Region of the StructDefOp.
Definition at line 102 of file Struct.cpp.
| MlirOperation llzkStructDefOpGetComputeFuncOp | ( | MlirOperation | op | ) |
Returns the FuncDefOp operation that defines the witness computation of the struct.
Definition at line 140 of file Struct.cpp.
| MlirOperation llzkStructDefOpGetConstrainFuncOp | ( | MlirOperation | op | ) |
Returns the FuncDefOp operation that defines the constraints of the struct.
Definition at line 144 of file Struct.cpp.
| MlirAttribute llzkStructDefOpGetFullyQualifiedName | ( | MlirOperation | op | ) |
Returns a StringAttr with the fully qualified name of the struct.
Definition at line 163 of file Struct.cpp.
| MlirLogicalResult llzkStructDefOpGetHasColumns | ( | MlirOperation | op | ) |
Returns true if the struct has members marked as columns.
Definition at line 136 of file Struct.cpp.
| bool llzkStructDefOpGetHasParamName | ( | MlirOperation | op, |
| MlirStringRef | name ) |
Definition at line 158 of file Struct.cpp.
| const char * llzkStructDefOpGetHeaderString | ( | MlirOperation | op, |
| intptr_t * | dstSize, | ||
| char *(* | alloc_string )(size_t) ) |
Returns the header string of the struct.
The size of the string is written into the given size pointer. The caller is responsible of freeing the string and of providing an allocator.
Definition at line 149 of file Struct.cpp.
| bool llzkStructDefOpGetIsMainComponent | ( | MlirOperation | op | ) |
Definition at line 167 of file Struct.cpp.
| MlirOperation llzkStructDefOpGetMemberDef | ( | MlirOperation | op, |
| MlirStringRef | name ) |
Returns the operation that defines the member with the given name, if present.
Definition at line 118 of file Struct.cpp.
| void llzkStructDefOpGetMemberDefs | ( | MlirOperation | op, |
| MlirOperation * | dst ) |
Fills the given array with the MemberDefOp operations inside this struct.
The pointer to the operations must have been preallocated. See llzkStructDefOpGetNumMemberDefs for obtaining the required size of the array.
Definition at line 125 of file Struct.cpp.
| intptr_t llzkStructDefOpGetNumMemberDefs | ( | MlirOperation | op | ) |
Returns the number of MemberDefOp operations defined in this struct.
Definition at line 132 of file Struct.cpp.
| MlirType llzkStructDefOpGetType | ( | MlirOperation | op | ) |
Returns the associated StructType to this op using the const params defined by the op.
Definition at line 110 of file Struct.cpp.
| MlirType llzkStructDefOpGetTypeWithParams | ( | MlirOperation | op, |
| MlirAttribute | params ) |
Returns the associated StructType to this op using the given const params instead of the parameters defined by the op.
The const params are defined in the given attribute which has to be of type ArrayAttr.
Definition at line 114 of file Struct.cpp.
| MlirLogicalResult llzkStructStructTypeGetDefinition | ( | MlirType | type, |
| MlirOperation | root, | ||
| LlzkSymbolLookupResult * | result ) |
Lookups the definition Operation of the given StructType using the given Operation as root for the lookup.
The definition Operation is wrapped in a LlzkSymbolLookupResult that the caller is responsible for cleaning up.
If the function returns 'success' the lookup result will be stored in the given pointer. Accessing the lookup result if the function returns 'failure' is undefined behavior.
Requires that the given Operation implements the SymbolTable op interface.
Definition at line 74 of file Struct.cpp.
| MlirLogicalResult llzkStructStructTypeGetDefinitionFromModule | ( | MlirType | type, |
| MlirModule | root, | ||
| LlzkSymbolLookupResult * | result ) |
Lookups the definition Operation of the given StructType using the given Module as root for the lookup.
The definition Operation is wrapped in a LlzkSymbolLookupResult that the caller is responsible for cleaning up.
If the function returns 'success' the lookup result will be stored in the given pointer. Accessing the lookup result if the function returns 'failure' is undefined behavior.
Definition at line 90 of file Struct.cpp.
| MlirType llzkStructTypeGet | ( | MlirAttribute | name | ) |
Creates a llzk::component::StructType.
The name attribute must be a SymbolRefAttr.
Definition at line 42 of file Struct.cpp.
| MlirAttribute llzkStructTypeGetName | ( | MlirType | type | ) |
Returns the fully qualified name of a llzk::component::StructType.
Definition at line 66 of file Struct.cpp.
| MlirAttribute llzkStructTypeGetParams | ( | MlirType | type | ) |
Returns the parameter of a llzk::component::StructType as an ArrayAttr.
Definition at line 70 of file Struct.cpp.
| MlirType llzkStructTypeGetWithArrayAttr | ( | MlirAttribute | name, |
| MlirAttribute | params ) |
Creates a llzk::component::StructType with an ArrayAttr as parameters.
The name attribute must be a SymbolRefAttr.
Definition at line 46 of file Struct.cpp.
| MlirType llzkStructTypeGetWithAttrs | ( | MlirAttribute | name, |
| intptr_t | numParams, | ||
| MlirAttribute const * | params ) |
Creates a llzk::component::StructType with an array of parameters.
The name attribute must be a SymbolRefAttr.
Definition at line 55 of file Struct.cpp.
| bool llzkTypeIsAStructType | ( | MlirType | type | ) |
Definition at line 64 of file Struct.cpp.