CIRCT 23.0.0git
Loading...
Searching...
No Matches
RTG.h
Go to the documentation of this file.
1//===- RTG.h - C interface for the for RTG 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_RTG_H
10#define CIRCT_C_DIALECT_RTG_H
11
12#include "mlir-c/IR.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18//===----------------------------------------------------------------------===//
19// Dialect API.
20//===----------------------------------------------------------------------===//
21
23MLIR_CAPI_EXPORTED void registerRTGPipelines(void);
24
25//===----------------------------------------------------------------------===//
26// Type API.
27//===----------------------------------------------------------------------===//
28
29/// If the type is an RTG sequence.
30MLIR_CAPI_EXPORTED bool rtgTypeIsASequence(MlirType type);
31
32/// Creates an RTG sequence type in the context.
33MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGet(MlirContext ctxt,
34 intptr_t numElements,
35 MlirType const *elementTypes);
36
37/// The number of substitution elements of the RTG sequence.
38MLIR_CAPI_EXPORTED unsigned rtgSequenceTypeGetNumElements(MlirType type);
39
40/// The type of of the substitution element at the given index.
41MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGetElement(MlirType type,
42 unsigned i);
43
44/// If the type is an RTG randomized sequence.
45MLIR_CAPI_EXPORTED bool rtgTypeIsARandomizedSequence(MlirType type);
46
47/// Creates an RTG randomized sequence type in the context.
48MLIR_CAPI_EXPORTED MlirType rtgRandomizedSequenceTypeGet(MlirContext ctxt);
49
50/// If the type is an RTG label.
51MLIR_CAPI_EXPORTED bool rtgTypeIsALabel(MlirType type);
52
53/// Creates an RTG mode type in the context.
54MLIR_CAPI_EXPORTED MlirType rtgLabelTypeGet(MlirContext ctxt);
55
56/// If the type is an RTG set.
57MLIR_CAPI_EXPORTED bool rtgTypeIsASet(MlirType type);
58
59/// Creates an RTG set type in the context.
60MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirType elementType);
61
62/// Return the element type of the RTG set.
63MLIR_CAPI_EXPORTED MlirType rtgSetTypeGetElementType(MlirType type);
64
65/// If the type is an RTG bag.
66MLIR_CAPI_EXPORTED bool rtgTypeIsABag(MlirType type);
67
68/// Creates an RTG bag type in the context.
69MLIR_CAPI_EXPORTED MlirType rtgBagTypeGet(MlirType elementType);
70
71/// Return the element type of the RTG bag.
72MLIR_CAPI_EXPORTED MlirType rtgBagTypeGetElementType(MlirType type);
73
74/// If the type is an RTG dict.
75MLIR_CAPI_EXPORTED bool rtgTypeIsADict(MlirType type);
76
77/// Creates an RTG dict type in the context.
78MLIR_CAPI_EXPORTED MlirType rtgDictTypeGet(MlirContext ctxt,
79 intptr_t numEntries,
80 MlirAttribute const *entryNames,
81 MlirType const *entryTypes);
82
83/// Creates an RTG array type in the context.
84MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGet(MlirType elementType);
85
86/// If the type is an RTG array.
87MLIR_CAPI_EXPORTED bool rtgTypeIsAArray(MlirType type);
88
89/// Returns the element type of the RTG array.
90MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGetElementType(MlirType type);
91
92/// If the type is an RTG map.
93MLIR_CAPI_EXPORTED bool rtgTypeIsAMap(MlirType type);
94
95/// Creates an RTG map type in the context.
96MLIR_CAPI_EXPORTED MlirType rtgMapTypeGet(MlirType keyType, MlirType valueType);
97
98/// Return the key type of the RTG map.
99MLIR_CAPI_EXPORTED MlirType rtgMapTypeGetKeyType(MlirType type);
100
101/// Return the value type of the RTG map.
102MLIR_CAPI_EXPORTED MlirType rtgMapTypeGetValueType(MlirType type);
103
104/// Creates an RTG tuple type in the context.
105MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGet(MlirContext ctxt,
106 intptr_t numFields,
107 MlirType const *fieldTypes);
108
109/// If the type is an RTG tuple.
110MLIR_CAPI_EXPORTED bool rtgTypeIsATuple(MlirType type);
111
112/// Returns the number of fields in the RTG tuple.
113MLIR_CAPI_EXPORTED intptr_t rtgTypeGetNumFields(MlirType type);
114
115/// Returns a field type of the RTG tuple.
116MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGetFieldType(MlirType type,
117 intptr_t idx);
118
119/// If the type is an RTG memory.
120MLIR_CAPI_EXPORTED bool rtgTypeIsAMemory(MlirType type);
121
122/// Creates an RTG memory type in the context.
123MLIR_CAPI_EXPORTED MlirType rtgMemoryTypeGet(MlirContext ctx,
124 uint32_t addressWidth);
125
126/// Returns the address with of an RTG memory type.
127MLIR_CAPI_EXPORTED uint32_t rtgMemoryTypeGetAddressWidth(MlirType type);
128
129/// If the type is an RTG memory block.
130MLIR_CAPI_EXPORTED bool rtgTypeIsAMemoryBlock(MlirType type);
131
132/// Creates an RTG memory block type in the context.
133MLIR_CAPI_EXPORTED MlirType rtgMemoryBlockTypeGet(MlirContext ctx,
134 uint32_t addressWidth);
135
136/// Returns the address with of an RTG memory block type.
137MLIR_CAPI_EXPORTED uint32_t rtgMemoryBlockTypeGetAddressWidth(MlirType type);
138
139/// If the type is an RTG string.
140MLIR_CAPI_EXPORTED bool rtgTypeIsAString(MlirType type);
141
142/// Creates an RTG string type in the context.
143MLIR_CAPI_EXPORTED MlirType rtgStringTypeGet(MlirContext ctxt);
144
145/// If the type is an RTG continuation type.
146MLIR_CAPI_EXPORTED bool rtgTypeIsAContinuation(MlirType type);
147
148/// Creates an RTG continuation type with the given resume type.
149MLIR_CAPI_EXPORTED MlirType rtgContinuationTypeGet(MlirType resumeType);
150
151/// Returns the resume type of an RTG continuation type.
152MLIR_CAPI_EXPORTED MlirType rtgContinuationTypeGetResumeType(MlirType type);
153
154//===----------------------------------------------------------------------===//
155// Attribute API.
156//===----------------------------------------------------------------------===//
157
164
165/// If the attribute is an RTG label visibility.
166MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr);
167
168/// Get the RTG label visibility from the attribute.
169MLIR_CAPI_EXPORTED RTGLabelVisibility
170rtgLabelVisibilityAttrGetValue(MlirAttribute attr);
171
172/// Creates an RTG label visibility attribute in the context.
173MLIR_CAPI_EXPORTED MlirAttribute
174rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility);
175
176/// If the attribute is an RTG default context.
177MLIR_CAPI_EXPORTED bool rtgAttrIsADefaultContextAttr(MlirAttribute attr);
178
179/// Creates an RTG default context attribute in the context.
180MLIR_CAPI_EXPORTED MlirAttribute rtgDefaultContextAttrGet(MlirContext ctxt,
181 MlirType type);
182
183/// If the attribute is an RTG any context attribute.
184MLIR_CAPI_EXPORTED bool rtgAttrIsAAnyContextAttr(MlirAttribute attr);
185
186/// Creates an RTG any context attribute in the context.
187MLIR_CAPI_EXPORTED MlirAttribute rtgAnyContextAttrGet(MlirContext ctxt,
188 MlirType type);
189
190/// Checks if the attribute is an RTG virtual register config attribute.
191MLIR_CAPI_EXPORTED bool rtgAttrIsAVirtualRegisterConfig(MlirAttribute attr);
192
193/// Creates an RTG virtual register config attribute in the context.
194MLIR_CAPI_EXPORTED MlirAttribute rtgVirtualRegisterConfigAttrGet(
195 MlirContext ctxt, intptr_t numRegs, MlirAttribute const *allowedRegs);
196
197/// Returns the number of allowed registers in the RTG virtual register config
198/// attribute.
199MLIR_CAPI_EXPORTED intptr_t
201
202/// Returns the allowed register at the given index in the RTG virtual register
203/// config attribute.
204MLIR_CAPI_EXPORTED MlirAttribute
205rtgVirtualRegisterConfigAttrGetRegister(MlirAttribute attr, intptr_t index);
206
207/// Checks if the attribute is an RTG label attribute.
208MLIR_CAPI_EXPORTED bool rtgAttrIsALabel(MlirAttribute attr);
209
210/// Creates an RTG label attribute in the context with the given name.
211MLIR_CAPI_EXPORTED MlirAttribute rtgLabelAttrGet(MlirContext ctx,
212 MlirStringRef name);
213
214/// Returns the name of the RTG label attribute.
215MLIR_CAPI_EXPORTED MlirStringRef rtgLabelAttrGetName(MlirAttribute attr);
216
217/// Checks if the attribute is an RTG map attribute.
218MLIR_CAPI_EXPORTED bool rtgAttrIsAMap(MlirAttribute attr);
219
220/// Creates an RTG map attribute in the context with the given entries.
221MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrGet(MlirContext ctx,
222 MlirType mapType,
223 intptr_t numEntries,
224 MlirAttribute const *keys,
225 MlirAttribute const *values);
226
227/// Looks up the value associated with the given key in the RTG map attribute.
228/// Returns a null attribute if the key is not found.
229MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrLookup(MlirAttribute attr,
230 MlirAttribute key);
231
232#ifdef __cplusplus
233}
234#endif
235
236#include "circt/Dialect/RTG/Transforms/RTGPasses.capi.h.inc"
237
238#endif // CIRCT_C_DIALECT_RTG_H
MlirType uint64_t numElements
Definition CHIRRTL.cpp:30
MlirType elementType
Definition CHIRRTL.cpp:29
MLIR_CAPI_EXPORTED MlirAttribute rtgAnyContextAttrGet(MlirContext ctxt, MlirType type)
Creates an RTG any context attribute in the context.
Definition RTG.cpp:287
MLIR_CAPI_EXPORTED bool rtgTypeIsAMemory(MlirType type)
If the type is an RTG memory.
Definition RTG.cpp:180
MLIR_CAPI_EXPORTED bool rtgAttrIsAAnyContextAttr(MlirAttribute attr)
If the attribute is an RTG any context attribute.
Definition RTG.cpp:283
MLIR_CAPI_EXPORTED MlirType rtgLabelTypeGet(MlirContext ctxt)
Creates an RTG mode type in the context.
Definition RTG.cpp:73
MLIR_CAPI_EXPORTED RTGLabelVisibility rtgLabelVisibilityAttrGetValue(MlirAttribute attr)
Get the RTG label visibility from the attribute.
Definition RTG.cpp:251
MLIR_CAPI_EXPORTED MlirAttribute rtgVirtualRegisterConfigAttrGet(MlirContext ctxt, intptr_t numRegs, MlirAttribute const *allowedRegs)
Creates an RTG virtual register config attribute in the context.
Definition RTG.cpp:299
RTGLabelVisibility
Definition RTG.h:158
@ RTG_LABEL_VISIBILITY_EXTERNAL
Definition RTG.h:161
@ RTG_LABEL_VISIBILITY_GLOBAL
Definition RTG.h:160
@ RTG_LABEL_VISIBILITY_LOCAL
Definition RTG.h:159
MLIR_CAPI_EXPORTED MlirAttribute rtgVirtualRegisterConfigAttrGetRegister(MlirAttribute attr, intptr_t index)
Returns the allowed register at the given index in the RTG virtual register config attribute.
Definition RTG.cpp:311
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGetElement(MlirType type, unsigned i)
The type of of the substitution element at the given index.
Definition RTG.cpp:53
MLIR_CAPI_EXPORTED MlirAttribute rtgDefaultContextAttrGet(MlirContext ctxt, MlirType type)
Creates an RTG default context attribute in the context.
Definition RTG.cpp:240
MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrGet(MlirContext ctx, MlirType mapType, intptr_t numEntries, MlirAttribute const *keys, MlirAttribute const *values)
Creates an RTG map attribute in the context with the given entries.
Definition RTG.cpp:340
MLIR_CAPI_EXPORTED uint32_t rtgMemoryTypeGetAddressWidth(MlirType type)
Returns the address with of an RTG memory type.
Definition RTG.cpp:186
MLIR_CAPI_EXPORTED bool rtgTypeIsAArray(MlirType type)
If the type is an RTG array.
Definition RTG.cpp:131
MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr)
If the attribute is an RTG label visibility.
Definition RTG.cpp:247
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(RTG, rtg)
MLIR_CAPI_EXPORTED bool rtgAttrIsALabel(MlirAttribute attr)
Checks if the attribute is an RTG label attribute.
Definition RTG.cpp:321
MLIR_CAPI_EXPORTED intptr_t rtgTypeGetNumFields(MlirType type)
Returns the number of fields in the RTG tuple.
Definition RTG.cpp:169
MLIR_CAPI_EXPORTED MlirAttribute rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility)
Creates an RTG label visibility attribute in the context.
Definition RTG.cpp:265
MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrLookup(MlirAttribute attr, MlirAttribute key)
Looks up the value associated with the given key in the RTG map attribute.
Definition RTG.cpp:351
MLIR_CAPI_EXPORTED MlirType rtgMapTypeGet(MlirType keyType, MlirType valueType)
Creates an RTG map type in the context.
Definition RTG.cpp:142
MLIR_CAPI_EXPORTED void registerRTGPipelines(void)
Definition RTG.cpp:28
MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGetElementType(MlirType type)
Returns the element type of the RTG array.
Definition RTG.cpp:133
MLIR_CAPI_EXPORTED bool rtgTypeIsATuple(MlirType type)
If the type is an RTG tuple.
Definition RTG.cpp:165
MLIR_CAPI_EXPORTED bool rtgTypeIsABag(MlirType type)
If the type is an RTG bag.
Definition RTG.cpp:94
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGet(MlirContext ctxt, intptr_t numElements, MlirType const *elementTypes)
Creates an RTG sequence type in the context.
Definition RTG.cpp:41
MLIR_CAPI_EXPORTED MlirType rtgStringTypeGet(MlirContext ctxt)
Creates an RTG string type in the context.
Definition RTG.cpp:210
MLIR_CAPI_EXPORTED unsigned rtgSequenceTypeGetNumElements(MlirType type)
The number of substitution elements of the RTG sequence.
Definition RTG.cpp:49
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirType elementType)
Creates an RTG set type in the context.
Definition RTG.cpp:82
MLIR_CAPI_EXPORTED bool rtgTypeIsASet(MlirType type)
If the type is an RTG set.
Definition RTG.cpp:80
MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGet(MlirContext ctxt, intptr_t numFields, MlirType const *fieldTypes)
Creates an RTG tuple type in the context.
Definition RTG.cpp:157
MLIR_CAPI_EXPORTED MlirType rtgMemoryTypeGet(MlirContext ctx, uint32_t addressWidth)
Creates an RTG memory type in the context.
Definition RTG.cpp:182
MLIR_CAPI_EXPORTED MlirType rtgRandomizedSequenceTypeGet(MlirContext ctxt)
Creates an RTG randomized sequence type in the context.
Definition RTG.cpp:64
MLIR_CAPI_EXPORTED bool rtgTypeIsAMemoryBlock(MlirType type)
If the type is an RTG memory block.
Definition RTG.cpp:193
MLIR_CAPI_EXPORTED bool rtgTypeIsARandomizedSequence(MlirType type)
If the type is an RTG randomized sequence.
Definition RTG.cpp:60
MLIR_CAPI_EXPORTED bool rtgTypeIsAMap(MlirType type)
If the type is an RTG map.
Definition RTG.cpp:140
MLIR_CAPI_EXPORTED bool rtgTypeIsADict(MlirType type)
If the type is an RTG dict.
Definition RTG.cpp:108
MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGetFieldType(MlirType type, intptr_t idx)
Returns a field type of the RTG tuple.
Definition RTG.cpp:173
MLIR_CAPI_EXPORTED MlirStringRef rtgLabelAttrGetName(MlirAttribute attr)
Returns the name of the RTG label attribute.
Definition RTG.cpp:329
MLIR_CAPI_EXPORTED bool rtgAttrIsAVirtualRegisterConfig(MlirAttribute attr)
Checks if the attribute is an RTG virtual register config attribute.
Definition RTG.cpp:294
MLIR_CAPI_EXPORTED MlirType rtgContinuationTypeGet(MlirType resumeType)
Creates an RTG continuation type with the given resume type.
Definition RTG.cpp:221
MLIR_CAPI_EXPORTED bool rtgTypeIsAContinuation(MlirType type)
If the type is an RTG continuation type.
Definition RTG.cpp:217
MLIR_CAPI_EXPORTED MlirType rtgDictTypeGet(MlirContext ctxt, intptr_t numEntries, MlirAttribute const *entryNames, MlirType const *entryTypes)
Creates an RTG dict type in the context.
Definition RTG.cpp:110
MLIR_CAPI_EXPORTED bool rtgAttrIsAMap(MlirAttribute attr)
Checks if the attribute is an RTG map attribute.
Definition RTG.cpp:336
MLIR_CAPI_EXPORTED intptr_t rtgVirtualRegisterConfigAttrGetNumRegisters(MlirAttribute attr)
Returns the number of allowed registers in the RTG virtual register config attribute.
Definition RTG.cpp:307
MLIR_CAPI_EXPORTED MlirType rtgBagTypeGet(MlirType elementType)
Creates an RTG bag type in the context.
Definition RTG.cpp:96
MLIR_CAPI_EXPORTED uint32_t rtgMemoryBlockTypeGetAddressWidth(MlirType type)
Returns the address with of an RTG memory block type.
Definition RTG.cpp:201
MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGet(MlirType elementType)
Creates an RTG array type in the context.
Definition RTG.cpp:126
MLIR_CAPI_EXPORTED MlirType rtgBagTypeGetElementType(MlirType type)
Return the element type of the RTG bag.
Definition RTG.cpp:101
MLIR_CAPI_EXPORTED bool rtgTypeIsAString(MlirType type)
If the type is an RTG string.
Definition RTG.cpp:208
MLIR_CAPI_EXPORTED bool rtgTypeIsASequence(MlirType type)
If the type is an RTG sequence.
Definition RTG.cpp:37
MLIR_CAPI_EXPORTED MlirAttribute rtgLabelAttrGet(MlirContext ctx, MlirStringRef name)
Creates an RTG label attribute in the context with the given name.
Definition RTG.cpp:325
MLIR_CAPI_EXPORTED bool rtgTypeIsALabel(MlirType type)
If the type is an RTG label.
Definition RTG.cpp:71
MLIR_CAPI_EXPORTED MlirType rtgMemoryBlockTypeGet(MlirContext ctx, uint32_t addressWidth)
Creates an RTG memory block type in the context.
Definition RTG.cpp:197
MLIR_CAPI_EXPORTED MlirType rtgMapTypeGetKeyType(MlirType type)
Return the key type of the RTG map.
Definition RTG.cpp:146
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGetElementType(MlirType type)
Return the element type of the RTG set.
Definition RTG.cpp:87
MLIR_CAPI_EXPORTED MlirType rtgContinuationTypeGetResumeType(MlirType type)
Returns the resume type of an RTG continuation type.
Definition RTG.cpp:225
MLIR_CAPI_EXPORTED bool rtgAttrIsADefaultContextAttr(MlirAttribute attr)
If the attribute is an RTG default context.
Definition RTG.cpp:236
MLIR_CAPI_EXPORTED MlirType rtgMapTypeGetValueType(MlirType type)
Return the value type of the RTG map.
Definition RTG.cpp:150
Definition rtg.py:1