CIRCT  19.0.0git
OM.cpp
Go to the documentation of this file.
1 //===- OM.cpp - C interface for the OM 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 
9 #include "circt-c/Dialect/OM.h"
13 #include "mlir/CAPI/Registration.h"
14 #include "mlir/CAPI/Wrap.h"
15 #include "mlir/IR/Location.h"
16 #include "llvm/ADT/Hashing.h"
17 #include "llvm/Support/Casting.h"
18 
19 using namespace mlir;
20 using namespace circt::om;
21 
22 //===----------------------------------------------------------------------===//
23 // Dialect API.
24 //===----------------------------------------------------------------------===//
25 
27 
28 //===----------------------------------------------------------------------===//
29 // Type API.
30 //===----------------------------------------------------------------------===//
31 
32 /// Is the Type a ClassType.
33 bool omTypeIsAClassType(MlirType type) { return isa<ClassType>(unwrap(type)); }
34 
35 /// Get the TypeID for a ClassType.
36 MlirTypeID omClassTypeGetTypeID() { return wrap(ClassType::getTypeID()); }
37 
38 /// Get the name for a ClassType.
39 MlirIdentifier omClassTypeGetName(MlirType type) {
40  return wrap(cast<ClassType>(unwrap(type)).getClassName().getAttr());
41 }
42 
43 /// Is the Type a FrozenBasePathType.
44 bool omTypeIsAFrozenBasePathType(MlirType type) {
45  return isa<FrozenBasePathType>(unwrap(type));
46 }
47 
48 /// Get the TypeID for a FrozenBasePathType.
51 }
52 
53 /// Is the Type a FrozenPathType.
54 bool omTypeIsAFrozenPathType(MlirType type) {
55  return isa<FrozenPathType>(unwrap(type));
56 }
57 
58 /// Get the TypeID for a FrozenPathType.
59 MlirTypeID omFrozenPathTypeGetTypeID(void) {
61 }
62 
63 /// Is the Type a StringType.
64 bool omTypeIsAStringType(MlirType type) {
65  return isa<StringType>(unwrap(type));
66 }
67 
68 /// Get a StringType.
69 MlirType omStringTypeGet(MlirContext ctx) {
70  return wrap(StringType::get(unwrap(ctx)));
71 }
72 
73 /// Return a key type of a map.
74 MlirType omMapTypeGetKeyType(MlirType type) {
75  return wrap(cast<MapType>(unwrap(type)).getKeyType());
76 }
77 
78 //===----------------------------------------------------------------------===//
79 // Evaluator data structures.
80 //===----------------------------------------------------------------------===//
81 
83 
84 /// Define our own wrap and unwrap instead of using the usual macro. This is To
85 /// handle the std::shared_ptr reference counts appropriately. We want to always
86 /// create *new* shared pointers to the EvaluatorValue when we wrap it for C, to
87 /// increment the reference count. We want to use the shared_from_this
88 /// functionality to ensure it is unwrapped into C++ with the correct reference
89 /// count.
90 
91 static inline OMEvaluatorValue wrap(EvaluatorValuePtr object) {
92  return OMEvaluatorValue{
93  static_cast<void *>((new EvaluatorValuePtr(std::move(object)))->get())};
94 }
95 
97  return static_cast<evaluator::EvaluatorValue *>(c.ptr)->shared_from_this();
98 }
99 
100 //===----------------------------------------------------------------------===//
101 // Evaluator API.
102 //===----------------------------------------------------------------------===//
103 
104 /// Construct an Evaluator with an IR module.
105 OMEvaluator omEvaluatorNew(MlirModule mod) {
106  // Just allocate and wrap the Evaluator.
107  return wrap(new Evaluator(unwrap(mod)));
108 }
109 
110 /// Use the Evaluator to Instantiate an Object from its class name and actual
111 /// parameters.
113  MlirAttribute className,
114  intptr_t nActualParams,
115  OMEvaluatorValue *actualParams) {
116  // Unwrap the Evaluator.
117  Evaluator *cppEvaluator = unwrap(evaluator);
118 
119  // Unwrap the className, which the client must supply as a StringAttr.
120  StringAttr cppClassName = cast<StringAttr>(unwrap(className));
121 
122  // Unwrap the actual parameters.
123  SmallVector<std::shared_ptr<evaluator::EvaluatorValue>> cppActualParams;
124  for (unsigned i = 0; i < nActualParams; i++)
125  cppActualParams.push_back(unwrap(actualParams[i]));
126 
127  // Invoke the Evaluator to instantiate the Object.
128  auto result = cppEvaluator->instantiate(cppClassName, cppActualParams);
129 
130  // If instantiation failed, return a null Object. A Diagnostic will be emitted
131  // in this case.
132  if (failed(result))
133  return OMEvaluatorValue();
134 
135  // Wrap and return the Object.
136  return wrap(result.value());
137 }
138 
139 /// Get the Module the Evaluator is built from.
140 MlirModule omEvaluatorGetModule(OMEvaluator evaluator) {
141  // Just unwrap the Evaluator, get the Module, and wrap it.
142  return wrap(unwrap(evaluator)->getModule());
143 }
144 
145 //===----------------------------------------------------------------------===//
146 // Object API.
147 //===----------------------------------------------------------------------===//
148 
149 /// Query if the Object is null.
151  // Just check if the Object shared pointer is null.
152  return !object.ptr;
153 }
154 
155 /// Get the Type from an Object, which will be a ClassType.
157  return wrap(llvm::cast<Object>(unwrap(object).get())->getType());
158 }
159 
160 /// Get the hash for the object.
162  return llvm::hash_value(llvm::cast<Object>(unwrap(object).get()));
163 }
164 
165 /// Check if two objects are same.
167  return llvm::cast<Object>(unwrap(object).get()) ==
168  llvm::cast<Object>(unwrap(other).get());
169 }
170 
171 /// Get an ArrayAttr with the names of the fields in an Object.
173  return wrap(llvm::cast<Object>(unwrap(object).get())->getFieldNames());
174 }
175 
177  return wrap(llvm::cast<evaluator::MapValue>(unwrap(value).get())->getType());
178 }
179 
180 /// Get an ArrayAttr with the keys in a Map.
182  return wrap(llvm::cast<evaluator::MapValue>(unwrap(object).get())->getKeys());
183 }
184 
185 /// Get a field from an Object, which must contain a field of that name.
187  MlirAttribute name) {
188  // Unwrap the Object and get the field of the name, which the client must
189  // supply as a StringAttr.
191  llvm::cast<Object>(unwrap(object).get())
192  ->getField(cast<StringAttr>(unwrap(name)));
193 
194  // If getField failed, return a null EvaluatorValue. A Diagnostic will be
195  // emitted in this case.
196  if (failed(result))
197  return OMEvaluatorValue();
198 
199  return OMEvaluatorValue{wrap(result.value())};
200 }
201 
202 //===----------------------------------------------------------------------===//
203 // EvaluatorValue API.
204 //===----------------------------------------------------------------------===//
205 
206 // Get a context from an EvaluatorValue.
207 MlirContext omEvaluatorValueGetContext(OMEvaluatorValue evaluatorValue) {
208  return wrap(unwrap(evaluatorValue)->getContext());
209 }
210 
211 // Get location from an EvaluatorValue.
212 MlirLocation omEvaluatorValueGetLoc(OMEvaluatorValue evaluatorValue) {
213  return wrap(unwrap(evaluatorValue)->getLoc());
214 }
215 
216 // Query if the EvaluatorValue is null.
218  // Check if the pointer is null.
219  return !evaluatorValue.ptr;
220 }
221 
222 /// Query if the EvaluatorValue is an Object.
224  // Check if the Object is non-null.
225  return isa<evaluator::ObjectValue>(unwrap(evaluatorValue).get());
226 }
227 
228 /// Query if the EvaluatorValue is a Primitive.
230  // Check if the Attribute is non-null.
231  return isa<evaluator::AttributeValue>(unwrap(evaluatorValue).get());
232 }
233 
234 /// Get the Primitive from an EvaluatorValue, which must contain a Primitive.
235 MlirAttribute omEvaluatorValueGetPrimitive(OMEvaluatorValue evaluatorValue) {
236  // Assert the Attribute is non-null, and return it.
237  assert(omEvaluatorValueIsAPrimitive(evaluatorValue));
238  return wrap(
239  llvm::cast<evaluator::AttributeValue>(unwrap(evaluatorValue).get())
240  ->getAttr());
241 }
242 
243 /// Get the Primitive from an EvaluatorValue, which must contain a Primitive.
245  // Assert the Attribute is non-null, and return it.
246  return wrap(std::make_shared<evaluator::AttributeValue>(unwrap(primitive)));
247 }
248 
249 /// Query if the EvaluatorValue is a List.
251  return isa<evaluator::ListValue>(unwrap(evaluatorValue).get());
252 }
253 
254 /// Get the List from an EvaluatorValue, which must contain a List.
255 /// TODO: This can be removed.
257  // Assert the List is non-null, and return it.
258  assert(omEvaluatorValueIsAList(evaluatorValue));
259  return evaluatorValue;
260 }
261 
262 /// Get the length of the List.
264  return cast<evaluator::ListValue>(unwrap(evaluatorValue).get())
265  ->getElements()
266  .size();
267 }
268 
269 /// Get an element of the List.
271  intptr_t pos) {
272  return wrap(cast<evaluator::ListValue>(unwrap(evaluatorValue).get())
273  ->getElements()[pos]);
274 }
275 
276 /// Query if the EvaluatorValue is a Tuple.
278  return isa<evaluator::TupleValue>(unwrap(evaluatorValue).get());
279 }
280 
281 /// Get the length of the Tuple.
283  return cast<evaluator::TupleValue>(unwrap(evaluatorValue).get())
284  ->getElements()
285  .size();
286 }
287 
288 /// Get an element of the Tuple.
290  intptr_t pos) {
291  return wrap(cast<evaluator::TupleValue>(unwrap(evaluatorValue).get())
292  ->getElements()[pos]);
293 }
294 
295 /// Get an element of the Map.
297  MlirAttribute attr) {
298  const auto &elements =
299  cast<evaluator::MapValue>(unwrap(evaluatorValue).get())->getElements();
300  const auto &it = elements.find(unwrap(attr));
301  if (it != elements.end())
302  return wrap(it->second);
303  return OMEvaluatorValue{nullptr};
304 }
305 
306 /// Query if the EvaluatorValue is a map.
308  return isa<evaluator::MapValue>(unwrap(evaluatorValue).get());
309 }
310 
312  return isa<evaluator::BasePathValue>(unwrap(evaluatorValue).get());
313 }
314 
316  return wrap(std::make_shared<evaluator::BasePathValue>(unwrap(context)));
317 }
318 
320  return isa<evaluator::PathValue>(unwrap(evaluatorValue).get());
321 }
322 
323 MlirAttribute omEvaluatorPathGetAsString(OMEvaluatorValue evaluatorValue) {
324  const auto *path = cast<evaluator::PathValue>(unwrap(evaluatorValue).get());
325  return wrap((Attribute)path->getAsString());
326 }
327 
328 /// Query if the EvaluatorValue is a Reference.
330  return isa<evaluator::ReferenceValue>(unwrap(evaluatorValue).get());
331 }
332 
333 /// Dereference a Reference EvaluatorValue. Emits an error and returns null if
334 /// the Reference cannot be dereferenced.
337  // Assert the EvaluatorValue is a Reference.
338  assert(omEvaluatorValueIsAReference(evaluatorValue));
339 
340  // Attempt to get the final EvaluatorValue from the Reference.
341  auto result =
342  llvm::cast<evaluator::ReferenceValue>(unwrap(evaluatorValue).get())
343  ->getStrippedValue();
344 
345  // If this failed, an error diagnostic has been emitted, and we return null.
346  if (failed(result))
347  return {};
348 
349  // If this succeeded, wrap the EvaluatorValue and return it.
350  return wrap(result.value());
351 }
352 
353 //===----------------------------------------------------------------------===//
354 // ReferenceAttr API.
355 //===----------------------------------------------------------------------===//
356 
357 bool omAttrIsAReferenceAttr(MlirAttribute attr) {
358  return isa<ReferenceAttr>(unwrap(attr));
359 }
360 
361 MlirAttribute omReferenceAttrGetInnerRef(MlirAttribute referenceAttr) {
362  return wrap(
363  (Attribute)cast<ReferenceAttr>(unwrap(referenceAttr)).getInnerRef());
364 }
365 
366 //===----------------------------------------------------------------------===//
367 // IntegerAttr API.
368 //===----------------------------------------------------------------------===//
369 
370 bool omAttrIsAIntegerAttr(MlirAttribute attr) {
371  return isa<circt::om::IntegerAttr>(unwrap(attr));
372 }
373 
374 MlirAttribute omIntegerAttrGetInt(MlirAttribute attr) {
375  return wrap(cast<circt::om::IntegerAttr>(unwrap(attr)).getValue());
376 }
377 
378 MlirAttribute omIntegerAttrGet(MlirAttribute attr) {
379  auto integerAttr = cast<mlir::IntegerAttr>(unwrap(attr));
380  return wrap(
381  circt::om::IntegerAttr::get(integerAttr.getContext(), integerAttr));
382 }
383 
384 /// Get a string representation of an om::IntegerAttr.
385 MlirStringRef omIntegerAttrToString(MlirAttribute attr) {
386  mlir::IntegerAttr integerAttr =
387  cast<circt::om::IntegerAttr>(unwrap(attr)).getValue();
388  SmallVector<char> str;
389  integerAttr.getValue().toString(
390  str, /*Radix=*/10, /*Signed=*/integerAttr.getType().isSignedInteger());
391  return wrap(StringAttr::get(integerAttr.getContext(), str).getValue());
392 }
393 
394 //===----------------------------------------------------------------------===//
395 // ListAttr API.
396 //===----------------------------------------------------------------------===//
397 
398 bool omAttrIsAListAttr(MlirAttribute attr) {
399  return isa<ListAttr>(unwrap(attr));
400 }
401 
402 intptr_t omListAttrGetNumElements(MlirAttribute attr) {
403  auto listAttr = llvm::cast<ListAttr>(unwrap(attr));
404  return static_cast<intptr_t>(listAttr.getElements().size());
405 }
406 
407 MlirAttribute omListAttrGetElement(MlirAttribute attr, intptr_t pos) {
408  auto listAttr = llvm::cast<ListAttr>(unwrap(attr));
409  return wrap(listAttr.getElements()[pos]);
410 }
411 
412 //===----------------------------------------------------------------------===//
413 // MapAttr API.
414 //===----------------------------------------------------------------------===//
415 
416 bool omAttrIsAMapAttr(MlirAttribute attr) { return isa<MapAttr>(unwrap(attr)); }
417 
418 intptr_t omMapAttrGetNumElements(MlirAttribute attr) {
419  auto mapAttr = llvm::cast<MapAttr>(unwrap(attr));
420  return static_cast<intptr_t>(mapAttr.getElements().size());
421 }
422 
423 MlirIdentifier omMapAttrGetElementKey(MlirAttribute attr, intptr_t pos) {
424  auto mapAttr = llvm::cast<MapAttr>(unwrap(attr));
425  return wrap(mapAttr.getElements().getValue()[pos].getName());
426 }
427 
428 MlirAttribute omMapAttrGetElementValue(MlirAttribute attr, intptr_t pos) {
429  auto mapAttr = llvm::cast<MapAttr>(unwrap(attr));
430  return wrap(mapAttr.getElements().getValue()[pos].getValue());
431 }
DEFINE_C_API_PTR_METHODS(CirctFirtoolFirtoolOptions, circt::firtool::FirtoolOptions) CirctFirtoolFirtoolOptions circtFirtoolOptionsCreateDefault()
Definition: Firtool.cpp:18
assert(baseType &&"element must be base type")
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
static Attribute getAttr(ArrayRef< NamedAttribute > attrs, StringRef name)
Get an attribute by name from a list of named attributes.
Definition: FIRRTLOps.cpp:3916
bool omTypeIsAFrozenBasePathType(MlirType type)
Is the Type a FrozenBasePathType.
Definition: OM.cpp:44
bool omEvaluatorValueIsABasePath(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a BasePath.
Definition: OM.cpp:311
MlirAttribute omMapAttrGetElementValue(MlirAttribute attr, intptr_t pos)
Definition: OM.cpp:428
bool omEvaluatorValueIsNull(OMEvaluatorValue evaluatorValue)
Definition: OM.cpp:217
MlirContext omEvaluatorValueGetContext(OMEvaluatorValue evaluatorValue)
Definition: OM.cpp:207
MlirAttribute omReferenceAttrGetInnerRef(MlirAttribute referenceAttr)
Definition: OM.cpp:361
bool omTypeIsAStringType(MlirType type)
Is the Type a StringType.
Definition: OM.cpp:64
static OMEvaluatorValue wrap(EvaluatorValuePtr object)
Define our own wrap and unwrap instead of using the usual macro.
Definition: OM.cpp:91
MlirAttribute omEvaluatorPathGetAsString(OMEvaluatorValue evaluatorValue)
Get a string representation of a Path.
Definition: OM.cpp:323
bool omEvaluatorValueIsAPath(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a Path.
Definition: OM.cpp:319
MlirIdentifier omMapAttrGetElementKey(MlirAttribute attr, intptr_t pos)
Definition: OM.cpp:423
bool omAttrIsAListAttr(MlirAttribute attr)
Definition: OM.cpp:398
OMEvaluatorValue omEvaluatorListGetElement(OMEvaluatorValue evaluatorValue, intptr_t pos)
Get an element of the List.
Definition: OM.cpp:270
OMEvaluatorValue omEvaluatorValueFromPrimitive(MlirAttribute primitive)
Get the Primitive from an EvaluatorValue, which must contain a Primitive.
Definition: OM.cpp:244
MlirStringRef omIntegerAttrToString(MlirAttribute attr)
Get a string representation of an om::IntegerAttr.
Definition: OM.cpp:385
OMEvaluatorValue omEvaluatorInstantiate(OMEvaluator evaluator, MlirAttribute className, intptr_t nActualParams, OMEvaluatorValue *actualParams)
Use the Evaluator to Instantiate an Object from its class name and actual parameters.
Definition: OM.cpp:112
MlirType omEvaluatorMapGetType(OMEvaluatorValue value)
Get the Type from a Map, which will be a MapType.
Definition: OM.cpp:176
intptr_t omListAttrGetNumElements(MlirAttribute attr)
Definition: OM.cpp:402
MlirAttribute omEvaluatorObjectGetFieldNames(OMEvaluatorValue object)
Get an ArrayAttr with the names of the fields in an Object.
Definition: OM.cpp:172
bool omAttrIsAIntegerAttr(MlirAttribute attr)
Definition: OM.cpp:370
OMEvaluatorValue omEvaluatorObjectGetField(OMEvaluatorValue object, MlirAttribute name)
Get a field from an Object, which must contain a field of that name.
Definition: OM.cpp:186
MlirLocation omEvaluatorValueGetLoc(OMEvaluatorValue evaluatorValue)
Definition: OM.cpp:212
bool omEvaluatorValueIsAMap(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a map.
Definition: OM.cpp:307
MlirType omMapTypeGetKeyType(MlirType type)
Return a key type of a map.
Definition: OM.cpp:74
MlirTypeID omFrozenBasePathTypeGetTypeID(void)
Get the TypeID for a FrozenBasePathType.
Definition: OM.cpp:49
MlirType omStringTypeGet(MlirContext ctx)
Get a StringType.
Definition: OM.cpp:69
bool omTypeIsAClassType(MlirType type)
Is the Type a ClassType.
Definition: OM.cpp:33
OMEvaluatorValue omEvaluatorTupleGetElement(OMEvaluatorValue evaluatorValue, intptr_t pos)
Get an element of the Tuple.
Definition: OM.cpp:289
MlirIdentifier omClassTypeGetName(MlirType type)
Get the name for a ClassType.
Definition: OM.cpp:39
OMEvaluatorValue omEvaluatorValueGetReferenceValue(OMEvaluatorValue evaluatorValue)
Dereference a Reference EvaluatorValue.
Definition: OM.cpp:336
intptr_t omEvaluatorListGetNumElements(OMEvaluatorValue evaluatorValue)
Get the length of the List.
Definition: OM.cpp:263
MlirAttribute omEvaluatorValueGetPrimitive(OMEvaluatorValue evaluatorValue)
Get the Primitive from an EvaluatorValue, which must contain a Primitive.
Definition: OM.cpp:235
MlirAttribute omEvaluatorMapGetKeys(OMEvaluatorValue object)
Get an ArrayAttr with the keys in a Map.
Definition: OM.cpp:181
MlirAttribute omIntegerAttrGetInt(MlirAttribute attr)
Given an om::IntegerAttr, return the mlir::IntegerAttr.
Definition: OM.cpp:374
bool omEvaluatorValueIsAList(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a List.
Definition: OM.cpp:250
bool omTypeIsAFrozenPathType(MlirType type)
Is the Type a FrozenPathType.
Definition: OM.cpp:54
bool omAttrIsAMapAttr(MlirAttribute attr)
Definition: OM.cpp:416
OMEvaluatorValue omEvaluatorMapGetElement(OMEvaluatorValue evaluatorValue, MlirAttribute attr)
Get an element of the Map.
Definition: OM.cpp:296
bool omEvaluatorValueIsAPrimitive(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a Primitive.
Definition: OM.cpp:229
bool omEvaluatorValueIsATuple(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a Tuple.
Definition: OM.cpp:277
bool omEvaluatorObjectIsNull(OMEvaluatorValue object)
Query if the Object is null.
Definition: OM.cpp:150
MlirModule omEvaluatorGetModule(OMEvaluator evaluator)
Get the Module the Evaluator is built from.
Definition: OM.cpp:140
OMEvaluator omEvaluatorNew(MlirModule mod)
Construct an Evaluator with an IR module.
Definition: OM.cpp:105
OMEvaluatorValue omEvaluatorBasePathGetEmpty(MlirContext context)
Create an empty BasePath.
Definition: OM.cpp:315
MlirAttribute omListAttrGetElement(MlirAttribute attr, intptr_t pos)
Definition: OM.cpp:407
MlirTypeID omFrozenPathTypeGetTypeID(void)
Get the TypeID for a FrozenPathType.
Definition: OM.cpp:59
intptr_t omMapAttrGetNumElements(MlirAttribute attr)
Definition: OM.cpp:418
MlirType omEvaluatorObjectGetType(OMEvaluatorValue object)
Get the Type from an Object, which will be a ClassType.
Definition: OM.cpp:156
intptr_t omEvaluatorTupleGetNumElements(OMEvaluatorValue evaluatorValue)
Get the length of the Tuple.
Definition: OM.cpp:282
bool omAttrIsAReferenceAttr(MlirAttribute attr)
Definition: OM.cpp:357
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition: OM.cpp:96
MlirAttribute omIntegerAttrGet(MlirAttribute attr)
Get an om::IntegerAttr from mlir::IntegerAttr.
Definition: OM.cpp:378
OMEvaluatorValue omEvaluatorValueGetList(OMEvaluatorValue evaluatorValue)
Get the List from an EvaluatorValue, which must contain a List.
Definition: OM.cpp:256
bool omEvaluatorValueIsAObject(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is an Object.
Definition: OM.cpp:223
MlirTypeID omClassTypeGetTypeID()
Get the TypeID for a ClassType.
Definition: OM.cpp:36
bool omEvaluatorValueIsAReference(OMEvaluatorValue evaluatorValue)
Query if the EvaluatorValue is a Reference.
Definition: OM.cpp:329
unsigned omEvaluatorObjectGetHash(OMEvaluatorValue object)
Get the hash for the object.
Definition: OM.cpp:161
bool omEvaluatorObjectIsEq(OMEvaluatorValue object, OMEvaluatorValue other)
Check if two objects are same.
Definition: OM.cpp:166
struct OMEvaluatorValue OMEvaluatorValue
Definition: OM.h:82
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:54
StringAttr getTypeID(Type t)
Definition: ESIPasses.cpp:26
llvm::hash_code hash_value(const BundledChannel channel)
Definition: ESITypes.h:48
std::shared_ptr< EvaluatorValue > EvaluatorValuePtr
A value of an object in memory.
Definition: Evaluator.h:38
evaluator::EvaluatorValuePtr EvaluatorValuePtr
Definition: Evaluator.h:412
Definition: om.py:1
A value type for use in C APIs that just wraps a pointer to an Object.
Definition: OM.h:75
void * ptr
Definition: OM.h:76
A value type for use in C APIs that just wraps a pointer to an Evaluator.
Definition: OM.h:64
An Evaluator, which is constructed with an IR module and can instantiate Objects.
Definition: Evaluator.h:420
FailureOr< evaluator::EvaluatorValuePtr > instantiate(StringAttr className, ArrayRef< EvaluatorValuePtr > actualParams)
Instantiate an Object with its class name and actual parameters.
Definition: Evaluator.cpp:288
Base class for evaluator runtime values.
Definition: Evaluator.h:48