LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Function.h
Go to the documentation of this file.
1//===-- Function.h - C API for Function 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// Function 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_FUNCTION_H
19#define LLZK_C_DIALECT_FUNCTION_H
20
21#include "llzk-c/Support.h"
22
23#include <mlir-c/IR.h>
24#include <mlir-c/Support.h>
25
26#include <stdint.h>
27
28// Include the generated CAPI
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
38
39//===----------------------------------------------------------------------===//
40// FuncDefOp
41//===----------------------------------------------------------------------===//
42
45MLIR_CAPI_EXPORTED MlirOperation llzkFunction_FuncDefOpCreateWithAttrsAndArgAttrs(
46 MlirLocation loc, MlirStringRef name, MlirType type, intptr_t nAttrs,
47 MlirNamedAttribute const *attrs, intptr_t nArgAttrs, MlirAttribute const *argAttrs
48);
49
51static inline MlirOperation llzkFunction_FuncDefOpCreateWithAttrs(
52 MlirLocation loc, MlirStringRef name, MlirType type, intptr_t nAttrs,
53 MlirNamedAttribute const *attrs
54) {
56 loc, name, type, nAttrs, attrs, /*nArgAttrs=*/0, /*argAttrs=*/NULL
57 );
58}
59
62static inline MlirOperation llzkFunction_FuncDefOpCreateWithArgAttrs(
63 MlirLocation loc, MlirStringRef name, MlirType type, intptr_t nArgAttrs,
64 MlirAttribute const *argAttrs
65) {
67 loc, name, type, /*nAttrs=*/0, /*attrs=*/NULL, nArgAttrs, argAttrs
68 );
69}
70
72static inline MlirOperation
73llzkFunction_FuncDefOpCreateWithoutAttrs(MlirLocation loc, MlirStringRef name, MlirType type) {
74 return llzkFunction_FuncDefOpCreateWithAttrs(loc, name, type, /*nAttrs=*/0, /*attrs=*/NULL);
75}
76
77//===----------------------------------------------------------------------===//
78// CallOp
79//===----------------------------------------------------------------------===//
80
83 Function, CallOp, intptr_t numResults, MlirType const *results, MlirAttribute name,
84 intptr_t numOperands, MlirValue const *operands
85);
86
89 Function, CallOp, ToCallee, MlirOperation callee, intptr_t numOperands,
90 MlirValue const *operands
91);
92
95 Function, CallOp, WithMapOperands, intptr_t numResults, MlirType const *results,
96 MlirAttribute name, LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands,
97 MlirValue const *argOperands
98);
99
102 Function, CallOp, ToCalleeWithMapOperands, MlirOperation callee,
103 LlzkAffineMapOperandsBuilder mapOperands, intptr_t numArgOperands, MlirValue const *argOperands
104);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif // LLZK_C_DIALECT_FUNCTION_H
MLIR_CAPI_EXPORTED MlirOperation llzkFunction_FuncDefOpCreateWithAttrsAndArgAttrs(MlirLocation loc, MlirStringRef name, MlirType type, intptr_t nAttrs, MlirNamedAttribute const *attrs, intptr_t nArgAttrs, MlirAttribute const *argAttrs)
Creates a FuncDefOp with the given attributes and argument attributes.
Definition Function.cpp:47
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Function, llzk__function)
Get reference to the LLZK function dialect.
#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