LLZK 0.1.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/Util/SymbolLookup.h"
#include "llzk-c/Support.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-c/BuiltinAttributes.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 mlirOperationReplaceUsesOfWith (MlirOperation op, MlirValue oldValue, MlirValue newValue)
 Note: Duplicated from upstream LLVM. Available in 21.1.8 and later.
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.
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 151 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 135 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 141 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 167 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 178 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderCreate()

LlzkAffineMapOperandsBuilder llzkAffineMapOperandsBuilderCreate ( void )

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

Definition at line 113 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderDestroy()

void llzkAffineMapOperandsBuilderDestroy ( LlzkAffineMapOperandsBuilder * builder)

Destroys the struct releasing its resources.

Definition at line 123 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 186 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 158 of file Support.cpp.

◆ llzkSymbolLookupResultDestroy()

void llzkSymbolLookupResultDestroy ( LlzkSymbolLookupResult result)

Destroys the lookup result, releasing its resources.

Definition at line 30 of file Support.cpp.

◆ LlzkSymbolLookupResultGetOperation()

MlirOperation LlzkSymbolLookupResultGetOperation ( LlzkSymbolLookupResult wrapped)

Returns the looked up Operation.

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

Definition at line 37 of file Support.cpp.

◆ mlirOperationReplaceUsesOfWith()

void mlirOperationReplaceUsesOfWith ( MlirOperation op,
MlirValue oldValue,
MlirValue newValue )

Note: Duplicated from upstream LLVM. Available in 21.1.8 and later.

Replace uses of 'of' value with the 'with' value inside the 'op' operation.

Definition at line 43 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 62 of file Support.cpp.