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//===----------------------------------------------------------------------===//
146// Attribute API.
147//===----------------------------------------------------------------------===//
148
155
156/// If the attribute is an RTG label visibility.
157MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr);
158
159/// Get the RTG label visibility from the attribute.
160MLIR_CAPI_EXPORTED RTGLabelVisibility
161rtgLabelVisibilityAttrGetValue(MlirAttribute attr);
162
163/// Creates an RTG label visibility attribute in the context.
164MLIR_CAPI_EXPORTED MlirAttribute
165rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility);
166
167/// If the attribute is an RTG default context.
168MLIR_CAPI_EXPORTED bool rtgAttrIsADefaultContextAttr(MlirAttribute attr);
169
170/// Creates an RTG default context attribute in the context.
171MLIR_CAPI_EXPORTED MlirAttribute rtgDefaultContextAttrGet(MlirContext ctxt,
172 MlirType type);
173
174/// If the attribute is an RTG any context attribute.
175MLIR_CAPI_EXPORTED bool rtgAttrIsAAnyContextAttr(MlirAttribute attr);
176
177/// Creates an RTG any context attribute in the context.
178MLIR_CAPI_EXPORTED MlirAttribute rtgAnyContextAttrGet(MlirContext ctxt,
179 MlirType type);
180
181/// Checks if the attribute is an RTG virtual register config attribute.
182MLIR_CAPI_EXPORTED bool rtgAttrIsAVirtualRegisterConfig(MlirAttribute attr);
183
184/// Creates an RTG virtual register config attribute in the context.
185MLIR_CAPI_EXPORTED MlirAttribute rtgVirtualRegisterConfigAttrGet(
186 MlirContext ctxt, intptr_t numRegs, MlirAttribute const *allowedRegs);
187
188/// Returns the number of allowed registers in the RTG virtual register config
189/// attribute.
190MLIR_CAPI_EXPORTED intptr_t
192
193/// Returns the allowed register at the given index in the RTG virtual register
194/// config attribute.
195MLIR_CAPI_EXPORTED MlirAttribute
196rtgVirtualRegisterConfigAttrGetRegister(MlirAttribute attr, intptr_t index);
197
198/// Checks if the attribute is an RTG label attribute.
199MLIR_CAPI_EXPORTED bool rtgAttrIsALabel(MlirAttribute attr);
200
201/// Creates an RTG label attribute in the context with the given name.
202MLIR_CAPI_EXPORTED MlirAttribute rtgLabelAttrGet(MlirContext ctx,
203 MlirStringRef name);
204
205/// Returns the name of the RTG label attribute.
206MLIR_CAPI_EXPORTED MlirStringRef rtgLabelAttrGetName(MlirAttribute attr);
207
208/// Checks if the attribute is an RTG map attribute.
209MLIR_CAPI_EXPORTED bool rtgAttrIsAMap(MlirAttribute attr);
210
211/// Creates an RTG map attribute in the context with the given entries.
212MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrGet(MlirContext ctx,
213 MlirType mapType,
214 intptr_t numEntries,
215 MlirAttribute const *keys,
216 MlirAttribute const *values);
217
218/// Looks up the value associated with the given key in the RTG map attribute.
219/// Returns a null attribute if the key is not found.
220MLIR_CAPI_EXPORTED MlirAttribute rtgMapAttrLookup(MlirAttribute attr,
221 MlirAttribute key);
222
223#ifdef __cplusplus
224}
225#endif
226
227#include "circt/Dialect/RTG/Transforms/RTGPasses.capi.h.inc"
228
229#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:272
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:268
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:236
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:284
RTGLabelVisibility
Definition RTG.h:149
@ RTG_LABEL_VISIBILITY_EXTERNAL
Definition RTG.h:152
@ RTG_LABEL_VISIBILITY_GLOBAL
Definition RTG.h:151
@ RTG_LABEL_VISIBILITY_LOCAL
Definition RTG.h:150
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:296
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:225
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:325
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:232
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:306
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:250
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:336
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:314
MLIR_CAPI_EXPORTED bool rtgAttrIsAVirtualRegisterConfig(MlirAttribute attr)
Checks if the attribute is an RTG virtual register config attribute.
Definition RTG.cpp:279
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:321
MLIR_CAPI_EXPORTED intptr_t rtgVirtualRegisterConfigAttrGetNumRegisters(MlirAttribute attr)
Returns the number of allowed registers in the RTG virtual register config attribute.
Definition RTG.cpp:292
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:310
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 bool rtgAttrIsADefaultContextAttr(MlirAttribute attr)
If the attribute is an RTG default context.
Definition RTG.cpp:221
MLIR_CAPI_EXPORTED MlirType rtgMapTypeGetValueType(MlirType type)
Return the value type of the RTG map.
Definition RTG.cpp:150
Definition rtg.py:1