LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Support.cpp File Reference
#include "llzk/CAPI/Support.h"
#include "llzk-c/Support.h"
#include "llzk/Util/Compare.h"
#include "llzk/Util/SymbolLookup.h"
#include <mlir-c/BuiltinAttributes.h>
#include <mlir/CAPI/IR.h>
#include <mlir/CAPI/Support.h>
#include <mlir/CAPI/Wrap.h>
#include <mlir/IR/BuiltinAttributes.h>
#include <mlir/IR/Iterators.h>
#include <mlir/IR/SymbolTable.h>
#include <cstdint>
#include <cstring>
Include dependency graph for Support.cpp:

Go to the source code of this file.

Functions

void llzkSymbolLookupResultDestroy (LlzkSymbolLookupResult result)
 Destroys the lookup result, releasing its resources.
MlirOperation LlzkSymbolLookupResultGetOperation (LlzkSymbolLookupResult wrapped)
 Returns the looked up Operation.
void mlirOperationWalkReverse (MlirOperation from, MlirOperationWalkCallback callback, void *userData, MlirWalkOrder walkOrder)
 Walks operation op in walkOrder, with operations at the same nesting level traversed in reverse order, and calls callback on that operation.
void llzkSymbolTableInsert (MlirOperation symTableOp, MlirOperation newSymbolOp)
 Inserts newSymbolOp into the symbol table owned by symTableOp.
LlzkAffineMapOperandsBuilder llzkAffineMapOperandsBuilderCreate ()
 Creates a new struct. The owner is responsible for cleaning the struct.
void llzkAffineMapOperandsBuilderDestroy (LlzkAffineMapOperandsBuilder *builder)
 Destroys the struct releasing its resources.
void llzkAffineMapOperandsBuilderAppendOperands (LlzkAffineMapOperandsBuilder *builder, intptr_t n, MlirValueRange const *mapOperands)
 Appends the value ranges to the list of map operands.
void llzkAffineMapOperandsBuilderAppendOperandsWithDimCount (LlzkAffineMapOperandsBuilder *builder, intptr_t n, MlirValueRange const *mapOperands, int32_t const *dimsPerMap)
 Appends the value ranges to the list of map operands and indicates how many of these operands are dimensions.
void llzkAffineMapOperandsBuilderAppendDimCount (LlzkAffineMapOperandsBuilder *builder, intptr_t n, int32_t const *dimsPerMap)
 Appends a dimension count to the list of dimensions per map.
void llzkAffineMapOperandsBuilderSetDimsPerMapFromAttr (LlzkAffineMapOperandsBuilder *builder, MlirAttribute attribute)
 Sets the number of dimensions per map to the given attribute.
void llzkAffineMapOperandsBuilderConvertDimsPerMapToArray (LlzkAffineMapOperandsBuilder *builder)
 Converts the list of dimensions defined as an attribute into an array.
void llzkAffineMapOperandsBuilderConvertDimsPerMapToAttr (LlzkAffineMapOperandsBuilder *builder, MlirContext context)
 Converts the list of dimensions defined as an array into an attribute.
MlirAttribute llzkAffineMapOperandsBuilderGetDimsPerMapAttr (LlzkAffineMapOperandsBuilder builder, MlirContext context)
 Returns the number of dimensions per map represented as an attribute.

Function Documentation

◆ llzkAffineMapOperandsBuilderAppendDimCount()

void llzkAffineMapOperandsBuilderAppendDimCount ( LlzkAffineMapOperandsBuilder * builder,
intptr_t n,
int32_t const * dimsPerMap )

Appends a dimension count to the list of dimensions per map.

If the builder is in Attr mode allocates an array with enough space and copies the attr's contents into it before appending the new value.

Definition at line 156 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderAppendOperands()

void llzkAffineMapOperandsBuilderAppendOperands ( LlzkAffineMapOperandsBuilder * builder,
intptr_t n,
MlirValueRange const * mapOperands )

Appends the value ranges to the list of map operands.

Definition at line 140 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderAppendOperandsWithDimCount()

void llzkAffineMapOperandsBuilderAppendOperandsWithDimCount ( LlzkAffineMapOperandsBuilder * builder,
intptr_t n,
MlirValueRange const * mapOperands,
int32_t const * dimsPerMap )

Appends the value ranges to the list of map operands and indicates how many of these operands are dimensions.

Asserts that the number of map operands and the number of dimensions per map is the same to avoid going out of sync.

Definition at line 146 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderConvertDimsPerMapToArray()

void llzkAffineMapOperandsBuilderConvertDimsPerMapToArray ( LlzkAffineMapOperandsBuilder * builder)

Converts the list of dimensions defined as an attribute into an array.

This function is a no-op if the list was already in array mode.

Definition at line 172 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderConvertDimsPerMapToAttr()

void llzkAffineMapOperandsBuilderConvertDimsPerMapToAttr ( LlzkAffineMapOperandsBuilder * builder,
MlirContext context )

Converts the list of dimensions defined as an array into an attribute.

This function is a no-op if the list was already in attribute mode.

Definition at line 183 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderCreate()

LlzkAffineMapOperandsBuilder llzkAffineMapOperandsBuilderCreate ( void )

Creates a new struct. The owner is responsible for cleaning the struct.

Definition at line 118 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderDestroy()

void llzkAffineMapOperandsBuilderDestroy ( LlzkAffineMapOperandsBuilder * builder)

Destroys the struct releasing its resources.

Definition at line 128 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderGetDimsPerMapAttr()

MlirAttribute llzkAffineMapOperandsBuilderGetDimsPerMapAttr ( LlzkAffineMapOperandsBuilder builder,
MlirContext context )

Returns the number of dimensions per map represented as an attribute.

Definition at line 191 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderSetDimsPerMapFromAttr()

void llzkAffineMapOperandsBuilderSetDimsPerMapFromAttr ( LlzkAffineMapOperandsBuilder * builder,
MlirAttribute attribute )

Sets the number of dimensions per map to the given attribute.

Overwrites the previous values and deallocates if necessary.

Asserts that the attribute is of type DenseI32ArrayAttr.

Definition at line 163 of file Support.cpp.

◆ llzkSymbolLookupResultDestroy()

void llzkSymbolLookupResultDestroy ( LlzkSymbolLookupResult result)

Destroys the lookup result, releasing its resources.

Definition at line 33 of file Support.cpp.

◆ LlzkSymbolLookupResultGetOperation()

MlirOperation LlzkSymbolLookupResultGetOperation ( LlzkSymbolLookupResult result)

Returns the looked up Operation.

The lifetime of the Operation is tied to the lifetime of the lookup result.

Definition at line 40 of file Support.cpp.

◆ llzkSymbolTableInsert()

void llzkSymbolTableInsert ( MlirOperation symTableOp,
MlirOperation newSymbolOp )

Inserts newSymbolOp into the symbol table owned by symTableOp.

Insertion via the SymbolTable automatically renames symTableOp if necessary to avoid name collisions.

Requires that symTableOp implements the SymbolTable op interface and that newSymbolOp has a sym_name attribute.

Definition at line 77 of file Support.cpp.

◆ mlirOperationWalkReverse()

void mlirOperationWalkReverse ( MlirOperation from,
MlirOperationWalkCallback callback,
void * userData,
MlirWalkOrder walkOrder )

Walks operation op in walkOrder, with operations at the same nesting level traversed in reverse order, and calls callback on that operation.

*userData is passed to the callback as well and can be used to tunnel some context or other data into the callback.

Definition at line 61 of file Support.cpp.