CIRCT 24.0.0git
Loading...
Searching...
No Matches
HW.cpp
Go to the documentation of this file.
1//===- HW.cpp - C interface for the HW dialect ----------------------------===//
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
15#include "circt/Support/LLVM.h"
16#include "mlir/CAPI/IR.h"
17#include "mlir/CAPI/Registration.h"
18#include "mlir/CAPI/Support.h"
19#include "llvm/ADT/PostOrderIterator.h"
20
21using namespace circt;
22using namespace circt::hw;
23
26
27//===----------------------------------------------------------------------===//
28// Dialect API.
29//===----------------------------------------------------------------------===//
30
33
34//===----------------------------------------------------------------------===//
35// Type API.
36//===----------------------------------------------------------------------===//
37
38int64_t hwGetBitWidth(MlirType type) { return getBitWidth(unwrap(type)); }
39
40MlirType hwGetCanonicalType(MlirType type) {
41 return wrap(getCanonicalType(unwrap(type)));
42}
43
44bool hwTypeIsAValueType(MlirType type) { return isHWValueType(unwrap(type)); }
45
46bool hwTypeIsAArrayType(MlirType type) { return isa<ArrayType>(unwrap(type)); }
47
48MlirType hwArrayTypeGet(MlirType element, size_t size) {
49 return wrap(ArrayType::get(unwrap(element), size));
50}
51
52MlirType hwArrayTypeGetElementType(MlirType type) {
53 return wrap(cast<ArrayType>(unwrap(type)).getElementType());
54}
55
56intptr_t hwArrayTypeGetSize(MlirType type) {
57 return cast<ArrayType>(unwrap(type)).getNumElements();
58}
59
60bool hwTypeIsAIntType(MlirType type) { return isa<IntType>(unwrap(type)); }
61
62MlirType hwParamIntTypeGet(MlirAttribute parameter) {
63 return wrap(IntType::get(cast<TypedAttr>(unwrap(parameter))));
64}
65
66MlirAttribute hwParamIntTypeGetWidthAttr(MlirType type) {
67 return wrap(cast<IntType>(unwrap(type)).getWidth());
68}
69
70MlirType hwInOutTypeGet(MlirType element) {
71 return wrap(InOutType::get(unwrap(element)));
72}
73
74MlirType hwInOutTypeGetElementType(MlirType type) {
75 return wrap(cast<InOutType>(unwrap(type)).getElementType());
76}
77
78bool hwTypeIsAInOut(MlirType type) { return isa<InOutType>(unwrap(type)); }
79
80bool hwTypeIsAModuleType(MlirType type) {
81 return isa<ModuleType>(unwrap(type));
82}
83
84MlirType hwModuleTypeGet(MlirContext ctx, intptr_t numPorts,
85 HWModulePort const *ports) {
86 SmallVector<ModulePort> modulePorts;
87 for (intptr_t i = 0; i < numPorts; ++i) {
88 HWModulePort port = ports[i];
89
91 switch (port.dir) {
92 case HWModulePortDirection::Input:
93 dir = ModulePort::Direction::Input;
94 break;
95 case HWModulePortDirection::Output:
96 dir = ModulePort::Direction::Output;
97 break;
98 case HWModulePortDirection::InOut:
99 dir = ModulePort::Direction::InOut;
100 break;
101 }
102
103 StringAttr name = cast<StringAttr>(unwrap(port.name));
104 Type type = unwrap(port.type);
105
106 modulePorts.push_back(ModulePort{name, type, dir});
107 }
108
109 return wrap(ModuleType::get(unwrap(ctx), modulePorts));
110}
111
112intptr_t hwModuleTypeGetNumInputs(MlirType type) {
113 return cast<ModuleType>(unwrap(type)).getNumInputs();
114}
115
116MlirType hwModuleTypeGetInputType(MlirType type, intptr_t index) {
117 return wrap(cast<ModuleType>(unwrap(type)).getInputType(index));
118}
119
120MlirStringRef hwModuleTypeGetInputName(MlirType type, intptr_t index) {
121 return wrap(cast<ModuleType>(unwrap(type)).getInputName(index));
122}
123
124intptr_t hwModuleTypeGetNumOutputs(MlirType type) {
125 return cast<ModuleType>(unwrap(type)).getNumOutputs();
126}
127
128MlirType hwModuleTypeGetOutputType(MlirType type, intptr_t index) {
129 return wrap(cast<ModuleType>(unwrap(type)).getOutputType(index));
130}
131
132MlirStringRef hwModuleTypeGetOutputName(MlirType type, intptr_t index) {
133 return wrap(cast<ModuleType>(unwrap(type)).getOutputName(index));
134}
135
136void hwModuleTypeGetPort(MlirType type, intptr_t index, HWModulePort *ret) {
137 auto port = cast<ModuleType>(unwrap(type)).getPorts()[index];
138
140 switch (port.dir) {
141 case ModulePort::Direction::Input:
142 dir = HWModulePortDirection::Input;
143 break;
144 case ModulePort::Direction::Output:
145 dir = HWModulePortDirection::Output;
146 break;
147 case ModulePort::Direction::InOut:
148 dir = HWModulePortDirection::InOut;
149 break;
150 }
151
152 ret->name = wrap(static_cast<Attribute>(port.name));
153 ret->type = wrap(port.type);
154 ret->dir = dir;
155}
156
157bool hwTypeIsAStructType(MlirType type) {
158 return isa<StructType>(unwrap(type));
159}
160
161MlirType hwStructTypeGet(MlirContext ctx, intptr_t numElements,
162 HWStructFieldInfo const *elements) {
163 SmallVector<StructType::FieldInfo> fieldInfos;
164 fieldInfos.reserve(numElements);
165 for (intptr_t i = 0; i < numElements; ++i) {
166 fieldInfos.push_back(StructType::FieldInfo{
167 cast<StringAttr>(unwrap(elements[i].name)), unwrap(elements[i].type)});
168 }
169 return wrap(StructType::get(unwrap(ctx), fieldInfos));
170}
171
172MlirType hwStructTypeGetField(MlirType structType, MlirStringRef fieldName) {
173 StructType st = cast<StructType>(unwrap(structType));
174 return wrap(st.getFieldType(unwrap(fieldName)));
175}
176
177MlirAttribute hwStructTypeGetFieldIndex(MlirType structType,
178 MlirStringRef fieldName) {
179 StructType st = cast<StructType>(unwrap(structType));
180 if (auto idx = st.getFieldIndex(unwrap(fieldName)))
181 return wrap(IntegerAttr::get(IntegerType::get(st.getContext(), 32), *idx));
182 return wrap(UnitAttr::get(st.getContext()));
183}
184
185intptr_t hwStructTypeGetNumFields(MlirType structType) {
186 StructType st = cast<StructType>(unwrap(structType));
187 return st.getElements().size();
188}
189
190HWStructFieldInfo hwStructTypeGetFieldNum(MlirType structType, unsigned idx) {
191 StructType st = cast<StructType>(unwrap(structType));
192 auto cppField = st.getElements()[idx];
194 ret.name = wrap(cppField.name);
195 ret.type = wrap(cppField.type);
196 return ret;
197}
198
199bool hwTypeIsAUnionType(MlirType type) { return isa<UnionType>(unwrap(type)); }
200
201MlirType hwUnionTypeGet(MlirContext ctx, intptr_t numElements,
202 HWUnionFieldInfo const *elements) {
203 SmallVector<UnionType::FieldInfo> fieldInfos;
204 fieldInfos.reserve(numElements);
205 for (intptr_t i = 0; i < numElements; ++i) {
206 fieldInfos.push_back(
207 UnionType::FieldInfo{cast<StringAttr>(unwrap(elements[i].name)),
208 unwrap(elements[i].type), elements[i].offset});
209 }
210 return wrap(UnionType::get(unwrap(ctx), fieldInfos));
211}
212
213MlirType hwUnionTypeGetField(MlirType unionType, MlirStringRef fieldName) {
214 UnionType ut = cast<UnionType>(unwrap(unionType));
215 return wrap(ut.getFieldType(unwrap(fieldName)));
216}
217
218MlirAttribute hwUnionTypeGetFieldIndex(MlirType unionType,
219 MlirStringRef fieldName) {
220 UnionType ut = cast<UnionType>(unwrap(unionType));
221 if (auto idx = ut.getFieldIndex(unwrap(fieldName)))
222 return wrap(IntegerAttr::get(IntegerType::get(ut.getContext(), 32), *idx));
223 return wrap(UnitAttr::get(ut.getContext()));
224}
225
226intptr_t hwUnionTypeGetNumFields(MlirType unionType) {
227 UnionType ut = cast<UnionType>(unwrap(unionType));
228 return ut.getElements().size();
229}
230
231HWUnionFieldInfo hwUnionTypeGetFieldNum(MlirType unionType, unsigned idx) {
232 UnionType ut = cast<UnionType>(unwrap(unionType));
233 auto cppField = ut.getElements()[idx];
235 ret.name = wrap(cppField.name);
236 ret.type = wrap(cppField.type);
237 ret.offset = cppField.offset;
238 return ret;
239}
240
241bool hwTypeIsATypeAliasType(MlirType type) {
242 return isa<TypeAliasType>(unwrap(type));
243}
244
245MlirType hwTypeAliasTypeGet(MlirStringRef cScope, MlirStringRef cName,
246 MlirType cInnerType) {
247 StringRef scope = unwrap(cScope);
248 StringRef name = unwrap(cName);
249 Type innerType = unwrap(cInnerType);
250 FlatSymbolRefAttr nameRef =
251 FlatSymbolRefAttr::get(innerType.getContext(), name);
252 SymbolRefAttr ref =
253 SymbolRefAttr::get(innerType.getContext(), scope, {nameRef});
254 return wrap(TypeAliasType::get(ref, innerType));
255}
256
257MlirType hwTypeAliasTypeGetCanonicalType(MlirType typeAlias) {
258 TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
259 return wrap(type.getCanonicalType());
260}
261
262MlirType hwTypeAliasTypeGetInnerType(MlirType typeAlias) {
263 TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
264 return wrap(type.getInnerType());
265}
266
267MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias) {
268 TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
269 return wrap(type.getRef().getLeafReference().getValue());
270}
271
272MlirStringRef hwTypeAliasTypeGetScope(MlirType typeAlias) {
273 TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
274 return wrap(type.getRef().getRootReference().getValue());
275}
276
277//===----------------------------------------------------------------------===//
278// Attribute API.
279//===----------------------------------------------------------------------===//
280
281bool hwAttrIsAInnerSymAttr(MlirAttribute attr) {
282 return isa<InnerSymAttr>(unwrap(attr));
283}
284
285MlirAttribute hwInnerSymAttrGet(MlirAttribute symName) {
286 return wrap(InnerSymAttr::get(cast<StringAttr>(unwrap(symName))));
287}
288
289MlirAttribute hwInnerSymAttrGetEmpty(MlirContext ctx) {
290 return wrap(InnerSymAttr::get(unwrap(ctx)));
291}
292
293MlirAttribute hwInnerSymAttrGetSymName(MlirAttribute innerSymAttr) {
294 return wrap((Attribute)cast<InnerSymAttr>(unwrap(innerSymAttr)).getSymName());
295}
296
297bool hwAttrIsAInnerRefAttr(MlirAttribute attr) {
298 return isa<InnerRefAttr>(unwrap(attr));
299}
300
301MlirAttribute hwInnerRefAttrGet(MlirAttribute moduleName,
302 MlirAttribute innerSym) {
303 auto moduleNameAttr = cast<StringAttr>(unwrap(moduleName));
304 auto innerSymAttr = cast<StringAttr>(unwrap(innerSym));
305 return wrap(InnerRefAttr::get(moduleNameAttr, innerSymAttr));
306}
307
308MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr) {
309 return wrap((Attribute)cast<InnerRefAttr>(unwrap(innerRefAttr)).getName());
310}
311
312MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr) {
313 return wrap((Attribute)cast<InnerRefAttr>(unwrap(innerRefAttr)).getModule());
314}
315
316MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr) {
317 return isa<ParamDeclAttr>(unwrap(attr));
318}
319MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet(MlirStringRef cName,
320 MlirType cType,
321 MlirAttribute cValue) {
322 auto type = unwrap(cType);
323 auto name = StringAttr::get(type.getContext(), unwrap(cName));
324 return wrap(
325 ParamDeclAttr::get(type.getContext(), name, type, unwrap(cValue)));
326}
327MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName(MlirAttribute decl) {
328 return wrap(cast<ParamDeclAttr>(unwrap(decl)).getName().getValue());
329}
330MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl) {
331 return wrap(cast<ParamDeclAttr>(unwrap(decl)).getType());
332}
333MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue(MlirAttribute decl) {
334 return wrap(cast<ParamDeclAttr>(unwrap(decl)).getValue());
335}
336
337MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr(MlirAttribute attr) {
338 return isa<ParamDeclRefAttr>(unwrap(attr));
339}
340
341MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx,
342 MlirStringRef cName) {
343 auto name = StringAttr::get(unwrap(ctx), unwrap(cName));
344 return wrap(ParamDeclRefAttr::get(unwrap(ctx), name,
345 IntegerType::get(unwrap(ctx), 32)));
346}
347
348MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName(MlirAttribute decl) {
349 return wrap(cast<ParamDeclRefAttr>(unwrap(decl)).getName().getValue());
350}
351MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl) {
352 return wrap(cast<ParamDeclRefAttr>(unwrap(decl)).getType());
353}
354
355MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr(MlirAttribute attr) {
356 return isa<ParamVerbatimAttr>(unwrap(attr));
357}
358MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text) {
359 auto textAttr = cast<StringAttr>(unwrap(text));
360 MLIRContext *ctx = textAttr.getContext();
361 auto type = NoneType::get(ctx);
362 return wrap(ParamVerbatimAttr::get(ctx, textAttr, type));
363}
364
365MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr(MlirAttribute attr) {
366 return isa<OutputFileAttr>(unwrap(attr));
367}
368MLIR_CAPI_EXPORTED MlirAttribute
369hwOutputFileGetFromFileName(MlirAttribute fileName, bool excludeFromFileList,
370 bool includeReplicatedOp) {
371 auto fileNameStrAttr = cast<StringAttr>(unwrap(fileName));
372 return wrap(OutputFileAttr::getFromFilename(
373 fileNameStrAttr.getContext(), fileNameStrAttr.getValue(),
374 excludeFromFileList, includeReplicatedOp));
375}
376
377MlirStringRef hwOutputFileGetFileName(MlirAttribute outputFile) {
378 auto outputFileAttr = cast<OutputFileAttr>(unwrap(outputFile));
379 return wrap(outputFileAttr.getFilename().getValue());
380}
381
382MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation) {
383 return wrap(new InstanceGraph{unwrap(operation)});
384}
385
386MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy(HWInstanceGraph instanceGraph) {
387 delete unwrap(instanceGraph);
388}
389
390MLIR_CAPI_EXPORTED HWInstanceGraphNode
391hwInstanceGraphGetTopLevelNode(HWInstanceGraph instanceGraph) {
392 return wrap(unwrap(instanceGraph)->getTopLevelNode());
393}
394
395MLIR_CAPI_EXPORTED void
396hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph,
398 void *userData) {
399 InstanceGraph *graph = unwrap(instanceGraph);
400 for (const auto &inst : llvm::post_order(graph)) {
401 callback(wrap(inst), userData);
402 }
403}
404
405MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs,
406 HWInstanceGraphNode rhs) {
407 return unwrap(lhs) == unwrap(rhs);
408}
409
410MLIR_CAPI_EXPORTED MlirModule
411hwInstanceGraphNodeGetModule(HWInstanceGraphNode node) {
412 return wrap(dyn_cast<ModuleOp>(unwrap(node)->getModule().getOperation()));
413}
414
415MLIR_CAPI_EXPORTED MlirOperation
416hwInstanceGraphNodeGetModuleOp(HWInstanceGraphNode node) {
417 return wrap(unwrap(node)->getModule());
418}
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MlirType uint64_t numElements
Definition CHIRRTL.cpp:30
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
static void registerPasses()
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet(MlirStringRef cName, MlirType cType, MlirAttribute cValue)
Definition HW.cpp:319
MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr)
Definition HW.cpp:312
MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl)
Definition HW.cpp:330
MlirType hwUnionTypeGet(MlirContext ctx, intptr_t numElements, HWUnionFieldInfo const *elements)
Creates an HW union type in the context associated with the elements.
Definition HW.cpp:201
MlirType hwInOutTypeGet(MlirType element)
Creates an HW inout type in the context associated with element.
Definition HW.cpp:70
MlirType hwArrayTypeGet(MlirType element, size_t size)
Creates a fixed-size HW array type in the context associated with element.
Definition HW.cpp:48
intptr_t hwArrayTypeGetSize(MlirType type)
returns the size of an array type
Definition HW.cpp:56
MlirType hwStructTypeGet(MlirContext ctx, intptr_t numElements, HWStructFieldInfo const *elements)
Creates an HW struct type in the context associated with the elements.
Definition HW.cpp:161
MlirType hwArrayTypeGetElementType(MlirType type)
returns the element type of an array type
Definition HW.cpp:52
MLIR_CAPI_EXPORTED HWInstanceGraphNode hwInstanceGraphGetTopLevelNode(HWInstanceGraph instanceGraph)
Definition HW.cpp:391
intptr_t hwModuleTypeGetNumInputs(MlirType type)
Get an HW module type's number of inputs.
Definition HW.cpp:112
MLIR_CAPI_EXPORTED MlirOperation hwInstanceGraphNodeGetModuleOp(HWInstanceGraphNode node)
Definition HW.cpp:416
intptr_t hwStructTypeGetNumFields(MlirType structType)
Definition HW.cpp:185
bool hwTypeIsAArrayType(MlirType type)
If the type is an HW array.
Definition HW.cpp:46
bool hwTypeIsATypeAliasType(MlirType type)
If the type is an HW type alias.
Definition HW.cpp:241
MlirType hwTypeAliasTypeGetInnerType(MlirType typeAlias)
Definition HW.cpp:262
MlirStringRef hwOutputFileGetFileName(MlirAttribute outputFile)
Definition HW.cpp:377
MlirType hwTypeAliasTypeGetCanonicalType(MlirType typeAlias)
Definition HW.cpp:257
MlirType hwStructTypeGetField(MlirType structType, MlirStringRef fieldName)
Definition HW.cpp:172
MlirAttribute hwInnerRefAttrGet(MlirAttribute moduleName, MlirAttribute innerSym)
Definition HW.cpp:301
MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs, HWInstanceGraphNode rhs)
Definition HW.cpp:405
MLIR_CAPI_EXPORTED MlirModule hwInstanceGraphNodeGetModule(HWInstanceGraphNode node)
Definition HW.cpp:411
MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation)
Definition HW.cpp:382
MlirType hwGetCanonicalType(MlirType type)
Recursively remove HW type aliases from a type and its subelements.
Definition HW.cpp:40
bool hwTypeIsAIntType(MlirType type)
If the type is an HW int.
Definition HW.cpp:60
void hwModuleTypeGetPort(MlirType type, intptr_t index, HWModulePort *ret)
Get an HW module type's port info at a specific index.
Definition HW.cpp:136
MlirType hwModuleTypeGetInputType(MlirType type, intptr_t index)
Get an HW module type's input type at a specific index.
Definition HW.cpp:116
bool hwTypeIsAInOut(MlirType type)
If the type is an HW inout.
Definition HW.cpp:78
MlirStringRef hwModuleTypeGetInputName(MlirType type, intptr_t index)
Get an HW module type's input name at a specific index.
Definition HW.cpp:120
MlirType hwModuleTypeGet(MlirContext ctx, intptr_t numPorts, HWModulePort const *ports)
Creates an HW module type.
Definition HW.cpp:84
MlirAttribute hwStructTypeGetFieldIndex(MlirType structType, MlirStringRef fieldName)
Definition HW.cpp:177
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue(MlirAttribute decl)
Definition HW.cpp:333
MlirAttribute hwInnerSymAttrGetSymName(MlirAttribute innerSymAttr)
Definition HW.cpp:293
MlirAttribute hwInnerSymAttrGet(MlirAttribute symName)
Definition HW.cpp:285
intptr_t hwUnionTypeGetNumFields(MlirType unionType)
Definition HW.cpp:226
MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy(HWInstanceGraph instanceGraph)
Definition HW.cpp:386
MLIR_CAPI_EXPORTED void hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph, HWInstanceGraphNodeCallback callback, void *userData)
Definition HW.cpp:396
MlirStringRef hwTypeAliasTypeGetScope(MlirType typeAlias)
Definition HW.cpp:272
MlirType hwInOutTypeGetElementType(MlirType type)
Returns the element type of an inout type.
Definition HW.cpp:74
MlirType hwTypeAliasTypeGet(MlirStringRef cScope, MlirStringRef cName, MlirType cInnerType)
Definition HW.cpp:245
bool hwTypeIsAValueType(MlirType type)
Return true if the specified type can be used as an HW value type, that is the set of types that can ...
Definition HW.cpp:44
bool hwAttrIsAInnerSymAttr(MlirAttribute attr)
Definition HW.cpp:281
MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr(MlirAttribute attr)
Definition HW.cpp:355
bool hwTypeIsAStructType(MlirType type)
If the type is an HW struct.
Definition HW.cpp:157
MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr(MlirAttribute attr)
Definition HW.cpp:365
MlirType hwParamIntTypeGet(MlirAttribute parameter)
Definition HW.cpp:62
MlirStringRef hwModuleTypeGetOutputName(MlirType type, intptr_t index)
Get an HW module type's output name at a specific index.
Definition HW.cpp:132
MLIR_CAPI_EXPORTED MlirAttribute hwOutputFileGetFromFileName(MlirAttribute fileName, bool excludeFromFileList, bool includeReplicatedOp)
Definition HW.cpp:369
MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr)
Definition HW.cpp:308
MlirType hwUnionTypeGetField(MlirType unionType, MlirStringRef fieldName)
Definition HW.cpp:213
MlirAttribute hwInnerSymAttrGetEmpty(MlirContext ctx)
Definition HW.cpp:289
HWStructFieldInfo hwStructTypeGetFieldNum(MlirType structType, unsigned idx)
Definition HW.cpp:190
bool hwTypeIsAModuleType(MlirType type)
If the type is an HW module type.
Definition HW.cpp:80
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr(MlirAttribute attr)
Definition HW.cpp:337
HWUnionFieldInfo hwUnionTypeGetFieldNum(MlirType unionType, unsigned idx)
Definition HW.cpp:231
int64_t hwGetBitWidth(MlirType type)
Return the hardware bit width of a type.
Definition HW.cpp:38
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName(MlirAttribute decl)
Definition HW.cpp:348
MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias)
Definition HW.cpp:267
void registerHWPasses()
Definition HW.cpp:32
MlirAttribute hwUnionTypeGetFieldIndex(MlirType unionType, MlirStringRef fieldName)
Definition HW.cpp:218
bool hwAttrIsAInnerRefAttr(MlirAttribute attr)
Definition HW.cpp:297
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx, MlirStringRef cName)
Definition HW.cpp:341
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr)
Definition HW.cpp:316
bool hwTypeIsAUnionType(MlirType type)
If the type is an HW union.
Definition HW.cpp:199
MlirType hwModuleTypeGetOutputType(MlirType type, intptr_t index)
Get an HW module type's output type at a specific index.
Definition HW.cpp:128
MlirAttribute hwParamIntTypeGetWidthAttr(MlirType type)
Definition HW.cpp:66
intptr_t hwModuleTypeGetNumOutputs(MlirType type)
Get an HW module type's number of outputs.
Definition HW.cpp:124
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName(MlirAttribute decl)
Definition HW.cpp:327
MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text)
Definition HW.cpp:358
MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl)
Definition HW.cpp:351
HWModulePortDirection
Definition HW.h:42
void(* HWInstanceGraphNodeCallback)(HWInstanceGraphNode, void *)
Definition HW.h:243
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition OM.cpp:111
DEFINE_C_API_PTR_METHODS(SynthLongestPathHistory, llvm::ImmutableListImpl< DebugPoint >) llvm
Definition Synth.cpp:49
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
This is a Node in the InstanceGraph.
bool isHWValueType(mlir::Type type)
Return true if the specified type can be used as an HW value type, that is the set of types that can ...
int64_t getBitWidth(mlir::Type type)
Return the hardware bit width of a type.
Definition HWTypes.cpp:121
mlir::Type getCanonicalType(mlir::Type type)
Recursively remove HW type aliases from a type and its subelements.
Definition HWTypes.cpp:50
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition hw.py:1
HWModulePortDirection dir
Definition HW.h:48
MlirAttribute name
Definition HW.h:46
MlirType type
Definition HW.h:47
MlirIdentifier name
Definition HW.h:30
MlirType type
Definition HW.h:31
size_t offset
Definition HW.h:38
MlirType type
Definition HW.h:37
MlirIdentifier name
Definition HW.h:36