LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Felt.h
Go to the documentation of this file.
1//===-- Felt.h - C API for Felt dialect ---------------------------*- C -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9//
10// This header declares the C interface for registering and accessing the
11// Felt dialect. A dialect should be registered with a context to make it
12// available to users of the context. These users must load the dialect
13// before using any of its attributes, operations, or types. Parser and pass
14// manager can load registered dialects automatically.
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLZK_C_DIALECT_FELT_H
19#define LLZK_C_DIALECT_FELT_H
20
21#include <mlir-c/IR.h>
22
23// Include the generated CAPI
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
34
35//===----------------------------------------------------------------------===//
36// FeltConstAttr
37//===----------------------------------------------------------------------===//
38
40MLIR_CAPI_EXPORTED MlirAttribute
41llzkFelt_FeltConstAttrGetInField(MlirContext ctx, int64_t value, MlirStringRef fieldName);
42
44MLIR_CAPI_EXPORTED MlirAttribute
45llzkFelt_FeltConstAttrGetUnspecified(MlirContext ctx, int64_t value);
46
49MLIR_CAPI_EXPORTED MlirAttribute
50llzkFelt_FeltConstAttrGetWithBits(MlirContext ctx, unsigned numBits, int64_t value, MlirType type);
51
53MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetWithBitsInField(
54 MlirContext ctx, unsigned numBits, int64_t value, MlirStringRef fieldName
55);
56
58MLIR_CAPI_EXPORTED MlirAttribute
59llzkFelt_FeltConstAttrGetWithBitsUnspecified(MlirContext ctx, unsigned numBits, int64_t value);
60
64MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromString(
65 MlirContext ctx, unsigned numBits, MlirStringRef str, MlirType type
66);
67
70MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringInField(
71 MlirContext ctx, unsigned numBits, MlirStringRef str, MlirStringRef fieldName
72);
73
76MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringUnspecified(
77 MlirContext ctx, unsigned numBits, MlirStringRef str
78);
79
83MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromParts(
84 MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts, MlirType type
85);
86
89MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsInField(
90 MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts,
91 MlirStringRef fieldName
92);
93
96MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsUnspecified(
97 MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts
98);
99
100//===----------------------------------------------------------------------===//
101// FieldSpecAttr
102//===----------------------------------------------------------------------===//
103
105MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromString(
106 MlirContext ctx, MlirIdentifier fieldName, unsigned numBits, MlirStringRef primeStr
107);
108
111MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromParts(
112 MlirContext ctx, MlirIdentifier fieldName, unsigned numBits, const uint64_t *parts,
113 intptr_t nParts
114);
115
116//===----------------------------------------------------------------------===//
117// FeltType
118//===----------------------------------------------------------------------===//
119
121MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetUnspecified(MlirContext ctx);
122
124MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetFromRef(MlirContext ctx, MlirStringRef fieldName);
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif // LLZK_C_DIALECT_FELT_H
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsInField(MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from an array of big-integer parts in LSB order in the specified ...
Definition Felt.cpp:87
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromString(MlirContext ctx, MlirIdentifier fieldName, unsigned numBits, MlirStringRef primeStr)
Creates a llzk::felt::FieldSpecAttr from a base-10 representation of the prime.
Definition Felt.cpp:100
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetUnspecified(MlirContext ctx, int64_t value)
Creates a llzk::felt::FeltConstAttr with the given value in an unspecified field.
Definition Felt.cpp:41
MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetUnspecified(MlirContext ctx)
Creates a llzk::felt::FeltType with an unspecified field.
Definition Felt.cpp:117
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromParts(MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts, MlirType type)
Creates a llzk::felt::FeltConstAttr from an array of big-integer parts in LSB order in the specified ...
Definition Felt.cpp:79
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsUnspecified(MlirContext ctx, unsigned numBits, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FeltConstAttr from an array of big-integer parts in LSB order in an unspecified...
Definition Felt.cpp:94
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromString(MlirContext ctx, unsigned numBits, MlirStringRef str, MlirType type)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a number in the specified field.
Definition Felt.cpp:61
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromParts(MlirContext ctx, MlirIdentifier fieldName, unsigned numBits, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FieldSpecAttr from an array of big-integer parts in LSB order representing the ...
Definition Felt.cpp:108
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetInField(MlirContext ctx, int64_t value, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr with the given value in the specified field.
Definition Felt.cpp:36
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetWithBitsInField(MlirContext ctx, unsigned numBits, int64_t value, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr with a set bit length and value in the specified field.
Definition Felt.cpp:50
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringInField(MlirContext ctx, unsigned numBits, MlirStringRef str, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a number in the specified field.
Definition Felt.cpp:67
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetWithBitsUnspecified(MlirContext ctx, unsigned numBits, int64_t value)
Creates a llzk::felt::FeltConstAttr with a set bit length and value in an unspecified field.
Definition Felt.cpp:57
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Felt, llzk__felt)
Get reference to the LLZK felt dialect.
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringUnspecified(MlirContext ctx, unsigned numBits, MlirStringRef str)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a number in an unspecified field...
Definition Felt.cpp:73
MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetFromRef(MlirContext ctx, MlirStringRef fieldName)
Create a llzk::felt::FeltType Type with the given parameters.
Definition Felt.cpp:121
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetWithBits(MlirContext ctx, unsigned numBits, int64_t value, MlirType type)
Creates a llzk::felt::FeltConstAttr with a set bit length and value in the specified field.
Definition Felt.cpp:46