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