LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Function.cpp File Reference
#include "llzk/CAPI/Builder.h"
#include "llzk/CAPI/Support.h"
#include "llzk/Dialect/Function/IR/Dialect.h"
#include "llzk/Dialect/Function/IR/Ops.h"
#include "llzk-c/Dialect/Function.h"
#include "llzk-c/Support.h"
#include <mlir/CAPI/IR.h>
#include <mlir/CAPI/Pass.h>
#include <mlir/CAPI/Registration.h>
#include <mlir/CAPI/Wrap.h>
#include <mlir/IR/Attributes.h>
#include <mlir/IR/BuiltinAttributes.h>
#include <mlir-c/IR.h>
#include <mlir-c/Pass.h>
#include <llvm/ADT/SmallVectorExtras.h>
Include dependency graph for Function.cpp:

Go to the source code of this file.

Functions

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.
bool llzkOperationIsAFuncDefOp (MlirOperation op)
bool llzkFuncDefOpGetHasAllowConstraintAttr (MlirOperation op)
void llzkFuncDefOpSetAllowConstraintAttr (MlirOperation op, bool value)
 Sets the allow_constraint attribute in the FuncDefOp operation.
bool llzkFuncDefOpGetHasAllowWitnessAttr (MlirOperation op)
void llzkFuncDefOpSetAllowWitnessAttr (MlirOperation op, bool value)
 Sets the allow_witness attribute in the FuncDefOp operation.
bool llzkFuncDefOpGetHasAllowNonNativeFieldOpsAttr (MlirOperation op)
void llzkFuncDefOpSetAllowNonNativeFieldOpsAttr (MlirOperation op, bool value)
 Sets the allow_non_native_field_ops attribute in the FuncDefOp operation.
bool llzkFuncDefOpGetHasArgIsPub (MlirOperation op, unsigned argNo)
MlirAttribute llzkFuncDefOpGetFullyQualifiedName (MlirOperation op)
 Returns the fully qualified name of the function.
bool llzkFuncDefOpGetNameIsCompute (MlirOperation op)
bool llzkFuncDefOpGetNameIsConstrain (MlirOperation op)
bool llzkFuncDefOpGetIsInStruct (MlirOperation op)
bool llzkFuncDefOpGetIsStructCompute (MlirOperation op)
bool llzkFuncDefOpGetIsStructConstrain (MlirOperation op)
MlirValue llzkFuncDefOpGetSelfValueFromCompute (MlirOperation op)
 Return the "self" value (i.e.
MlirValue llzkFuncDefOpGetSelfValueFromConstrain (MlirOperation op)
 Return the "self" value (i.e.
MlirType llzkFuncDefOpGetSingleResultTypeOfCompute (MlirOperation op)
 Assuming the function is the compute function returns its StructType result.
 LLZK_DEFINE_OP_BUILD_METHOD (CallOp, intptr_t numResults, MlirType const *results, MlirAttribute name, intptr_t numOperands, MlirValue const *operands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCallee, MlirOperation callee, intptr_t numOperands, MlirValue const *operands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (CallOp, WithMapOperands, intptr_t numResults, MlirType const *results, MlirAttribute name, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (CallOp, ToCalleeWithMapOperands, MlirOperation callee, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
bool llzkOperationIsACallOp (MlirOperation op)
MlirType llzkCallOpGetCalleeType (MlirOperation op)
 Returns the FunctionType of the callee.
bool llzkCallOpGetCalleeIsCompute (MlirOperation op)
bool llzkCallOpGetCalleeIsConstrain (MlirOperation op)
bool llzkCallOpGetCalleeIsStructCompute (MlirOperation op)
bool llzkCallOpGetCalleeIsStructConstrain (MlirOperation op)
MlirValue llzkCallOpGetSelfValueFromCompute (MlirOperation op)
 Return the "self" value (i.e.
MlirValue llzkCallOpGetSelfValueFromConstrain (MlirOperation op)
 Return the "self" value (i.e.
MlirType llzkCallOpGetSingleResultTypeOfCompute (MlirOperation op)
 Assuming the callee is the compute function, returns its StructType result.

Function Documentation

◆ LLZK_DEFINE_OP_BUILD_METHOD()

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

Definition at line 145 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [1/3]

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

Definition at line 159 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [2/3]

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

Definition at line 188 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [3/3]

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

Definition at line 170 of file Function.cpp.

◆ llzkCallOpGetCalleeIsCompute()

bool llzkCallOpGetCalleeIsCompute ( MlirOperation op)

Definition at line 210 of file Function.cpp.

◆ llzkCallOpGetCalleeIsConstrain()

bool llzkCallOpGetCalleeIsConstrain ( MlirOperation op)

Definition at line 214 of file Function.cpp.

◆ llzkCallOpGetCalleeIsStructCompute()

bool llzkCallOpGetCalleeIsStructCompute ( MlirOperation op)

Definition at line 218 of file Function.cpp.

◆ llzkCallOpGetCalleeIsStructConstrain()

bool llzkCallOpGetCalleeIsStructConstrain ( MlirOperation op)

Definition at line 222 of file Function.cpp.

◆ llzkCallOpGetCalleeType()

MlirType llzkCallOpGetCalleeType ( MlirOperation op)

Returns the FunctionType of the callee.

Definition at line 206 of file Function.cpp.

◆ llzkCallOpGetSelfValueFromCompute()

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()

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()

MlirType llzkCallOpGetSingleResultTypeOfCompute ( MlirOperation op)

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

Definition at line 238 of file Function.cpp.

◆ llzkFuncDefOpCreateWithAttrsAndArgAttrs()

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()

MlirAttribute llzkFuncDefOpGetFullyQualifiedName ( MlirOperation op)

Returns the fully qualified name of the function.

Definition at line 94 of file Function.cpp.

◆ llzkFuncDefOpGetHasAllowConstraintAttr()

bool llzkFuncDefOpGetHasAllowConstraintAttr ( MlirOperation op)

Definition at line 66 of file Function.cpp.

◆ llzkFuncDefOpGetHasAllowNonNativeFieldOpsAttr()

bool llzkFuncDefOpGetHasAllowNonNativeFieldOpsAttr ( MlirOperation op)

Definition at line 82 of file Function.cpp.

◆ llzkFuncDefOpGetHasAllowWitnessAttr()

bool llzkFuncDefOpGetHasAllowWitnessAttr ( MlirOperation op)

Definition at line 74 of file Function.cpp.

◆ llzkFuncDefOpGetHasArgIsPub()

bool llzkFuncDefOpGetHasArgIsPub ( MlirOperation op,
unsigned argNo )

Definition at line 90 of file Function.cpp.

◆ llzkFuncDefOpGetIsInStruct()

bool llzkFuncDefOpGetIsInStruct ( MlirOperation op)

Definition at line 106 of file Function.cpp.

◆ llzkFuncDefOpGetIsStructCompute()

bool llzkFuncDefOpGetIsStructCompute ( MlirOperation op)

Definition at line 110 of file Function.cpp.

◆ llzkFuncDefOpGetIsStructConstrain()

bool llzkFuncDefOpGetIsStructConstrain ( MlirOperation op)

Definition at line 114 of file Function.cpp.

◆ llzkFuncDefOpGetNameIsCompute()

bool llzkFuncDefOpGetNameIsCompute ( MlirOperation op)

Definition at line 98 of file Function.cpp.

◆ llzkFuncDefOpGetNameIsConstrain()

bool llzkFuncDefOpGetNameIsConstrain ( MlirOperation op)

Definition at line 102 of file Function.cpp.

◆ llzkFuncDefOpGetSelfValueFromCompute()

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()

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()

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()

void llzkFuncDefOpSetAllowConstraintAttr ( MlirOperation op,
bool value )

Sets the allow_constraint attribute in the FuncDefOp operation.

Definition at line 70 of file Function.cpp.

◆ llzkFuncDefOpSetAllowNonNativeFieldOpsAttr()

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()

void llzkFuncDefOpSetAllowWitnessAttr ( MlirOperation op,
bool value )

Sets the allow_witness attribute in the FuncDefOp operation.

Definition at line 78 of file Function.cpp.

◆ llzkOperationIsACallOp()

bool llzkOperationIsACallOp ( MlirOperation op)

Definition at line 204 of file Function.cpp.

◆ llzkOperationIsAFuncDefOp()

bool llzkOperationIsAFuncDefOp ( MlirOperation op)

Definition at line 64 of file Function.cpp.