LLZK 2.1.1
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
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
41
42//===----------------------------------------------------------------------===//
43// Auxiliary types
44//===----------------------------------------------------------------------===//
45
48typedef struct LlzkRecordValue {
50 MlirStringRef name;
52 MlirValue value;
54
55//===----------------------------------------------------------------------===//
56// RecordAttr
57//===----------------------------------------------------------------------===//
58
60MLIR_CAPI_EXPORTED MlirAttribute
61llzkPod_RecordAttrGetInferredContext(MlirIdentifier name, MlirType type);
62
63//===----------------------------------------------------------------------===//
64// PodType
65//===----------------------------------------------------------------------===//
66
68MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeGetFromInitialValues(
69 MlirContext context, intptr_t nRecords, LlzkRecordValue const *records
70);
71
76MLIR_CAPI_EXPORTED void llzkPod_PodTypeGetRecords(MlirType type, MlirAttribute *dst);
77
82MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecord(MlirType type, MlirStringRef name);
83
88MLIR_CAPI_EXPORTED MlirType
89llzkPod_PodTypeLookupRecordWithinLocation(MlirType type, MlirStringRef name, MlirLocation loc);
90
95MLIR_CAPI_EXPORTED MlirType
96llzkPod_PodTypeLookupRecordWithinOperation(MlirType type, MlirStringRef name, MlirOperation op);
97
98//===----------------------------------------------------------------------===//
99// NewPodOp
100//===----------------------------------------------------------------------===//
101
106 Pod, NewPodOp, InferredFromInitialValues, intptr_t nValues, LlzkRecordValue const *values
107);
108
113 Pod, NewPodOp, MlirType type, intptr_t nValues, LlzkRecordValue const *values
114);
115
120 Pod, NewPodOp, WithMapOperands, MlirType type, intptr_t nValues, LlzkRecordValue const *values,
122);
123
124#ifdef __cplusplus
125}
126#endif
127
128#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:111
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:67
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecord(MlirType type, MlirStringRef name)
Lookups a record type by name.
Definition POD.cpp:102
MLIR_CAPI_EXPORTED MlirType llzkPod_PodTypeLookupRecordWithinOperation(MlirType type, MlirStringRef name, MlirOperation op)
Lookups a record type by name.
Definition POD.cpp:119
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:83
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:76
#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:48
MlirValue value
Initial value for the record.
Definition POD.h:52
MlirStringRef name
Record name.
Definition POD.h:50