LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
Struct.cpp File Reference
#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/Util/TypeHelper.h"
#include "llzk-c/Dialect/Struct.h"
#include <mlir/CAPI/AffineMap.h>
#include <mlir/CAPI/Registration.h>
#include <mlir/CAPI/Support.h>
#include <mlir/CAPI/Wrap.h>
#include <mlir/IR/BuiltinAttributes.h>
#include <mlir-c/Support.h>
#include <llvm/ADT/STLExtras.h>
Include dependency graph for Struct.cpp:

Go to the source code of this file.

Functions

MlirType llzkStructTypeGet (MlirAttribute name)
 Creates a llzk::component::StructType.
MlirType llzkStructTypeGetWithArrayAttr (MlirAttribute name, MlirAttribute params)
 Creates a llzk::component::StructType with an ArrayAttr as parameters.
MlirType llzkStructTypeGetWithAttrs (MlirAttribute name, intptr_t numParams, MlirAttribute const *params)
 Creates a llzk::component::StructType with an array of parameters.
bool llzkTypeIsAStructType (MlirType type)
MlirAttribute llzkStructTypeGetName (MlirType type)
 Returns the fully qualified name of a llzk::component::StructType.
MlirAttribute llzkStructTypeGetParams (MlirType type)
 Returns the parameter of a llzk::component::StructType as an ArrayAttr.
bool llzkOperationIsAStructDefOp (MlirOperation op)
MlirRegion llzkStructDefOpGetBodyRegion (MlirOperation op)
 Returns the single body Region of the StructDefOp.
MlirBlock llzkStructDefOpGetBody (MlirOperation op)
 Returns the single body Block within the StructDefOp's Region.
MlirType llzkStructDefOpGetType (MlirOperation op)
 Returns the associated StructType to this op using the const params defined by the op.
MlirType llzkStructDefOpGetTypeWithParams (MlirOperation op, MlirAttribute attr)
 Returns the associated StructType to this op using the given const params instead of the parameters defined by the op.
MlirOperation llzkStructDefOpGetFieldDef (MlirOperation op, MlirStringRef name)
 Returns the operation that defines the field with the given name, if present.
void llzkStructDefOpGetFieldDefs (MlirOperation op, MlirOperation *dst)
 Fills the given array with the FieldDefOp operations inside this struct.
intptr_t llzkStructDefOpGetNumFieldDefs (MlirOperation op)
 Returns the number of FieldDefOp operations defined in this struct.
MlirLogicalResult llzkStructDefOpGetHasColumns (MlirOperation op)
 Returns true if the struct has fields marked as columns.
MlirOperation llzkStructDefOpGetComputeFuncOp (MlirOperation op)
 Returns the FuncDefOp operation that defines the witness computation of the struct.
MlirOperation llzkStructDefOpGetConstrainFuncOp (MlirOperation op)
 Returns the FuncDefOp operation that defines the constraints of the struct.
const char * llzkStructDefOpGetHeaderString (MlirOperation op, intptr_t *strSize, char *(*alloc_string)(size_t))
 Returns the header string of the struct.
bool llzkStructDefOpGetHasParamName (MlirOperation op, MlirStringRef name)
MlirAttribute llzkStructDefOpGetFullyQualifiedName (MlirOperation op)
 Returns a StringAttr with the fully qualified name of the struct.
bool llzkStructDefOpGetIsMainComponent (MlirOperation op)
bool llzkOperationIsAFieldDefOp (MlirOperation op)
bool llzkFieldDefOpGetHasPublicAttr (MlirOperation op)
void llzkFieldDefOpSetPublicAttr (MlirOperation op, bool value)
 Sets the public attribute in the given field.
 LLZK_DEFINE_OP_BUILD_METHOD (FieldReadOp, MlirType fieldType, MlirValue component, MlirStringRef name)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (FieldReadOp, WithAffineMapDistance, MlirType fieldType, MlirValue component, MlirStringRef name, MlirAffineMap map, MlirValueRange mapOperands, int32_t numDimsPerMap)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (FieldReadOp, WithConstParamDistance, MlirType fieldType, MlirValue component, MlirStringRef name, MlirStringRef symbol)
 LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD (FieldReadOp, WithLiteralDistance, MlirType fieldType, MlirValue component, MlirStringRef name, int64_t distance)

Function Documentation

◆ LLZK_DEFINE_OP_BUILD_METHOD()

LLZK_DEFINE_OP_BUILD_METHOD ( FieldReadOp ,
MlirType fieldType,
MlirValue component,
MlirStringRef name )

Definition at line 162 of file Struct.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [1/3]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( FieldReadOp ,
WithAffineMapDistance ,
MlirType fieldType,
MlirValue component,
MlirStringRef name,
MlirAffineMap map,
MlirValueRange mapOperands,
int32_t numDimsPerMap )

Definition at line 173 of file Struct.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [2/3]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( FieldReadOp ,
WithConstParamDistance ,
MlirType fieldType,
MlirValue component,
MlirStringRef name,
MlirStringRef symbol )

Definition at line 188 of file Struct.cpp.

◆ LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD() [3/3]

LLZK_DEFINE_SUFFIX_OP_BUILD_METHOD ( FieldReadOp ,
WithLiteralDistance ,
MlirType fieldType,
MlirValue component,
MlirStringRef name,
int64_t distance )

Definition at line 201 of file Struct.cpp.

◆ llzkFieldDefOpGetHasPublicAttr()

bool llzkFieldDefOpGetHasPublicAttr ( MlirOperation op)

Definition at line 150 of file Struct.cpp.

◆ llzkFieldDefOpSetPublicAttr()

void llzkFieldDefOpSetPublicAttr ( MlirOperation op,
bool value )

Sets the public attribute in the given field.

Definition at line 154 of file Struct.cpp.

◆ llzkOperationIsAFieldDefOp()

bool llzkOperationIsAFieldDefOp ( MlirOperation op)

Definition at line 148 of file Struct.cpp.

◆ llzkOperationIsAStructDefOp()

bool llzkOperationIsAStructDefOp ( MlirOperation op)

Definition at line 76 of file Struct.cpp.

◆ llzkStructDefOpGetBody()

MlirBlock llzkStructDefOpGetBody ( MlirOperation op)

Returns the single body Block within the StructDefOp's Region.

Definition at line 82 of file Struct.cpp.

◆ llzkStructDefOpGetBodyRegion()

MlirRegion llzkStructDefOpGetBodyRegion ( MlirOperation op)

Returns the single body Region of the StructDefOp.

Definition at line 78 of file Struct.cpp.

◆ llzkStructDefOpGetComputeFuncOp()

MlirOperation llzkStructDefOpGetComputeFuncOp ( MlirOperation op)

Returns the FuncDefOp operation that defines the witness computation of the struct.

Definition at line 113 of file Struct.cpp.

◆ llzkStructDefOpGetConstrainFuncOp()

MlirOperation llzkStructDefOpGetConstrainFuncOp ( MlirOperation op)

Returns the FuncDefOp operation that defines the constraints of the struct.

Definition at line 117 of file Struct.cpp.

◆ llzkStructDefOpGetFieldDef()

MlirOperation llzkStructDefOpGetFieldDef ( MlirOperation op,
MlirStringRef name )

Returns the operation that defines the field with the given name, if present.

Definition at line 94 of file Struct.cpp.

◆ llzkStructDefOpGetFieldDefs()

void llzkStructDefOpGetFieldDefs ( MlirOperation op,
MlirOperation * dst )

Fills the given array with the FieldDefOp operations inside this struct.

The pointer to the operations must have been preallocated. See llzkStructDefOpGetNumFieldDefs for obtaining the required size of the array.

Definition at line 99 of file Struct.cpp.

◆ llzkStructDefOpGetFullyQualifiedName()

MlirAttribute llzkStructDefOpGetFullyQualifiedName ( MlirOperation op)

Returns a StringAttr with the fully qualified name of the struct.

Definition at line 136 of file Struct.cpp.

◆ llzkStructDefOpGetHasColumns()

MlirLogicalResult llzkStructDefOpGetHasColumns ( MlirOperation op)

Returns true if the struct has fields marked as columns.

Definition at line 109 of file Struct.cpp.

◆ llzkStructDefOpGetHasParamName()

bool llzkStructDefOpGetHasParamName ( MlirOperation op,
MlirStringRef name )

Definition at line 131 of file Struct.cpp.

◆ llzkStructDefOpGetHeaderString()

const char * llzkStructDefOpGetHeaderString ( 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 122 of file Struct.cpp.

◆ llzkStructDefOpGetIsMainComponent()

bool llzkStructDefOpGetIsMainComponent ( MlirOperation op)

Definition at line 140 of file Struct.cpp.

◆ llzkStructDefOpGetNumFieldDefs()

intptr_t llzkStructDefOpGetNumFieldDefs ( MlirOperation op)

Returns the number of FieldDefOp operations defined in this struct.

Definition at line 105 of file Struct.cpp.

◆ llzkStructDefOpGetType()

MlirType llzkStructDefOpGetType ( MlirOperation op)

Returns the associated StructType to this op using the const params defined by the op.

Definition at line 86 of file Struct.cpp.

◆ llzkStructDefOpGetTypeWithParams()

MlirType llzkStructDefOpGetTypeWithParams ( 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 90 of file Struct.cpp.

◆ llzkStructTypeGet()

MlirType llzkStructTypeGet ( MlirAttribute name)

Creates a llzk::component::StructType.

The name attribute must be a SymbolRefAttr.

Definition at line 40 of file Struct.cpp.

◆ llzkStructTypeGetName()

MlirAttribute llzkStructTypeGetName ( MlirType type)

Returns the fully qualified name of a llzk::component::StructType.

Definition at line 64 of file Struct.cpp.

◆ llzkStructTypeGetParams()

MlirAttribute llzkStructTypeGetParams ( MlirType type)

Returns the parameter of a llzk::component::StructType as an ArrayAttr.

Definition at line 68 of file Struct.cpp.

◆ llzkStructTypeGetWithArrayAttr()

MlirType llzkStructTypeGetWithArrayAttr ( MlirAttribute name,
MlirAttribute params )

Creates a llzk::component::StructType with an ArrayAttr as parameters.

The name attribute must be a SymbolRefAttr.

Definition at line 44 of file Struct.cpp.

◆ llzkStructTypeGetWithAttrs()

MlirType llzkStructTypeGetWithAttrs ( 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 53 of file Struct.cpp.

◆ llzkTypeIsAStructType()

bool llzkTypeIsAStructType ( MlirType type)

Definition at line 62 of file Struct.cpp.