LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Poly.h
Go to the documentation of this file.
1//===-- Poly.h - C API for Polymorphic 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// Polymorphic 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_POLYMORPHIC_H
19#define LLZK_C_DIALECT_POLYMORPHIC_H
20
21#include "llzk-c/Support.h"
22
23#include <mlir-c/AffineExpr.h>
24#include <mlir-c/AffineMap.h>
25#include <mlir-c/IR.h>
26#include <mlir-c/Support.h>
27
28// Include the generated CAPI
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
38MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Polymorphic, llzk__polymorphic);
39
40//===----------------------------------------------------------------------===//
41// TypeVarType
42//===----------------------------------------------------------------------===//
43
45MLIR_CAPI_EXPORTED MlirType
46llzkPoly_TypeVarTypeGetFromStringRef(MlirContext context, MlirStringRef value);
47
49MLIR_CAPI_EXPORTED MlirType llzkPoly_TypeVarTypeGetFromAttr(MlirAttribute value);
50
51//===------------------------------------------------------------------===//
52// TemplateOp
53//===------------------------------------------------------------------===//
54
56MLIR_CAPI_EXPORTED MlirBlock llzkPoly_TemplateOpGetBody(MlirOperation op);
57
59MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstParamOps(MlirOperation op);
60
62MLIR_CAPI_EXPORTED intptr_t llzkPoly_TemplateOpNumConstParamOps(MlirOperation op);
63
68MLIR_CAPI_EXPORTED void llzkPoly_TemplateOpGetConstParamNames(MlirOperation op, MlirAttribute *dst);
69
71MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstParamNamed(MlirOperation op, MlirStringRef find);
72
74MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstExprOps(MlirOperation op);
75
77MLIR_CAPI_EXPORTED intptr_t llzkPoly_TemplateOpNumConstExprOps(MlirOperation op);
78
83MLIR_CAPI_EXPORTED void llzkPoly_TemplateOpGetConstExprNames(MlirOperation op, MlirAttribute *dst);
84
86MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstExprNamed(MlirOperation op, MlirStringRef find);
87
88//===----------------------------------------------------------------------===//
89// ApplyMapOp
90//===----------------------------------------------------------------------===//
91
94 Poly, ApplyMapOp, MlirAttribute affineMapAttr, MlirValueRange operands
95);
96
99 Poly, ApplyMapOp, WithAffineMap, MlirAffineMap affineMap, MlirValueRange operands
100);
101
104 Poly, ApplyMapOp, WithAffineExpr, MlirAffineExpr affineExpr, MlirValueRange operands
105);
106
108MLIR_CAPI_EXPORTED intptr_t llzkPoly_ApplyMapOpGetNumDimOperands(MlirOperation op);
109
113MLIR_CAPI_EXPORTED void llzkPoly_ApplyMapOpGetDimOperands(MlirOperation op, MlirValue *dst);
114
116MLIR_CAPI_EXPORTED intptr_t llzkPoly_ApplyMapOpGetNumSymbolOperands(MlirOperation op);
117
121MLIR_CAPI_EXPORTED void llzkPoly_ApplyMapOpGetSymbolOperands(MlirOperation op, MlirValue *dst);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif // LLZK_C_DIALECT_POLYMORPHIC_H
MLIR_CAPI_EXPORTED MlirType llzkPoly_TypeVarTypeGetFromStringRef(MlirContext context, MlirStringRef value)
Creates a llzk::polymorphic::TypeVarType.
Definition Poly.cpp:47
MLIR_CAPI_EXPORTED intptr_t llzkPoly_ApplyMapOpGetNumSymbolOperands(MlirOperation op)
Returns the number of operands that correspond to symbols in the affine map.
Definition Poly.cpp:170
MLIR_CAPI_EXPORTED MlirType llzkPoly_TypeVarTypeGetFromAttr(MlirAttribute value)
Creates a llzk::polymorphic::TypeVarType from either a StringAttr or a FlatSymbolRefAttr.
Definition Poly.cpp:51
MLIR_CAPI_EXPORTED void llzkPoly_ApplyMapOpGetSymbolOperands(MlirOperation op, MlirValue *dst)
Writes into the destination buffer the operands that correspond to symbols in the affine map.
Definition Poly.cpp:177
MLIR_CAPI_EXPORTED intptr_t llzkPoly_ApplyMapOpGetNumDimOperands(MlirOperation op)
Returns the number of operands that correspond to dimensions in the affine map.
Definition Poly.cpp:158
MLIR_CAPI_EXPORTED intptr_t llzkPoly_TemplateOpNumConstExprOps(MlirOperation op)
Returns the number of TemplateExprOp children in the TemplateOp.
Definition Poly.cpp:93
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Polymorphic, llzk__polymorphic)
Get reference to the LLZK poly dialect.
MLIR_CAPI_EXPORTED void llzkPoly_TemplateOpGetConstExprNames(MlirOperation op, MlirAttribute *dst)
Writes into the destination buffer the names of all TemplateExprOp children as FlatSymbolRefAttr attr...
Definition Poly.cpp:97
MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstParamOps(MlirOperation op)
Returns true if the TemplateOp has any TemplateParamOp children.
Definition Poly.cpp:73
MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstParamNamed(MlirOperation op, MlirStringRef find)
Returns true if the TemplateOp has a TemplateParamOp with the given name.
Definition Poly.cpp:85
MLIR_CAPI_EXPORTED void llzkPoly_TemplateOpGetConstParamNames(MlirOperation op, MlirAttribute *dst)
Writes into the destination buffer the names of all TemplateParamOp children as FlatSymbolRefAttr att...
Definition Poly.cpp:81
MLIR_CAPI_EXPORTED void llzkPoly_ApplyMapOpGetDimOperands(MlirOperation op, MlirValue *dst)
Writes into the destination buffer the operands that correspond to dimensions in the affine map.
Definition Poly.cpp:165
MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstExprNamed(MlirOperation op, MlirStringRef find)
Returns true if the TemplateOp has a TemplateExprOp with the given name.
Definition Poly.cpp:101
MLIR_CAPI_EXPORTED intptr_t llzkPoly_TemplateOpNumConstParamOps(MlirOperation op)
Returns the number of TemplateParamOp children in the TemplateOp.
Definition Poly.cpp:77
MLIR_CAPI_EXPORTED bool llzkPoly_TemplateOpHasConstExprOps(MlirOperation op)
Returns true if the TemplateOp has any TemplateExprOp children.
Definition Poly.cpp:89
MLIR_CAPI_EXPORTED MlirBlock llzkPoly_TemplateOpGetBody(MlirOperation op)
Returns the single body Block within the TemplateOp's Region.
Definition Poly.cpp:71
#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
Representation of an mlir::ValueRange
Definition Support.h:47