LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Support.h File Reference
#include "llzk-c/Builder.h"
#include <mlir-c/IR.h>
#include <mlir-c/Support.h>
#include <stdint.h>
Include dependency graph for Support.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MlirValueRange
struct  LlzkSymbolLookupResult
struct  LlzkAffineMapOperandsBuilder
 Encapsulates the arguments related to affine maps that are common in operation constructors that support them. More...

Macros

#define LLZK_BUILD_METHOD_NAME(op, suffix)
#define LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD(op, suffix, ...)
#define LLZK_DECLARE_OP_BUILD_METHOD(op, ...)
#define LLZK_DECLARE_PREDICATE(name, ...)
#define LLZK_DECLARE_OP_PREDICATE(op, name)
#define LLZK_DECLARE_NARY_OP_PREDICATE(op, name, ...)
#define LLZK_DECLARE_ISA(what, root)
#define LLZK_DECLARE_TYPE_ISA(what)
#define LLZK_DECLARE_OP_ISA(what)
#define LLZK_DECLARE_ATTR_ISA(what)

Typedefs

typedef struct MlirValueRange MlirValueRange
typedef struct LlzkSymbolLookupResult LlzkSymbolLookupResult
typedef struct LlzkAffineMapOperandsBuilder LlzkAffineMapOperandsBuilder
 Encapsulates the arguments related to affine maps that are common in operation constructors that support them.

Functions

MLIR_CAPI_EXPORTED void llzkSymbolLookupResultDestroy (LlzkSymbolLookupResult result)
 Destroys the lookup result, releasing its resources.
MLIR_CAPI_EXPORTED MlirOperation LlzkSymbolLookupResultGetOperation (LlzkSymbolLookupResult result)
 Returns the looked up Operation.
MLIR_CAPI_EXPORTED void mlirOperationReplaceUsesOfWith (MlirOperation op, MlirValue of, MlirValue with)
 Replace uses of 'of' value with the 'with' value inside the 'op' operation.
MLIR_CAPI_EXPORTED 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.
MLIR_CAPI_EXPORTED LlzkAffineMapOperandsBuilder llzkAffineMapOperandsBuilderCreate (void)
 Creates a new struct. The owner is responsible for cleaning the struct.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderDestroy (LlzkAffineMapOperandsBuilder *builder)
 Destroys the struct releasing its resources.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderAppendOperands (LlzkAffineMapOperandsBuilder *builder, intptr_t n, MlirValueRange const *mapOperands)
 Appends the value ranges to the list of map operands.
MLIR_CAPI_EXPORTED 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.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderAppendDimCount (LlzkAffineMapOperandsBuilder *builder, intptr_t n, int32_t const *dimsPerMap)
 Appends a dimension count to the list of dimensions per map.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderSetDimsPerMapFromAttr (LlzkAffineMapOperandsBuilder *builder, MlirAttribute attribute)
 Sets the number of dimensions per map to the given attribute.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderConvertDimsPerMapToArray (LlzkAffineMapOperandsBuilder *builder)
 Converts the list of dimensions defined as an attribute into an array.
MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderConvertDimsPerMapToAttr (LlzkAffineMapOperandsBuilder *builder, MlirContext context)
 Converts the list of dimensions defined as an array into an attribute.
MLIR_CAPI_EXPORTED MlirAttribute llzkAffineMapOperandsBuilderGetDimsPerMapAttr (LlzkAffineMapOperandsBuilder builder, MlirContext context)
 Returns the number of dimensions per map represented as an attribute.

Macro Definition Documentation

◆ LLZK_BUILD_METHOD_NAME

#define LLZK_BUILD_METHOD_NAME ( op,
suffix )
Value:
llzk##op##Build##suffix

Definition at line 32 of file Support.h.

◆ LLZK_DECLARE_ATTR_ISA

#define LLZK_DECLARE_ATTR_ISA ( what)
Value:
LLZK_DECLARE_ISA(what, Attribute)
#define LLZK_DECLARE_ISA(what, root)
Definition Support.h:47

Definition at line 50 of file Support.h.

◆ LLZK_DECLARE_ISA

#define LLZK_DECLARE_ISA ( what,
root )
Value:
MLIR_CAPI_EXPORTED bool llzk##root##IsA##what(Mlir##root what)

Definition at line 47 of file Support.h.

◆ LLZK_DECLARE_NARY_OP_PREDICATE

#define LLZK_DECLARE_NARY_OP_PREDICATE ( op,
name,
... )
Value:
MLIR_CAPI_EXPORTED bool llzk##op##Get##name(MlirOperation op, __VA_ARGS__)

Definition at line 44 of file Support.h.

◆ LLZK_DECLARE_OP_BUILD_METHOD

#define LLZK_DECLARE_OP_BUILD_METHOD ( op,
... )
Value:
#define LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD(op, suffix,...)
Definition Support.h:33

Definition at line 38 of file Support.h.

◆ LLZK_DECLARE_OP_ISA

#define LLZK_DECLARE_OP_ISA ( what)
Value:
LLZK_DECLARE_ISA(what, Operation)

Definition at line 49 of file Support.h.

◆ LLZK_DECLARE_OP_PREDICATE

#define LLZK_DECLARE_OP_PREDICATE ( op,
name )
Value:
MLIR_CAPI_EXPORTED bool llzk##op##Get##name(MlirOperation op)

Definition at line 42 of file Support.h.

◆ LLZK_DECLARE_PREDICATE

#define LLZK_DECLARE_PREDICATE ( name,
... )
Value:
MLIR_CAPI_EXPORTED bool llzk##name(__VA_ARGS__)

Definition at line 40 of file Support.h.

◆ LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD

#define LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD ( op,
suffix,
... )
Value:
MLIR_CAPI_EXPORTED MlirOperation LLZK_BUILD_METHOD_NAME(op, suffix)( \
MlirOpBuilder builder, MlirLocation location, __VA_ARGS__ \
)
#define LLZK_BUILD_METHOD_NAME(op, suffix)
Definition Support.h:32

Definition at line 33 of file Support.h.

◆ LLZK_DECLARE_TYPE_ISA

#define LLZK_DECLARE_TYPE_ISA ( what)
Value:
LLZK_DECLARE_ISA(what, Type)

Definition at line 48 of file Support.h.

Typedef Documentation

◆ LlzkAffineMapOperandsBuilder

typedef struct LlzkAffineMapOperandsBuilder LlzkAffineMapOperandsBuilder

Encapsulates the arguments related to affine maps that are common in operation constructors that support them.

◆ LlzkSymbolLookupResult

typedef struct LlzkSymbolLookupResult LlzkSymbolLookupResult

◆ MlirValueRange

typedef struct MlirValueRange MlirValueRange

Definition at line 60 of file Support.h.

Function Documentation

◆ llzkAffineMapOperandsBuilderAppendDimCount()

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

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

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

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

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

MLIR_CAPI_EXPORTED LlzkAffineMapOperandsBuilder llzkAffineMapOperandsBuilderCreate ( void )

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

Definition at line 113 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderDestroy()

MLIR_CAPI_EXPORTED void llzkAffineMapOperandsBuilderDestroy ( LlzkAffineMapOperandsBuilder * builder)

Destroys the struct releasing its resources.

Definition at line 123 of file Support.cpp.

◆ llzkAffineMapOperandsBuilderGetDimsPerMapAttr()

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

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

MLIR_CAPI_EXPORTED void llzkSymbolLookupResultDestroy ( LlzkSymbolLookupResult result)

Destroys the lookup result, releasing its resources.

Definition at line 30 of file Support.cpp.

◆ LlzkSymbolLookupResultGetOperation()

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

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

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

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

MLIR_CAPI_EXPORTED 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.