LLZK 0.1.0
Veridise's ZK Language IR
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_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, intptr_t numMapOperands, MlirValueRange const *mapOperands, MlirAttribute numDimsPerMap, intptr_t numArgOperands, MlirValue const *argOperands)
 Creates a CallOp with affine map operands.
 
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, WithMapOperandsAndDims, intptr_t numResults, MlirType const *results, MlirAttribute name, intptr_t numMapOperands, MlirValueRange const *mapOperands, intptr_t numDimsPermMapLength, int32_t const *numDimsPerMap, intptr_t numArgOperands, MlirValue const *argOperands)
 Creates a CallOp with affine map operands.
 
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCalleeWithMapOperands, MlirOperation callee, intptr_t numMapOperands, MlirValueRange const *mapOperands, MlirAttribute numDimsPerMap, intptr_t numArgOperands, MlirValue const *argOperands)
 Creates a CallOp with affine map operands to the given FuncDefOp.
 
 LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCalleeWithMapOperandsAndDims, MlirOperation callee, intptr_t numMapOperands, MlirValueRange const *mapOperands, intptr_t numDimsPermMapLength, int32_t const *numDimsPerMap, 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/11]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsCompute  )

Returns true if the callee is named 'compute'.

◆ LLZK_DECLARE_OP_PREDICATE() [2/11]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsConstrain  )

Returns true if the callee is named 'constrain'.

◆ LLZK_DECLARE_OP_PREDICATE() [3/11]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsStructCompute  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [4/11]

LLZK_DECLARE_OP_PREDICATE ( CallOp ,
CalleeIsStructConstrain  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [5/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
HasAllowConstraintAttr  )

Returns true if the FuncDefOp has the allow_constraint attribute.

◆ LLZK_DECLARE_OP_PREDICATE() [6/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
HasAllowWitnessAttr  )

Returns true if the FuncDefOp has the allow_witness attribute.

◆ LLZK_DECLARE_OP_PREDICATE() [7/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsInStruct  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [8/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsStructCompute  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [9/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
IsStructConstrain  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [10/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
NameIsCompute  )

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

◆ LLZK_DECLARE_OP_PREDICATE() [11/11]

LLZK_DECLARE_OP_PREDICATE ( FuncDefOp ,
NameIsConstrain  )

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

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [1/5]

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/5]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
ToCalleeWithMapOperands ,
MlirOperation callee,
intptr_t numMapOperands,
MlirValueRange const * mapOperands,
MlirAttribute numDimsPerMap,
intptr_t numArgOperands,
MlirValue const * argOperands )

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

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [3/5]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
ToCalleeWithMapOperandsAndDims ,
MlirOperation callee,
intptr_t numMapOperands,
MlirValueRange const * mapOperands,
intptr_t numDimsPermMapLength,
int32_t const * numDimsPerMap,
intptr_t numArgOperands,
MlirValue const * argOperands )

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

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [4/5]

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

Creates a CallOp with affine map operands.

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD() [5/5]

LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( CallOp ,
WithMapOperandsAndDims ,
intptr_t numResults,
MlirType const * results,
MlirAttribute name,
intptr_t numMapOperands,
MlirValueRange const * mapOperands,
intptr_t numDimsPermMapLength,
int32_t const * numDimsPerMap,
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 215 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 237 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 243 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 247 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 45 of file Function.cpp.

◆ llzkFuncDefOpGetFullyQualifiedName()

MLIR_CAPI_EXPORTED MlirAttribute llzkFuncDefOpGetFullyQualifiedName ( MlirOperation op)

Returns the fully qualified name of the function.

Definition at line 83 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 109 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 115 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 120 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 67 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 75 of file Function.cpp.

◆ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION()

MLIR_DECLARE_CAPI_DIALECT_REGISTRATION ( Function ,
llzk__function  )