CIRCT 22.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// Window types
66//===----------------------------------------------------------------------===//
67
68MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowType(MlirType type);
69MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGet(MlirContext cctxt,
70 MlirAttribute name,
71 MlirType into,
72 size_t numFrames,
73 const MlirType *frames);
74MLIR_CAPI_EXPORTED MlirAttribute circtESIWindowTypeGetName(MlirType window);
75MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetInto(MlirType window);
76MLIR_CAPI_EXPORTED size_t circtESIWindowTypeGetNumFrames(MlirType window);
77MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetFrame(MlirType window,
78 size_t idx);
79MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetLoweredType(MlirType window);
80
81MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowFrameType(MlirType type);
82MLIR_CAPI_EXPORTED MlirType circtESIWindowFrameTypeGet(MlirContext cctxt,
83 MlirAttribute name,
84 size_t numMembers,
85 const MlirType *members);
86MLIR_CAPI_EXPORTED MlirAttribute circtESIWindowFrameTypeGetName(MlirType frame);
87MLIR_CAPI_EXPORTED size_t circtESIWindowFrameTypeGetNumMembers(MlirType frame);
88MLIR_CAPI_EXPORTED MlirType circtESIWindowFrameTypeGetMember(MlirType frame,
89 size_t idx);
90
91MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowFieldType(MlirType type);
92MLIR_CAPI_EXPORTED MlirType circtESIWindowFieldTypeGet(MlirContext cctxt,
93 MlirAttribute fieldName,
94 uint64_t numItems);
95MLIR_CAPI_EXPORTED MlirAttribute
97MLIR_CAPI_EXPORTED uint64_t circtESIWindowFieldTypeGetNumItems(MlirType field);
98
99//===----------------------------------------------------------------------===//
100// Services
101//===----------------------------------------------------------------------===//
102
103typedef MlirLogicalResult (*CirctESIServiceGeneratorFunc)(
104 MlirOperation serviceImplementReqOp, MlirOperation declOp,
105 MlirOperation recordOp, void *userData);
106MLIR_CAPI_EXPORTED void circtESIRegisterGlobalServiceGenerator(
107 MlirStringRef impl_type, CirctESIServiceGeneratorFunc, void *userData);
108
109//===----------------------------------------------------------------------===//
110// AppID
111//===----------------------------------------------------------------------===//
112
113MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDAttr(MlirAttribute);
114MLIR_CAPI_EXPORTED
115MlirAttribute circtESIAppIDAttrGet(MlirContext, MlirStringRef name,
116 uint64_t index);
117MLIR_CAPI_EXPORTED
118MlirAttribute circtESIAppIDAttrGetNoIdx(MlirContext ctxt, MlirStringRef name);
119MLIR_CAPI_EXPORTED MlirStringRef circtESIAppIDAttrGetName(MlirAttribute attr);
120MLIR_CAPI_EXPORTED bool circtESIAppIDAttrGetIndex(MlirAttribute attr,
121 uint64_t *index);
122
123MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDPathAttr(MlirAttribute);
124MLIR_CAPI_EXPORTED
125MlirAttribute circtESIAppIDAttrPathGet(MlirContext, MlirAttribute root,
126 intptr_t numElements,
127 MlirAttribute const *elements);
128MLIR_CAPI_EXPORTED MlirAttribute
129circtESIAppIDAttrPathGetRoot(MlirAttribute attr);
130MLIR_CAPI_EXPORTED uint64_t
131circtESIAppIDAttrPathGetNumComponents(MlirAttribute attr);
132MLIR_CAPI_EXPORTED MlirAttribute
133circtESIAppIDAttrPathGetComponent(MlirAttribute attr, uint64_t index);
134
135// NOLINTNEXTLINE(modernize-use-using)
136typedef struct {
137 void *ptr;
139
140/// Create an index of appids through which to do appid lookups efficiently.
141MLIR_CAPI_EXPORTED CirctESIAppIDIndex circtESIAppIDIndexGet(MlirOperation root);
142
143/// Free an AppIDIndex.
144MLIR_CAPI_EXPORTED void circtESIAppIDIndexFree(CirctESIAppIDIndex);
145
146MLIR_CAPI_EXPORTED MlirAttribute
148
149MLIR_CAPI_EXPORTED
151 MlirOperation fromMod,
152 MlirAttribute appid,
153 MlirLocation loc);
154
155#ifdef __cplusplus
156}
157#endif
158
159#endif // CIRCT_C_DIALECT_ESI_H
MlirType uint64_t numElements
Definition CHIRRTL.cpp:30
MLIR_CAPI_EXPORTED MlirType circtESIWindowFrameTypeGet(MlirContext cctxt, MlirAttribute name, size_t numMembers, const MlirType *members)
Definition ESI.cpp:183
MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowType(MlirType type)
Definition ESI.cpp:144
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 size_t circtESIWindowTypeGetNumFrames(MlirType window)
Definition ESI.cpp:167
MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetFrame(MlirType window, size_t idx)
Definition ESI.cpp:171
MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowFrameType(MlirType type)
Definition ESI.cpp:179
MLIR_CAPI_EXPORTED MlirAttribute circtESIWindowFrameTypeGetName(MlirType frame)
Definition ESI.cpp:194
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrGet(MlirContext, MlirStringRef name, uint64_t index)
Definition ESI.cpp:232
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:103
MLIR_CAPI_EXPORTED MlirOperation circtESILookup(MlirModule, MlirStringRef symbol)
Definition ESI.cpp:90
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDIndexGetChildAppIDsOf(CirctESIAppIDIndex, MlirOperation)
Definition ESI.cpp:293
MLIR_CAPI_EXPORTED MlirType circtESIChannelGetInner(MlirType channelType)
Definition ESI.cpp:43
MLIR_CAPI_EXPORTED MlirAttribute circtESIWindowFieldTypeGetFieldName(MlirType field)
Definition ESI.cpp:216
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:288
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrGetNoIdx(MlirContext ctxt, MlirStringRef name)
Definition ESI.cpp:237
MLIR_CAPI_EXPORTED uint64_t circtESIAppIDAttrPathGetNumComponents(MlirAttribute attr)
Definition ESI.cpp:268
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:299
MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetLoweredType(MlirType window)
Definition ESI.cpp:175
MLIR_CAPI_EXPORTED MlirStringRef circtESIAppIDAttrGetName(MlirAttribute attr)
Definition ESI.cpp:241
MLIR_CAPI_EXPORTED MlirType circtESIChannelTypeGet(MlirType inner, uint32_t signaling, uint64_t dataDelay)
Definition ESI.cpp:33
MLIR_CAPI_EXPORTED MlirType circtESIWindowFrameTypeGetMember(MlirType frame, size_t idx)
Definition ESI.cpp:202
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 MlirType circtESIWindowTypeGet(MlirContext cctxt, MlirAttribute name, MlirType into, size_t numFrames, const MlirType *frames)
Definition ESI.cpp:148
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrPathGetComponent(MlirAttribute attr, uint64_t index)
Definition ESI.cpp:271
MLIR_CAPI_EXPORTED MlirType circtESIWindowTypeGetInto(MlirType window)
Definition ESI.cpp:163
MLIR_CAPI_EXPORTED MlirType circtESIWindowFieldTypeGet(MlirContext cctxt, MlirAttribute fieldName, uint64_t numItems)
Definition ESI.cpp:210
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ESI, esi)
MLIR_CAPI_EXPORTED uint64_t circtESIWindowFieldTypeGetNumItems(MlirType field)
Definition ESI.cpp:220
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:256
MLIR_CAPI_EXPORTED bool circtESITypeIsAWindowFieldType(MlirType type)
Definition ESI.cpp:206
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:244
MLIR_CAPI_EXPORTED size_t circtESIWindowFrameTypeGetNumMembers(MlirType frame)
Definition ESI.cpp:198
MLIR_CAPI_EXPORTED bool circtESICheckInnerTypeMatch(MlirType to, MlirType from)
Definition ESI.cpp:73
MLIR_CAPI_EXPORTED MlirAttribute circtESIAppIDAttrPathGetRoot(MlirAttribute attr)
Definition ESI.cpp:265
MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDPathAttr(MlirAttribute)
Definition ESI.cpp:252
MLIR_CAPI_EXPORTED MlirAttribute circtESIWindowTypeGetName(MlirType window)
Definition ESI.cpp:159
MLIR_CAPI_EXPORTED CirctESIAppIDIndex circtESIAppIDIndexGet(MlirOperation root)
Create an index of appids through which to do appid lookups efficiently.
Definition ESI.cpp:280
MLIR_CAPI_EXPORTED bool circtESIAttributeIsAnAppIDAttr(MlirAttribute)
Definition ESI.cpp:228
MLIR_CAPI_EXPORTED bool circtESITypeIsAListType(MlirType type)
Definition ESI.cpp:60
Definition esi.py:1
MlirIdentifier name
Definition ESI.h:50