LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Function.h File Reference
#include "llzk-c/Support.h"
#include <mlir-c/IR.h>
#include <mlir-c/Support.h>
#include <stdint.h>
Include dependency graph for Function.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 MLIR_DECLARE_CAPI_DIALECT_REGISTRATION (Function, llzk__function)
MLIR_CAPI_EXPORTED MlirOperation llzkFuncDefOpCreateWithAttrsAndArgAttrs (MlirLocation loc, MlirStringRef name, MlirType type, intptr_t nAttrs, MlirNamedAttribute const *attrs, intptr_t nArgAttrs, MlirAttribute const *argAttrs)
 Creates a FuncDefOp with the given attributes and argument attributes.
 LLZK_DECLARE_OP_ISA (FuncDefOp)
 Returns true if the operation is a FuncDefOp.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, HasAllowConstraintAttr)
 Returns true if the FuncDefOp has the allow_constraint attribute.
MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowConstraintAttr (MlirOperation op, bool value)
 Sets the allow_constraint attribute in the FuncDefOp operation.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, HasAllowWitnessAttr)
 Returns true if the FuncDefOp has the allow_witness attribute.
MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowWitnessAttr (MlirOperation op, bool value)
 Sets the allow_witness attribute in the FuncDefOp operation.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, HasAllowNonNativeFieldOpsAttr)
 Returns true if the FuncDefOp has the allow_non_native_field_ops attribute.
MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowNonNativeFieldOpsAttr (MlirOperation op, bool value)
 Sets the allow_non_native_field_ops attribute in the FuncDefOp operation.
 LLZK_DECLARE_NARY_OP_PREDICATE (FuncDefOp, HasArgIsPub, unsigned arg)
 Returns true if the idx-th argument has the Pub attribute.
MLIR_CAPI_EXPORTED MlirAttribute llzkFuncDefOpGetFullyQualifiedName (MlirOperation op)
 Returns the fully qualified name of the function.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, NameIsCompute)
 Returns true if the function's name is 'compute'.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, NameIsConstrain)
 Returns true if the function's name is 'constrain'.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, IsInStruct)
 Returns true if the function's defined inside a struct.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, IsStructCompute)
 Returns true if the function is the struct's witness computation.
 LLZK_DECLARE_OP_PREDICATE (FuncDefOp, IsStructConstrain)
 Returns true if the function is the struct's constrain definition.
MLIR_CAPI_EXPORTED MlirValue llzkFuncDefOpGetSelfValueFromCompute (MlirOperation op)
 Return the "self" value (i.e.
MLIR_CAPI_EXPORTED MlirValue llzkFuncDefOpGetSelfValueFromConstrain (MlirOperation op)
 Return the "self" value (i.e.
MLIR_CAPI_EXPORTED MlirType llzkFuncDefOpGetSingleResultTypeOfCompute (MlirOperation op)
 Assuming the function is the compute function, returns its StructType result.
 LLZK_DECLARE_OP_BUILD_METHOD (CallOp, intptr_t numResults, MlirType const *results, MlirAttribute name, intptr_t numOperands, MlirValue const *operands)
 Creates a CallOp.
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCallee, MlirOperation callee, intptr_t numOperands, MlirValue const *operands)
 Creates a CallOp that calls the given FuncDefOp.
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, WithMapOperands, intptr_t numResults, MlirType const *results, MlirAttribute name, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
 Creates a CallOp with affine map operands.
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCalleeWithMapOperands, MlirOperation callee, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
 Creates a CallOp with affine map operands to the given FuncDefOp.
 LLZK_DECLARE_OP_ISA (CallOp)
 Returns true if the operation is a CallOp.
MLIR_CAPI_EXPORTED MlirType llzkCallOpGetCalleeType (MlirOperation op)
 Returns the FunctionType of the callee.
 LLZK_DECLARE_OP_PREDICATE (CallOp, CalleeIsCompute)
 Returns true if the callee is named 'compute'.
 LLZK_DECLARE_OP_PREDICATE (CallOp, CalleeIsConstrain)
 Returns true if the callee is named 'constrain'.
 LLZK_DECLARE_OP_PREDICATE (CallOp, CalleeIsStructCompute)
 Returns true if the callee is the witness computation of a struct.
 LLZK_DECLARE_OP_PREDICATE (CallOp, CalleeIsStructConstrain)
 Returns true if the callee is the constraints definition of a struct.
MLIR_CAPI_EXPORTED MlirValue llzkCallOpGetSelfValueFromCompute (MlirOperation op)
 Return the "self" value (i.e.
MLIR_CAPI_EXPORTED MlirValue llzkCallOpGetSelfValueFromConstrain (MlirOperation op)
 Return the "self" value (i.e.
MLIR_CAPI_EXPORTED MlirType llzkCallOpGetSingleResultTypeOfCompute (MlirOperation op)
 Assuming the callee is the compute function, returns its StructType result.

Function Documentation

◆ LLZK_DECLARE_NARY_OP_PREDICATE()

LLZK_DECLARE_NARY_OP_PREDICATE ( FuncDefOp ,
HasArgIsPub ,
unsigned arg )

Returns true if the idx-th argument has the Pub attribute.

◆ LLZK_DECLARE_OP_BUILD_METHOD()

LLZK_DECLARE_OP_BUILD_METHOD ( CallOp ,
intptr_t numResults,
MlirType const * results,
MlirAttribute name,
intptr_t numOperands,
MlirValue const * operands )

Creates a CallOp.

◆ LLZK_DECLARE_OP_ISA() [1/2]

LLZK_DECLARE_OP_ISA ( CallOp )

Returns true if the operation is a CallOp.

◆ LLZK_DECLARE_OP_ISA() [2/2]

LLZK_DECLARE_OP_ISA ( FuncDefOp )

Returns true if the operation is a FuncDefOp.

◆ LLZK_DECLARE_OP_PREDICATE() [1/12]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsCompute  )

Returns true if the callee is named 'compute'.

◆ LLZK_DECLARE_OP_PREDICATE() [2/12]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsConstrain  )

Returns true if the callee is named 'constrain'.

◆ LLZK_DECLARE_OP_PREDICATE() [3/12]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsStructCompute  )

Returns true if the callee is the witness computation of a struct.

◆ LLZK_DECLARE_OP_PREDICATE() [4/12]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsStructConstrain  )

Returns true if the callee is the constraints definition of a struct.

◆ LLZK_DECLARE_OP_PREDICATE() [5/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
HasAllowConstraintAttr  )

Returns true if the FuncDefOp has the allow_constraint attribute.

◆ LLZK_DECLARE_OP_PREDICATE() [6/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
HasAllowNonNativeFieldOpsAttr  )

Returns true if the FuncDefOp has the allow_non_native_field_ops attribute.

◆ LLZK_DECLARE_OP_PREDICATE() [7/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
HasAllowWitnessAttr  )

Returns true if the FuncDefOp has the allow_witness attribute.

◆ LLZK_DECLARE_OP_PREDICATE() [8/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsInStruct  )

Returns true if the function's defined inside a struct.

◆ LLZK_DECLARE_OP_PREDICATE() [9/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsStructCompute  )

Returns true if the function is the struct's witness computation.

◆ LLZK_DECLARE_OP_PREDICATE() [10/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsStructConstrain  )

Returns true if the function is the struct's constrain definition.

◆ LLZK_DECLARE_OP_PREDICATE() [11/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
NameIsCompute  )

Returns true if the function's name is 'compute'.

◆ LLZK_DECLARE_OP_PREDICATE() [12/12]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
NameIsConstrain  )

Returns true if the function's name is 'constrain'.

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [1/3]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
ToCallee ,
MlirOperation callee,
intptr_t numOperands,
MlirValue const * operands )

Creates a CallOp that calls the given FuncDefOp.

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [2/3]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
ToCalleeWithMapOperands ,
MlirOperation callee,
LlzkAffineMapOperandsBuilder mapOperands,
intptr_t numArgOperands,
MlirValue const * argOperands )

Creates a CallOp with affine map operands to the given FuncDefOp.

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [3/3]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
WithMapOperands ,
intptr_t numResults,
MlirType const * results,
MlirAttribute name,
LlzkAffineMapOperandsBuilder mapOperands,
intptr_t numArgOperands,
MlirValue const * argOperands )

Creates a CallOp with affine map operands.

◆ llzkCallOpGetCalleeType()

MLIR_CAPI_EXPORTED MlirType llzkCallOpGetCalleeType ( MlirOperation op)

Returns the FunctionType of the callee.

Definition at line 206 of file Function.cpp.

◆ llzkCallOpGetSelfValueFromCompute()

MLIR_CAPI_EXPORTED MlirValue llzkCallOpGetSelfValueFromCompute ( MlirOperation op)

Return the "self" value (i.e.

the return value) from the callee function (which must be named FUNC_NAME_COMPUTE).

Definition at line 228 of file Function.cpp.

◆ llzkCallOpGetSelfValueFromConstrain()

MLIR_CAPI_EXPORTED MlirValue llzkCallOpGetSelfValueFromConstrain ( MlirOperation op)

Return the "self" value (i.e.

the first parameter) from the callee function (which must be named FUNC_NAME_CONSTRAIN).

Definition at line 234 of file Function.cpp.

◆ llzkCallOpGetSingleResultTypeOfCompute()

MLIR_CAPI_EXPORTED MlirType llzkCallOpGetSingleResultTypeOfCompute ( MlirOperation op)

Assuming the callee is the compute function, returns its StructType result.

Definition at line 238 of file Function.cpp.

◆ llzkFuncDefOpCreateWithAttrsAndArgAttrs()

MLIR_CAPI_EXPORTED MlirOperation llzkFuncDefOpCreateWithAttrsAndArgAttrs ( MlirLocation location,
MlirStringRef name,
MlirType funcType,
intptr_t numAttrs,
MlirNamedAttribute const * attrs,
intptr_t numArgAttrs,
MlirAttribute const * argAttrs )

Creates a FuncDefOp with the given attributes and argument attributes.

Each argument attribute has to be a DictionaryAttr.

Definition at line 46 of file Function.cpp.

◆ llzkFuncDefOpGetFullyQualifiedName()

MLIR_CAPI_EXPORTED MlirAttribute llzkFuncDefOpGetFullyQualifiedName ( MlirOperation op)

Returns the fully qualified name of the function.

Definition at line 94 of file Function.cpp.

◆ llzkFuncDefOpGetSelfValueFromCompute()

MLIR_CAPI_EXPORTED MlirValue llzkFuncDefOpGetSelfValueFromCompute ( MlirOperation op)

Return the "self" value (i.e.

the return value) from the function (which must be named FUNC_NAME_COMPUTE).

Definition at line 120 of file Function.cpp.

◆ llzkFuncDefOpGetSelfValueFromConstrain()

MLIR_CAPI_EXPORTED MlirValue llzkFuncDefOpGetSelfValueFromConstrain ( MlirOperation op)

Return the "self" value (i.e.

the first parameter) from the function (which must be named FUNC_NAME_CONSTRAIN).

Definition at line 126 of file Function.cpp.

◆ llzkFuncDefOpGetSingleResultTypeOfCompute()

MLIR_CAPI_EXPORTED MlirType llzkFuncDefOpGetSingleResultTypeOfCompute ( MlirOperation op)

Assuming the function is the compute function, returns its StructType result.

Assuming the function is the compute function, returns its StructType result.

Definition at line 131 of file Function.cpp.

◆ llzkFuncDefOpSetAllowConstraintAttr()

MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowConstraintAttr ( MlirOperation op,
bool value )

Sets the allow_constraint attribute in the FuncDefOp operation.

Definition at line 70 of file Function.cpp.

◆ llzkFuncDefOpSetAllowNonNativeFieldOpsAttr()

MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowNonNativeFieldOpsAttr ( MlirOperation op,
bool value )

Sets the allow_non_native_field_ops attribute in the FuncDefOp operation.

Definition at line 86 of file Function.cpp.

◆ llzkFuncDefOpSetAllowWitnessAttr()

MLIR_CAPI_EXPORTED void llzkFuncDefOpSetAllowWitnessAttr ( MlirOperation op,
bool value )

Sets the allow_witness attribute in the FuncDefOp operation.

Definition at line 78 of file Function.cpp.

◆ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION()

MLIR_DECLARE_CAPI_DIALECT_REGISTRATION ( Function ,
llzk__function  )