Loading [MathJax]/extensions/tex2jax.js
CIRCT 22.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 registerRTGPasses(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/// If the type is an RTG immediate.
84MLIR_CAPI_EXPORTED bool rtgTypeIsAImmediate(MlirType type);
85
86/// Creates an RTG immediate type in the context.
87MLIR_CAPI_EXPORTED MlirType rtgImmediateTypeGet(MlirContext ctx,
88 uint32_t width);
89
90/// Returns the width of the RTG immediate type.
91MLIR_CAPI_EXPORTED uint32_t rtgImmediateTypeGetWidth(MlirType type);
92
93/// Creates an RTG array type in the context.
94MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGet(MlirType elementType);
95
96/// If the type is an RTG array.
97MLIR_CAPI_EXPORTED bool rtgTypeIsAArray(MlirType type);
98
99/// Returns the element type of the RTG array.
100MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGetElementType(MlirType type);
101
102/// Creates an RTG tuple type in the context.
103MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGet(MlirContext ctxt,
104 intptr_t numFields,
105 MlirType const *fieldTypes);
106
107/// If the type is an RTG tuple.
108MLIR_CAPI_EXPORTED bool rtgTypeIsATuple(MlirType type);
109
110/// Returns the number of fields in the RTG tuple.
111MLIR_CAPI_EXPORTED intptr_t rtgTypeGetNumFields(MlirType type);
112
113/// Returns a field type of the RTG tuple.
114MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGetFieldType(MlirType type,
115 intptr_t idx);
116
117/// If the type is an RTG memory.
118MLIR_CAPI_EXPORTED bool rtgTypeIsAMemory(MlirType type);
119
120/// Creates an RTG memory type in the context.
121MLIR_CAPI_EXPORTED MlirType rtgMemoryTypeGet(MlirContext ctx,
122 uint32_t addressWidth);
123
124/// Returns the address with of an RTG memory type.
125MLIR_CAPI_EXPORTED uint32_t rtgMemoryTypeGetAddressWidth(MlirType type);
126
127/// If the type is an RTG memory block.
128MLIR_CAPI_EXPORTED bool rtgTypeIsAMemoryBlock(MlirType type);
129
130/// Creates an RTG memory block type in the context.
131MLIR_CAPI_EXPORTED MlirType rtgMemoryBlockTypeGet(MlirContext ctx,
132 uint32_t addressWidth);
133
134/// Returns the address with of an RTG memory block type.
135MLIR_CAPI_EXPORTED uint32_t rtgMemoryBlockTypeGetAddressWidth(MlirType type);
136
137//===----------------------------------------------------------------------===//
138// Attribute API.
139//===----------------------------------------------------------------------===//
140
147
148/// If the attribute is an RTG label visibility.
149MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr);
150
151/// Get the RTG label visibility from the attribute.
152MLIR_CAPI_EXPORTED RTGLabelVisibility
153rtgLabelVisibilityAttrGetValue(MlirAttribute attr);
154
155/// Creates an RTG label visibility attribute in the context.
156MLIR_CAPI_EXPORTED MlirAttribute
157rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility);
158
159/// If the attribute is an RTG default context.
160MLIR_CAPI_EXPORTED bool rtgAttrIsADefaultContextAttr(MlirAttribute attr);
161
162/// Creates an RTG default context attribute in the context.
163MLIR_CAPI_EXPORTED MlirAttribute rtgDefaultContextAttrGet(MlirContext ctxt,
164 MlirType type);
165
166/// Checks if the attribute is an RTG immediate attribute.
167MLIR_CAPI_EXPORTED bool rtgAttrIsAImmediate(MlirAttribute attr);
168
169/// Creates an RTG immediate attribute in the context with the given width and
170/// value.
171MLIR_CAPI_EXPORTED MlirAttribute rtgImmediateAttrGet(MlirContext ctx,
172 uint32_t width,
173 uint64_t value);
174
175/// Returns the width of the RTG immediate attribute.
176MLIR_CAPI_EXPORTED uint32_t rtgImmediateAttrGetWidth(MlirAttribute attr);
177
178/// Returns the value of the RTG immediate attribute.
179MLIR_CAPI_EXPORTED uint64_t rtgImmediateAttrGetValue(MlirAttribute attr);
180
181/// If the attribute is an RTG any context attribute.
182MLIR_CAPI_EXPORTED bool rtgAttrIsAAnyContextAttr(MlirAttribute attr);
183
184/// Creates an RTG any context attribute in the context.
185MLIR_CAPI_EXPORTED MlirAttribute rtgAnyContextAttrGet(MlirContext ctxt,
186 MlirType type);
187
188#ifdef __cplusplus
189}
190#endif
191
192#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:283
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:279
MLIR_CAPI_EXPORTED MlirType rtgLabelTypeGet(MlirContext ctxt)
Creates an RTG mode type in the context.
Definition RTG.cpp:75
MLIR_CAPI_EXPORTED RTGLabelVisibility rtgLabelVisibilityAttrGetValue(MlirAttribute attr)
Get the RTG label visibility from the attribute.
Definition RTG.cpp:227
MLIR_CAPI_EXPORTED uint32_t rtgImmediateAttrGetWidth(MlirAttribute attr)
Returns the width of the RTG immediate attribute.
Definition RTG.cpp:268
RTGLabelVisibility
Definition RTG.h:141
@ RTG_LABEL_VISIBILITY_EXTERNAL
Definition RTG.h:144
@ RTG_LABEL_VISIBILITY_GLOBAL
Definition RTG.h:143
@ RTG_LABEL_VISIBILITY_LOCAL
Definition RTG.h:142
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGetElement(MlirType type, unsigned i)
The type of of the substitution element at the given index.
Definition RTG.cpp:55
MLIR_CAPI_EXPORTED MlirAttribute rtgDefaultContextAttrGet(MlirContext ctxt, MlirType type)
Creates an RTG default context attribute in the context.
Definition RTG.cpp:216
MLIR_CAPI_EXPORTED MlirType rtgImmediateTypeGet(MlirContext ctx, uint32_t width)
Creates an RTG immediate type in the context.
Definition RTG.cpp:169
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:133
MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr)
If the attribute is an RTG label visibility.
Definition RTG.cpp:223
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(RTG, rtg)
MLIR_CAPI_EXPORTED intptr_t rtgTypeGetNumFields(MlirType type)
Returns the number of fields in the RTG tuple.
Definition RTG.cpp:154
MLIR_CAPI_EXPORTED MlirAttribute rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility)
Creates an RTG label visibility attribute in the context.
Definition RTG.cpp:241
MLIR_CAPI_EXPORTED void registerRTGPasses(void)
Definition RTG.cpp:27
MLIR_CAPI_EXPORTED MlirType rtgArrayTypeGetElementType(MlirType type)
Returns the element type of the RTG array.
Definition RTG.cpp:135
MLIR_CAPI_EXPORTED bool rtgTypeIsATuple(MlirType type)
If the type is an RTG tuple.
Definition RTG.cpp:150
MLIR_CAPI_EXPORTED bool rtgTypeIsABag(MlirType type)
If the type is an RTG bag.
Definition RTG.cpp:96
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGet(MlirContext ctxt, intptr_t numElements, MlirType const *elementTypes)
Creates an RTG sequence type in the context.
Definition RTG.cpp:43
MLIR_CAPI_EXPORTED MlirAttribute rtgImmediateAttrGet(MlirContext ctx, uint32_t width, uint64_t value)
Creates an RTG immediate attribute in the context with the given width and value.
Definition RTG.cpp:263
MLIR_CAPI_EXPORTED unsigned rtgSequenceTypeGetNumElements(MlirType type)
The number of substitution elements of the RTG sequence.
Definition RTG.cpp:51
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirType elementType)
Creates an RTG set type in the context.
Definition RTG.cpp:84
MLIR_CAPI_EXPORTED bool rtgTypeIsASet(MlirType type)
If the type is an RTG set.
Definition RTG.cpp:82
MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGet(MlirContext ctxt, intptr_t numFields, MlirType const *fieldTypes)
Creates an RTG tuple type in the context.
Definition RTG.cpp:142
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:66
MLIR_CAPI_EXPORTED uint64_t rtgImmediateAttrGetValue(MlirAttribute attr)
Returns the value of the RTG immediate attribute.
Definition RTG.cpp:272
MLIR_CAPI_EXPORTED bool rtgTypeIsAMemoryBlock(MlirType type)
If the type is an RTG memory block.
Definition RTG.cpp:193
MLIR_CAPI_EXPORTED bool rtgAttrIsAImmediate(MlirAttribute attr)
Checks if the attribute is an RTG immediate attribute.
Definition RTG.cpp:259
MLIR_CAPI_EXPORTED bool rtgTypeIsARandomizedSequence(MlirType type)
If the type is an RTG randomized sequence.
Definition RTG.cpp:62
MLIR_CAPI_EXPORTED bool rtgTypeIsADict(MlirType type)
If the type is an RTG dict.
Definition RTG.cpp:110
MLIR_CAPI_EXPORTED MlirType rtgTupleTypeGetFieldType(MlirType type, intptr_t idx)
Returns a field type of the RTG tuple.
Definition RTG.cpp:158
MLIR_CAPI_EXPORTED bool rtgTypeIsAImmediate(MlirType type)
If the type is an RTG immediate.
Definition RTG.cpp:165
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:112
MLIR_CAPI_EXPORTED MlirType rtgBagTypeGet(MlirType elementType)
Creates an RTG bag type in the context.
Definition RTG.cpp:98
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:128
MLIR_CAPI_EXPORTED MlirType rtgBagTypeGetElementType(MlirType type)
Return the element type of the RTG bag.
Definition RTG.cpp:103
MLIR_CAPI_EXPORTED bool rtgTypeIsASequence(MlirType type)
If the type is an RTG sequence.
Definition RTG.cpp:39
MLIR_CAPI_EXPORTED bool rtgTypeIsALabel(MlirType type)
If the type is an RTG label.
Definition RTG.cpp:73
MLIR_CAPI_EXPORTED uint32_t rtgImmediateTypeGetWidth(MlirType type)
Returns the width of the RTG immediate type.
Definition RTG.cpp:173
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 rtgSetTypeGetElementType(MlirType type)
Return the element type of the RTG set.
Definition RTG.cpp:89
MLIR_CAPI_EXPORTED bool rtgAttrIsADefaultContextAttr(MlirAttribute attr)
If the attribute is an RTG default context.
Definition RTG.cpp:212
Definition rtg.py:1