|
LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
#include "llzk-c/Dialect/Struct.h"#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/Dialect/Struct/Transforms/TransformationPasses.h"#include "llzk/Util/Compare.h"#include "llzk/Util/SymbolLookup.h"#include "llzk/Util/TypeHelper.h"#include <mlir-c/BuiltinAttributes.h>#include <mlir-c/Pass.h>#include <mlir-c/Support.h>#include <mlir/CAPI/AffineMap.h>#include <mlir/CAPI/Pass.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 <llvm/ADT/STLExtras.h>#include "llzk/Dialect/Struct/IR/Ops.capi.cpp.inc"#include "llzk/Dialect/Struct/IR/Types.capi.cpp.inc"#include "llzk/Dialect/Struct/Transforms/TransformationPasses.capi.cpp.inc"Go to the source code of this file.
Functions | |
| MlirType | llzkStruct_StructTypeGet (MlirAttribute name) |
| Creates a llzk::component::StructType. | |
| MlirType | llzkStruct_StructTypeGetWithArrayAttr (MlirAttribute name, MlirAttribute params) |
| Creates a llzk::component::StructType with an ArrayAttr as parameters. | |
| MlirType | llzkStruct_StructTypeGetWithAttrs (MlirAttribute name, intptr_t numParams, MlirAttribute const *params) |
| Creates a llzk::component::StructType with an array of parameters. | |
| 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. | |
| MlirBlock | llzkStruct_StructDefOpGetBody (MlirOperation op) |
| Returns the single body Block within the StructDefOp's Region. | |
| MlirType | llzkStruct_StructDefOpGetType (MlirOperation op) |
| Returns the associated StructType to this op using the const params defined by the op. | |
| MlirType | llzkStruct_StructDefOpGetTypeWithParams (MlirOperation op, MlirAttribute attr) |
| Returns the associated StructType to this op using the given const params instead of the parameters defined by the op. | |
| void | llzkStruct_StructDefOpGetMemberDefs (MlirOperation op, MlirOperation *dst) |
| Fills the given array with the MemberDefOp operations inside this struct. | |
| intptr_t | llzkStruct_StructDefOpGetNumMemberDefs (MlirOperation op) |
| Returns the number of MemberDefOp operations defined in this struct. | |
| const char * | llzkStruct_StructDefOpGetHeaderString (MlirOperation op, intptr_t *strSize, char *(*alloc_string)(size_t)) |
| Returns the header string of the struct. | |
| void | llzkStruct_StructDefOpGetTemplateParamOpNames (MlirOperation op, MlirAttribute *dst) |
| If this struct.def is within a poly.template, add names of all poly.param within the poly.template in the order they are defined. | |
| intptr_t | llzkStruct_StructDefOpGetNumTemplateParamOpNames (MlirOperation op) |
| Returns the number of poly.param operations defined within this template. | |
| void | llzkStruct_StructDefOpGetTemplateExprOpNames (MlirOperation op, MlirAttribute *dst) |
| If this struct.def is within a poly.template, add names of all poly.expr within the poly.template in the order they are defined. | |
| intptr_t | llzkStruct_StructDefOpGetNumTemplateExprOpNames (MlirOperation op) |
| Returns the number of poly.expr operations defined within this template. | |
| LLZK_DEFINE_OP_BUILD_METHOD (Struct, MemberDefOp, MlirStringRef name, MlirType type, bool isSignal, bool isColumn) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Struct, MemberDefOp, WithAttrs, MlirAttribute name, MlirAttribute type, bool isSignal, bool isColumn) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Struct, MemberDefOp, WithNamedAttrs, intptr_t numAttrs, MlirNamedAttribute const *attrs, bool isSignal, bool isColumn) | |
| bool | llzkStruct_MemberDefOpGetColumnValue (MlirOperation op) |
| Returns whether this member supports offset table accesses. | |
| void | llzkStruct_MemberDefOpSetColumnValue (MlirOperation op, bool newValue) |
| Adds or removes the unit column attribute according to newValue. | |
| bool | llzkStruct_MemberDefOpGetSignalValue (MlirOperation op) |
| Returns whether this member is stored as a witness signal. | |
| void | llzkStruct_MemberDefOpSetSignalValue (MlirOperation op, bool newValue) |
| Adds or removes the unit signal attribute according to newValue. | |
| LLZK_DEFINE_OP_BUILD_METHOD (Struct, MemberReadOp, MlirType memberType, MlirValue component, MlirIdentifier memberName) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Struct, MemberReadOp, WithAffineMapDistance, MlirType memberType, MlirValue component, MlirIdentifier memberName, MlirAffineMap map, MlirValueRange mapOperands) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Struct, MemberReadOp, WithTemplateSymbolDistance, MlirType memberType, MlirValue component, MlirIdentifier memberName, MlirStringRef symbol) | |
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Struct, MemberReadOp, WithLiteralDistance, MlirType memberType, MlirValue component, MlirIdentifier memberName, int64_t distance) | |
| LLZK_DEFINE_OP_BUILD_METHOD | ( | Struct | , |
| MemberDefOp | , | ||
| MlirStringRef | name, | ||
| MlirType | type, | ||
| bool | isSignal, | ||
| bool | isColumn ) |
Definition at line 166 of file Struct.cpp.
| LLZK_DEFINE_OP_BUILD_METHOD | ( | Struct | , |
| MemberReadOp | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirIdentifier | memberName ) |
Definition at line 223 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | Struct | , |
| MemberDefOp | , | ||
| WithAttrs | , | ||
| MlirAttribute | name, | ||
| MlirAttribute | type, | ||
| bool | isSignal, | ||
| bool | isColumn ) |
Definition at line 175 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | Struct | , |
| MemberDefOp | , | ||
| WithNamedAttrs | , | ||
| intptr_t | numAttrs, | ||
| MlirNamedAttribute const * | attrs, | ||
| bool | isSignal, | ||
| bool | isColumn ) |
Definition at line 189 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | Struct | , |
| MemberReadOp | , | ||
| WithAffineMapDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirIdentifier | memberName, | ||
| MlirAffineMap | map, | ||
| MlirValueRange | mapOperands ) |
Definition at line 235 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | Struct | , |
| MemberReadOp | , | ||
| WithLiteralDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirIdentifier | memberName, | ||
| int64_t | distance ) |
Definition at line 266 of file Struct.cpp.
| LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD | ( | Struct | , |
| MemberReadOp | , | ||
| WithTemplateSymbolDistance | , | ||
| MlirType | memberType, | ||
| MlirValue | component, | ||
| MlirIdentifier | memberName, | ||
| MlirStringRef | symbol ) |
Definition at line 252 of file Struct.cpp.
| bool llzkStruct_MemberDefOpGetColumnValue | ( | MlirOperation | op | ) |
Returns whether this member supports offset table accesses.
Definition at line 203 of file Struct.cpp.
| bool llzkStruct_MemberDefOpGetSignalValue | ( | MlirOperation | op | ) |
Returns whether this member is stored as a witness signal.
Definition at line 211 of file Struct.cpp.
| void llzkStruct_MemberDefOpSetColumnValue | ( | MlirOperation | op, |
| bool | newValue ) |
Adds or removes the unit column attribute according to newValue.
Definition at line 207 of file Struct.cpp.
| void llzkStruct_MemberDefOpSetSignalValue | ( | MlirOperation | op, |
| bool | newValue ) |
Adds or removes the unit signal attribute according to newValue.
Definition at line 215 of file Struct.cpp.
| MlirBlock llzkStruct_StructDefOpGetBody | ( | MlirOperation | op | ) |
Returns the single body Block within the StructDefOp's Region.
Definition at line 102 of file Struct.cpp.
| const char * llzkStruct_StructDefOpGetHeaderString | ( | 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 125 of file Struct.cpp.
| void llzkStruct_StructDefOpGetMemberDefs | ( | 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 llzkStruct_StructDefOpGetNumMemberDefs for obtaining the required size of the array.
Definition at line 114 of file Struct.cpp.
| intptr_t llzkStruct_StructDefOpGetNumMemberDefs | ( | MlirOperation | op | ) |
Returns the number of MemberDefOp operations defined in this struct.
Definition at line 121 of file Struct.cpp.
| intptr_t llzkStruct_StructDefOpGetNumTemplateExprOpNames | ( | MlirOperation | op | ) |
Returns the number of poly.expr operations defined within this template.
Definition at line 156 of file Struct.cpp.
| intptr_t llzkStruct_StructDefOpGetNumTemplateParamOpNames | ( | MlirOperation | op | ) |
Returns the number of poly.param operations defined within this template.
Definition at line 143 of file Struct.cpp.
| void llzkStruct_StructDefOpGetTemplateExprOpNames | ( | MlirOperation | op, |
| MlirAttribute * | dst ) |
If this struct.def is within a poly.template, add names of all poly.expr within the poly.template in the order they are defined.
Otherwise, do nothing. The names are added as FlatSymbolRefAttr but the more general Attribute type is used in the type since that's usually what's needed.
The pointer to the attributes must have been preallocated. See llzkStruct_StructDefOpGetNumTemplateExprOpNames for obtaining the required size of the array.
Definition at line 149 of file Struct.cpp.
| void llzkStruct_StructDefOpGetTemplateParamOpNames | ( | MlirOperation | op, |
| MlirAttribute * | dst ) |
If this struct.def is within a poly.template, add names of all poly.param within the poly.template in the order they are defined.
Otherwise, do nothing. The names are added as FlatSymbolRefAttr but the more general Attribute type is used in the type since that's usually what's needed.
The pointer to the attributes must have been preallocated. See llzkStruct_StructDefOpGetNumTemplateParamOpNames for obtaining the required size of the array.
Definition at line 136 of file Struct.cpp.
| MlirType llzkStruct_StructDefOpGetType | ( | MlirOperation | op | ) |
Returns the associated StructType to this op using the const params defined by the op.
Definition at line 106 of file Struct.cpp.
| MlirType llzkStruct_StructDefOpGetTypeWithParams | ( | 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 110 of file Struct.cpp.
| MlirType llzkStruct_StructTypeGet | ( | MlirAttribute | name | ) |
Creates a llzk::component::StructType.
The name attribute must be a SymbolRefAttr.
Definition at line 54 of file Struct.cpp.
| MlirType llzkStruct_StructTypeGetWithArrayAttr | ( | MlirAttribute | name, |
| MlirAttribute | params ) |
Creates a llzk::component::StructType with an ArrayAttr as parameters.
The name attribute must be a SymbolRefAttr.
Definition at line 58 of file Struct.cpp.
| MlirType llzkStruct_StructTypeGetWithAttrs | ( | 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 66 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 76 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 92 of file Struct.cpp.