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