LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Function.cpp File Reference
#include "llzk-c/Dialect/Function.h"
#include "llzk-c/Support.h"
#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 <mlir-c/BuiltinAttributes.h>
#include <mlir-c/IR.h>
#include <mlir-c/Pass.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 <llvm/ADT/SmallVectorExtras.h>
#include "llzk/Dialect/Function/IR/Attrs.capi.cpp.inc"
#include "llzk/Dialect/Function/IR/Ops.capi.cpp.inc"
Include dependency graph for Function.cpp:

Go to the source code of this file.

Functions

 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, FuncDefOp, WithAttrsAndArgAttrs, MlirStringRef name, MlirType funcType, intptr_t numAttrs, MlirNamedAttribute const *attrs, intptr_t numArgAttrs, MlirAttribute const *argAttrs)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, FuncDefOp, WithAttrs, MlirStringRef name, MlirType funcType, intptr_t numAttrs, MlirNamedAttribute const *attrs)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, FuncDefOp, WithArgAttrs, MlirStringRef name, MlirType funcType, intptr_t numArgAttrs, MlirAttribute const *argAttrs)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, FuncDefOp, WithoutAttrs, MlirStringRef name, MlirType funcType)
MlirAttribute llzkFunction_FuncDefOpGetArgNameAttr (MlirOperation op, unsigned index)
 Returns the function.arg_name StringAttr for the argument at the given index, or null if the argument has no function.arg_name attribute.
void llzkFunction_FuncDefOpSetArgNameAttr (MlirOperation op, unsigned index, MlirAttribute attr)
 Sets the function.arg_name attribute for the argument at the given index.
void llzkFunction_FuncDefOpSetArgName (MlirOperation op, unsigned index, MlirStringRef name)
 Sets the function.arg_name attribute for the argument at the given index from a string value.
MlirAttribute llzkFunction_FuncDefOpGetResNameAttr (MlirOperation op, unsigned index)
 Returns the function.res_name StringAttr for the result at the given index, or null if the result has no function.res_name attribute.
void llzkFunction_FuncDefOpSetResNameAttr (MlirOperation op, unsigned index, MlirAttribute attr)
 Sets the function.res_name attribute for the result at the given index.
void llzkFunction_FuncDefOpSetResName (MlirOperation op, unsigned index, MlirStringRef name)
 Sets the function.res_name attribute for the result at the given index from a string value.
 LLZK_DEFINE_OP_BUILD_METHOD (Function, CallOp, intptr_t numResults, MlirType const *results, MlirAttribute name, intptr_t numOperands, MlirValue const *operands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, CallOp, ToCallee, MlirOperation callee, intptr_t numOperands, MlirValue const *operands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, CallOp, WithMapOperands, intptr_t numResults, MlirType const *results, MlirAttribute name, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, CallOp, ToCalleeWithMapOperands, MlirOperation callee, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, CallOp, WithTemplateParams, intptr_t numResults, MlirType const *results, MlirAttribute name, intptr_t numTemplateParams, MlirAttribute const *templateParams, intptr_t numArgOperands, MlirValue const *argOperands)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (Function, CallOp, ToCalleeWithTemplateParams, MlirOperation callee, intptr_t numTemplateParams, MlirAttribute const *templateParams, intptr_t numArgOperands, MlirValue const *argOperands)
MlirType llzkFunction_CallOpGetTypeSignature (MlirOperation inp)
 Return the FunctionType inferred from the arg operands and result types of this CallOp.

Function Documentation

◆ LLZK_DEFINE_OP_BUILD_METHOD()

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

Definition at line 129 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [1/9]

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

Definition at line 145 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [2/9]

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

Definition at line 181 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [3/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
CallOp ,
ToCalleeWithTemplateParams ,
MlirOperation callee,
intptr_t numTemplateParams,
MlirAttribute const * templateParams,
intptr_t numArgOperands,
MlirValue const * argOperands )

Definition at line 219 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [4/9]

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

Definition at line 160 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [5/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
CallOp ,
WithTemplateParams ,
intptr_t numResults,
MlirType const * results,
MlirAttribute name,
intptr_t numTemplateParams,
MlirAttribute const * templateParams,
intptr_t numArgOperands,
MlirValue const * argOperands )

Definition at line 200 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [6/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
FuncDefOp ,
WithArgAttrs ,
MlirStringRef name,
MlirType funcType,
intptr_t numArgAttrs,
MlirAttribute const * argAttrs )

Definition at line 76 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [7/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
FuncDefOp ,
WithAttrs ,
MlirStringRef name,
MlirType funcType,
intptr_t numAttrs,
MlirNamedAttribute const * attrs )

Definition at line 67 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [8/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
FuncDefOp ,
WithAttrsAndArgAttrs ,
MlirStringRef name,
MlirType funcType,
intptr_t numAttrs,
MlirNamedAttribute const * attrs,
intptr_t numArgAttrs,
MlirAttribute const * argAttrs )

Definition at line 46 of file Function.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [9/9]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( Function ,
FuncDefOp ,
WithoutAttrs ,
MlirStringRef name,
MlirType funcType )

Definition at line 85 of file Function.cpp.

◆ llzkFunction_CallOpGetTypeSignature()

MlirType llzkFunction_CallOpGetTypeSignature ( MlirOperation inp)

Return the FunctionType inferred from the arg operands and result types of this CallOp.

This is not necessarily the same as the callee's FunctionType but should unify with it or else IR verification will fail.

Definition at line 236 of file Function.cpp.

◆ llzkFunction_FuncDefOpGetArgNameAttr()

MlirAttribute llzkFunction_FuncDefOpGetArgNameAttr ( MlirOperation op,
unsigned index )

Returns the function.arg_name StringAttr for the argument at the given index, or null if the argument has no function.arg_name attribute.

Definition at line 93 of file Function.cpp.

◆ llzkFunction_FuncDefOpGetResNameAttr()

MlirAttribute llzkFunction_FuncDefOpGetResNameAttr ( MlirOperation op,
unsigned index )

Returns the function.res_name StringAttr for the result at the given index, or null if the result has no function.res_name attribute.

Definition at line 106 of file Function.cpp.

◆ llzkFunction_FuncDefOpSetArgName()

void llzkFunction_FuncDefOpSetArgName ( MlirOperation op,
unsigned index,
MlirStringRef name )

Sets the function.arg_name attribute for the argument at the given index from a string value.

Empty and duplicate names are rejected by the FuncDefOp verifier.

Definition at line 102 of file Function.cpp.

◆ llzkFunction_FuncDefOpSetArgNameAttr()

void llzkFunction_FuncDefOpSetArgNameAttr ( MlirOperation op,
unsigned index,
MlirAttribute attr )

Sets the function.arg_name attribute for the argument at the given index.

The attribute must be a StringAttr. Empty and duplicate names are rejected by the FuncDefOp verifier.

Definition at line 98 of file Function.cpp.

◆ llzkFunction_FuncDefOpSetResName()

void llzkFunction_FuncDefOpSetResName ( MlirOperation op,
unsigned index,
MlirStringRef name )

Sets the function.res_name attribute for the result at the given index from a string value.

Empty and duplicate names are rejected by the FuncDefOp verifier.

Definition at line 115 of file Function.cpp.

◆ llzkFunction_FuncDefOpSetResNameAttr()

void llzkFunction_FuncDefOpSetResNameAttr ( MlirOperation op,
unsigned index,
MlirAttribute attr )

Sets the function.res_name attribute for the result at the given index.

The attribute must be a StringAttr. Empty and duplicate names are rejected by the FuncDefOp verifier.

Definition at line 111 of file Function.cpp.