LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
POD.h
Go to the documentation of this file.
1//===-- POD.h - C API for POD dialect -----------------------------*- C -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2026 Project LLZK
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9//
10// This header declares the C interface for registering and accessing the
11// POD 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_POD_H
19#define LLZK_C_DIALECT_POD_H
20
21#include "llzk-c/Support.h"
22
23#include <mlir-c/BuiltinAttributes.h>
24#include <mlir-c/IR.h>
25#include <mlir-c/Support.h>
26
27#include <stdint.h>
28
29// Include the generated CAPI
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
40
41//===----------------------------------------------------------------------===//
42// Auxiliary types
43//===----------------------------------------------------------------------===//
44
47typedef struct LlzkRecordValue {
49 MlirStringRef name;
51 MlirValue value;
53
54//===----------------------------------------------------------------------===//
55// RecordAttr
56//===----------------------------------------------------------------------===//
57
59MLIR_CAPI_EXPORTED MlirAttribute
60llzkPod_RecordAttrGetInferredContext(MlirIdentifier name, MlirType type);
61
62//===----------------------------------------------------------------------===//
63// PodType
64//===----------------------------------------------------------------------===//
65
67MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeGetFromInitialValues(
68 MlirContext context, intptr_t nRecords, LlzkRecordValue const *records
69);
70
75MLIR_CAPI_EXPORTED void llzkPod_PodTypeGetRecords(MlirType type, MlirAttribute *dst);
76
81MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecord(MlirType type, MlirStringRef name);
82
87MLIR_CAPI_EXPORTED MlirType
88llzkPod_PodTypeLookupRecordWithinLocation(MlirType type, MlirStringRef name, MlirLocation loc);
89
94MLIR_CAPI_EXPORTED MlirType
95llzkPod_PodTypeLookupRecordWithinOperation(MlirType type, MlirStringRef name, MlirOperation op);
96
97//===----------------------------------------------------------------------===//
98// NewPodOp
99//===----------------------------------------------------------------------===//
100
105 Pod, NewPodOp, InferredFromInitialValues, intptr_t nValues, LlzkRecordValue const *values
106);
107
112 Pod, NewPodOp, MlirType type, intptr_t nValues, LlzkRecordValue const *values
113);
114
119 Pod, NewPodOp, WithMapOperands, MlirType type, intptr_t nValues, LlzkRecordValue const *values,
121);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif // LLZK_C_DIALECT_POD_H
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecordWithinLocation(MlirType type, MlirStringRef name, MlirLocation loc)
Lookups a record type by name.
Definition POD.cpp:104
MLIR_CAPI_EXPORTED MlirAttribute llzkPod_RecordAttrGetInferredContext(MlirIdentifier name, MlirType type)
Creates a new llzk::pod::RecordAttr using the MlirContext of the given type.
Definition POD.cpp:60
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecord(MlirType type, MlirStringRef name)
Lookups a record type by name.
Definition POD.cpp:95
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecordWithinOperation(MlirType type, MlirStringRef name, MlirOperation op)
Lookups a record type by name.
Definition POD.cpp:112
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(POD, llzk__pod)
Get reference to the LLZK pod dialect.
MLIR_CAPI_EXPORTED void llzkPod_PodTypeGetRecords(MlirType type, MlirAttribute *dst)
Writes the records into the given array that must have been previously allocated with enough space.
Definition POD.cpp:76
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeGetFromInitialValues(MlirContext context, intptr_t nRecords, LlzkRecordValue const *records)
Creates an llzk::pod::PodType using a list of values for inferring the records.
Definition POD.cpp:69
#define LLZK_DECLARE_SUFFIX_OP_BUILD_METHOD(dialect, op, suffix,...)
Definition Support.h:33
#define LLZK_DECLARE_OP_BUILD_METHOD(dialect, op,...)
Definition Support.h:38
Encapsulates the arguments related to affine maps that are common in operation constructors that supp...
Definition Support.h:103
Information needed to define a pod RecordAttr given a name and a value that will be stored in the rec...
Definition POD.h:47
MlirValue value
Initial value for the record.
Definition POD.h:51
MlirStringRef name
Record name.
Definition POD.h:49