CIRCT 20.0.0git
Loading...
Searching...
No Matches
ESI.h
Go to the documentation of this file.
1//===- ESI.h - C interface for the ESI dialect --------------------*- C -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef CIRCT_C_DIALECT_ESI_H
10#define CIRCT_C_DIALECT_ESI_H
11
12#include "mlir-c/IR.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
19MLIR_CAPI_EXPORTED void registerESIPasses(void);
20
21MLIR_CAPI_EXPORTED bool circtESITypeIsAChannelType(MlirType type);
22MLIR_CAPI_EXPORTED MlirType circtESIChannelTypeGet(MlirType inner,
23 uint32_t signaling,
24 uint64_t dataDelay);
25MLIR_CAPI_EXPORTED MlirType circtESIChannelGetInner(MlirType channelType);
26MLIR_CAPI_EXPORTED uint32_t circtESIChannelGetSignaling(MlirType channelType);
27MLIR_CAPI_EXPORTED uint64_t circtESIChannelGetDataDelay(MlirType channelType);
28
29MLIR_CAPI_EXPORTED bool circtESITypeIsAnAnyType(MlirType type);
30MLIR_CAPI_EXPORTED MlirType circtESIAnyTypeGet(MlirContext);
31
32MLIR_CAPI_EXPORTED bool circtESITypeIsAListType(MlirType type);
33MLIR_CAPI_EXPORTED MlirType circtESIListTypeGet(MlirType inner);
34MLIR_CAPI_EXPORTED MlirType
35circtESIListTypeGetElementType(MlirType channelType);
36
37MLIR_CAPI_EXPORTED void circtESIAppendMlirFile(MlirModule,
38 MlirStringRef fileName);
39MLIR_CAPI_EXPORTED MlirOperation circtESILookup(MlirModule,
40 MlirStringRef symbol);
41
42MLIR_CAPI_EXPORTED bool circtESICheckInnerTypeMatch(MlirType to, MlirType from);
43
44//===----------------------------------------------------------------------===//
45// Channel bundles
46//===----------------------------------------------------------------------===//
47
48// NOLINTNEXTLINE(modernize-use-using)
49typedef struct {
50 MlirIdentifier name;
51 unsigned direction;
52 MlirType channelType; // MUST be ChannelType.
54
55MLIR_CAPI_EXPORTED bool circtESITypeIsABundleType(MlirType type);
56MLIR_CAPI_EXPORTED MlirType circtESIBundleTypeGet(
57 MlirContext, size_t numChannels,
58 const CirctESIBundleTypeBundleChannel *channels, bool resettable);
59MLIR_CAPI_EXPORTED bool circtESIBundleTypeGetResettable(MlirType bundle);
60MLIR_CAPI_EXPORTED size_t circtESIBundleTypeGetNumChannels(MlirType bundle);
61MLIR_CAPI_EXPORTED CirctESIBundleTypeBundleChannel
62circtESIBundleTypeGetChannel(MlirType bundle, size_t idx);
63
64//===----------------------------------------------------------------------===//
65// Services
66//===----------------------------------------------------------------------===//
67
68typedef MlirLogicalResult (*CirctESIServiceGeneratorFunc)(
69 MlirOperation serviceImplementReqOp, MlirOperation declOp,
70 MlirOperation recordOp, void *userData);
71MLIR_CAPI_EXPORTED void circtESIRegisterGlobalServiceGenerator(
72 MlirStringRef impl_type, CirctESIServiceGeneratorFunc, void *userData);
73
74//===----------------------------------------------------------------------===//
75// AppID
76//===----------------------------------------------------------------------===//
77
78MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDAttr(MlirAttribute);
79MLIR_CAPI_EXPORTED
80MlirAttribute circtESIAppIDAttrGet(MlirContext, MlirStringRef name,
81 uint64_t index);
82MLIR_CAPI_EXPORTED
83MlirAttribute circtESIAppIDAttrGetNoIdx(MlirContext ctxt, MlirStringRef name);
84MLIR_CAPI_EXPORTED MlirStringRef circtESIAppIDAttrGetName(MlirAttribute attr);
85MLIR_CAPI_EXPORTED bool circtESIAppIDAttrGetIndex(MlirAttribute attr,
86 uint64_t *index);
87
88MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDPathAttr(MlirAttribute);
89MLIR_CAPI_EXPORTED
90MlirAttribute circtESIAppIDAttrPathGet(MlirContext, MlirAttribute root,
91 intptr_t numElements,
92 MlirAttribute const *elements);
93MLIR_CAPI_EXPORTED MlirAttribute
94circtESIAppIDAttrPathGetRoot(MlirAttribute attr);
95MLIR_CAPI_EXPORTED uint64_t
97MLIR_CAPI_EXPORTED MlirAttribute
98circtESIAppIDAttrPathGetComponent(MlirAttribute attr, uint64_t index);
99
100// NOLINTNEXTLINE(modernize-use-using)
101typedef struct {
102 void *ptr;
104
105/// Create an index of appids through which to do appid lookups efficiently.
106MLIR_CAPI_EXPORTED CirctESIAppIDIndex circtESIAppIDIndexGet(MlirOperation root);
107
108/// Free an AppIDIndex.
109MLIR_CAPI_EXPORTED void circtESIAppIDIndexFree(CirctESIAppIDIndex);
110
111MLIR_CAPI_EXPORTED MlirAttribute
113
114MLIR_CAPI_EXPORTED
116 MlirOperation fromMod,
117 MlirAttribute appid,
118 MlirLocation loc);
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif // CIRCT_C_DIALECT_ESI_H
MlirType uint64_t numElements
Definition CHIRRTL.cpp:30
MLIR_CAPI_EXPORTED uint32_t circtESIChannelGetSignaling(MlirType channelType)
Definition ESI.cpp:46
MLIR_CAPI_EXPORTED MlirType circtESIBundleTypeGet(MlirContext, size_t numChannels, const CirctESIBundleTypeBundleChannel *channels, bool resettable)
Definition ESI.cpp:112
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrGet(MlirContext, MlirStringRef name, uint64_t index)
Definition ESI.cpp:148
MLIR_CAPI_EXPORTED bool circtESIBundleTypeGetResettable(MlirType bundle)
Definition ESI.cpp:126
MLIR_CAPI_EXPORTED bool circtESITypeIsAnAnyType(MlirType type)
Definition ESI.cpp:53
MLIR_CAPI_EXPORTED void circtESIRegisterGlobalServiceGenerator(MlirStringRef impl_type, CirctESIServiceGeneratorFunc, void *userData)
Definition ESI.cpp:94
MlirLogicalResult(* CirctESIServiceGeneratorFunc)(MlirOperation serviceImplementReqOp, MlirOperation declOp, MlirOperation recordOp, void *userData)
Definition ESI.h:68
MLIR_CAPI_EXPORTED MlirOperation circtESILookup(MlirModule, MlirStringRef symbol)
Definition ESI.cpp:90
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDIndexGetChildAppIDsOf(CirctESIAppIDIndex, MlirOperation)
Definition ESI.cpp:209
MLIR_CAPI_EXPORTED MlirType circtESIChannelGetInner(MlirType channelType)
Definition ESI.cpp:43
MLIR_CAPI_EXPORTED CirctESIBundleTypeBundleChannel circtESIBundleTypeGetChannel(MlirType bundle, size_t idx)
Definition ESI.cpp:132
MLIR_CAPI_EXPORTED void registerESIPasses(void)
Definition ESI.cpp:27
MLIR_CAPI_EXPORTED void circtESIAppIDIndexFree(CirctESIAppIDIndex)
Free an AppIDIndex.
Definition ESI.cpp:204
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrGetNoIdx(MlirContext ctxt, MlirStringRef name)
Definition ESI.cpp:153
MLIR_CAPI_EXPORTED uint64_t circtESIAppIDAttrPathGetNumComponents(MlirAttribute attr)
Definition ESI.cpp:184
MLIR_CAPI_EXPORTED void circtESIAppendMlirFile(MlirModule, MlirStringRef fileName)
Definition ESI.cpp:77
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDIndexGetAppIDPath(CirctESIAppIDIndex, MlirOperation fromMod, MlirAttribute appid, MlirLocation loc)
Definition ESI.cpp:215
MLIR_CAPI_EXPORTED MlirStringRef circtESIAppIDAttrGetName(MlirAttribute attr)
Definition ESI.cpp:157
MLIR_CAPI_EXPORTED MlirType circtESIChannelTypeGet(MlirType inner, uint32_t signaling, uint64_t dataDelay)
Definition ESI.cpp:33
MLIR_CAPI_EXPORTED bool circtESITypeIsAChannelType(MlirType type)
Definition ESI.cpp:29
MLIR_CAPI_EXPORTED size_t circtESIBundleTypeGetNumChannels(MlirType bundle)
Definition ESI.cpp:129
MLIR_CAPI_EXPORTED MlirType circtESIListTypeGetElementType(MlirType channelType)
Definition ESI.cpp:69
MLIR_CAPI_EXPORTED MlirType circtESIAnyTypeGet(MlirContext)
Definition ESI.cpp:56
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrPathGetComponent(MlirAttribute attr, uint64_t index)
Definition ESI.cpp:187
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ESI, esi)
MLIR_CAPI_EXPORTED uint64_t circtESIChannelGetDataDelay(MlirType channelType)
Definition ESI.cpp:49
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrPathGet(MlirContext, MlirAttribute root, intptr_t numElements, MlirAttribute const *elements)
Definition ESI.cpp:172
MLIR_CAPI_EXPORTED MlirType circtESIListTypeGet(MlirType inner)
Definition ESI.cpp:64
MLIR_CAPI_EXPORTED bool circtESITypeIsABundleType(MlirType type)
Definition ESI.cpp:109
MLIR_CAPI_EXPORTED bool circtESIAppIDAttrGetIndex(MlirAttribute attr, uint64_t *index)
Definition ESI.cpp:160
MLIR_CAPI_EXPORTED bool circtESICheckInnerTypeMatch(MlirType to, MlirType from)
Definition ESI.cpp:73
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrPathGetRoot(MlirAttribute attr)
Definition ESI.cpp:181
MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDPathAttr(MlirAttribute)
Definition ESI.cpp:168
MLIR_CAPI_EXPORTED CirctESIAppIDIndex circtESIAppIDIndexGet(MlirOperation root)
Create an index of appids through which to do appid lookups efficiently.
Definition ESI.cpp:196
MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDAttr(MlirAttribute)
Definition ESI.cpp:144
MLIR_CAPI_EXPORTED bool circtESITypeIsAListType(MlirType type)
Definition ESI.cpp:60
Definition esi.py:1
MlirIdentifier name
Definition ESI.h:50