LLZK 3.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
41MLIR_CAPI_EXPORTED MlirAttribute
42llzkFelt_FeltConstAttrGetFromInt64(MlirContext ctx, int64_t value, MlirType type);
43
47MLIR_CAPI_EXPORTED MlirAttribute
48llzkFelt_FeltConstAttrGetFromInt64InField(MlirContext ctx, int64_t value, MlirStringRef fieldName);
49
51MLIR_CAPI_EXPORTED MlirAttribute
52llzkFelt_FeltConstAttrGetFromInt64Unspecified(MlirContext ctx, int64_t value);
53
57MLIR_CAPI_EXPORTED MlirAttribute
58llzkFelt_FeltConstAttrGetFromString(MlirContext ctx, MlirStringRef str, MlirType type);
59
64MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringInField(
65 MlirContext ctx, MlirStringRef str, MlirStringRef fieldName
66);
67
70MLIR_CAPI_EXPORTED MlirAttribute
71llzkFelt_FeltConstAttrGetFromStringUnspecified(MlirContext ctx, MlirStringRef str);
72
80MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromParts(
81 MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirType type
82);
83
92MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsInField(
93 MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirStringRef fieldName
94);
95
102MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsUnspecified(
103 MlirContext ctx, const uint64_t *parts, intptr_t nParts
104);
105
106//===----------------------------------------------------------------------===//
107// FieldSpecAttr
108//===----------------------------------------------------------------------===//
109
112MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromString(
113 MlirContext ctx, MlirIdentifier fieldName, MlirStringRef primeStr
114);
115
122MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromParts(
123 MlirContext ctx, MlirIdentifier fieldName, const uint64_t *parts, intptr_t nParts
124);
125
126//===----------------------------------------------------------------------===//
127// FeltType
128//===----------------------------------------------------------------------===//
129
131MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetUnspecified(MlirContext ctx);
132
143MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetFromRef(MlirContext ctx, MlirStringRef fieldName);
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif // LLZK_C_DIALECT_FELT_H
MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetUnspecified(MlirContext ctx)
Gets the llzk::felt::FeltType without the field specified.
Definition Felt.cpp:121
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringInField(MlirContext ctx, MlirStringRef str, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in the specifie...
Definition Felt.cpp:60
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsUnspecified(MlirContext ctx, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
Definition Felt.cpp:94
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromInt64InField(MlirContext ctx, int64_t value, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in the specified field.
Definition Felt.cpp:43
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromString(MlirContext ctx, MlirStringRef str, MlirType type)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in the specifie...
Definition Felt.cpp:56
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromStringUnspecified(MlirContext ctx, MlirStringRef str)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in an unspecifi...
Definition Felt.cpp:70
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromParts(MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirType type)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
Definition Felt.cpp:74
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Felt, llzk__felt)
Get reference to the LLZK felt dialect.
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromPartsInField(MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
Definition Felt.cpp:84
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromInt64Unspecified(MlirContext ctx, int64_t value)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in an unspecified field.
Definition Felt.cpp:51
MLIR_CAPI_EXPORTED MlirType llzkFelt_FeltTypeGetFromRef(MlirContext ctx, MlirStringRef fieldName)
Gets a llzk::felt::FeltType referring to an already defined field.
Definition Felt.cpp:125
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromParts(MlirContext ctx, MlirIdentifier fieldName, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FieldSpecAttr from 64-bit parts in LSB order.
Definition Felt.cpp:108
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FeltConstAttrGetFromInt64(MlirContext ctx, int64_t value, MlirType type)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in the specified field.
Definition Felt.cpp:36
MLIR_CAPI_EXPORTED MlirAttribute llzkFelt_FieldSpecAttrGetFromString(MlirContext ctx, MlirIdentifier fieldName, MlirStringRef primeStr)
Creates a llzk::felt::FieldSpecAttr from a base-10 representation of the prime.
Definition Felt.cpp:102