CIRCT 22.0.0git
Loading...
Searching...
No Matches
Evaluator.h
Go to the documentation of this file.
1//===- Evaluator.h - Object Model dialect evaluator -----------------------===//
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// This file contains the Object Model dialect declaration.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_DIALECT_OM_EVALUATOR_EVALUATOR_H
14#define CIRCT_DIALECT_OM_EVALUATOR_EVALUATOR_H
15
17#include "circt/Support/LLVM.h"
18#include "mlir/IR/BuiltinOps.h"
19#include "mlir/IR/Diagnostics.h"
20#include "mlir/IR/Location.h"
21#include "mlir/IR/MLIRContext.h"
22#include "mlir/IR/SymbolTable.h"
23#include "mlir/Support/LogicalResult.h"
24#include "llvm/ADT/SmallPtrSet.h"
25#include "llvm/ADT/SmallString.h"
26
27#include <queue>
28#include <utility>
29
30namespace circt {
31namespace om {
32
33namespace evaluator {
34class EvaluatorValue;
35
36/// A value of an object in memory. It is either a composite Object, or a
37/// primitive Attribute. Further refinement is expected.
38using EvaluatorValuePtr = std::shared_ptr<EvaluatorValue>;
39
40/// The fields of a composite Object, currently represented as a map. Further
41/// refinement is expected.
43
44/// Base class for evaluator runtime values.
45/// Enables the shared_from_this functionality so Evaluator Value pointers can
46/// be passed through the CAPI and unwrapped back into C++ smart pointers with
47/// the appropriate reference count.
48class EvaluatorValue : public std::enable_shared_from_this<EvaluatorValue> {
49public:
50 // Implement LLVM RTTI.
52 EvaluatorValue(MLIRContext *ctx, Kind kind, Location loc)
53 : kind(kind), ctx(ctx), loc(loc) {}
54 Kind getKind() const { return kind; }
55 MLIRContext *getContext() const { return ctx; }
56
57 // Return true the value is fully evaluated.
58 bool isFullyEvaluated() const { return fullyEvaluated; }
60 assert(!fullyEvaluated && "should not mark twice");
61 fullyEvaluated = true;
62 }
63
64 /// Return the associated MLIR context.
65 MLIRContext *getContext() { return ctx; }
66
67 // Return a MLIR type which the value represents.
68 Type getType() const;
69
70 // Finalize the evaluator value. Strip intermidiate reference values.
71 LogicalResult finalize();
72
73 // Return the Location associated with the Value.
74 Location getLoc() const { return loc; }
75 // Set the Location associated with the Value.
76 void setLoc(Location l) { loc = l; }
77 // Set the Location, if it is unknown.
78 void setLocIfUnknown(Location l) {
79 if (isa<UnknownLoc>(loc))
80 loc = l;
81 }
82
83private:
84 const Kind kind;
85 MLIRContext *ctx;
86 Location loc;
87 bool fullyEvaluated = false;
88 bool finalized = false;
89};
90
91/// Values which can be used as pointers to different values.
92/// ReferenceValue is replaced with its element and erased at the end of
93/// evaluation.
95public:
96 ReferenceValue(Type type, Location loc)
98 type(type) {}
99
100 // Implement LLVM RTTI.
101 static bool classof(const EvaluatorValue *e) {
102 return e->getKind() == Kind::Reference;
103 }
104
105 Type getValueType() const { return type; }
106 EvaluatorValuePtr getValue() const { return value; }
108 value = std::move(newValue);
110 }
111
112 // Finalize the value.
113 LogicalResult finalizeImpl();
114
115 // Return the first non-reference value that is reachable from the reference.
116 FailureOr<EvaluatorValuePtr> getStrippedValue() const {
117 llvm::SmallPtrSet<ReferenceValue *, 4> visited;
118 auto currentValue = value;
119 while (auto *v = dyn_cast<ReferenceValue>(currentValue.get())) {
120 // Detect a cycle.
121 if (!visited.insert(v).second)
122 return failure();
123 currentValue = v->getValue();
124 }
125 return success(currentValue);
126 }
127
128private:
130 Type type;
131};
132
133/// Values which can be directly representable by MLIR attributes.
135public:
136 Attribute getAttr() const { return attr; }
137 template <typename AttrTy>
138 AttrTy getAs() const {
139 return dyn_cast<AttrTy>(attr);
140 }
141 static bool classof(const EvaluatorValue *e) {
142 return e->getKind() == Kind::Attr;
143 }
144
145 // Set Attribute for partially evaluated case.
146 LogicalResult setAttr(Attribute attr);
147
148 // Finalize the value.
149 LogicalResult finalizeImpl();
150
151 Type getType() const { return type; }
152
153 // Factory methods that create AttributeValue objects
154 static std::shared_ptr<EvaluatorValue> get(Attribute attr,
155 LocationAttr loc = {});
156 static std::shared_ptr<EvaluatorValue> get(Type type, LocationAttr loc = {});
157
158private:
159 // Make AttributeValue constructible only by the factory methods
160 struct PrivateTag {};
161
162 // Constructor that requires a PrivateTag
163 AttributeValue(PrivateTag, Attribute attr, Location loc)
165 type(cast<TypedAttr>(attr).getType()) {
167 }
168
169 // Constructor for partially evaluated AttributeValue
172
173 Attribute attr = {};
174 Type type;
175
176 // Friend declaration for the factory methods
177 friend std::shared_ptr<EvaluatorValue> get(Attribute attr, LocationAttr loc);
178 friend std::shared_ptr<EvaluatorValue> get(Type type, LocationAttr loc);
179};
180
181// This perform finalization to `value`.
182static inline LogicalResult finalizeEvaluatorValue(EvaluatorValuePtr &value) {
183 if (failed(value->finalize()))
184 return failure();
185 if (auto *ref = llvm::dyn_cast<ReferenceValue>(value.get())) {
186 auto v = ref->getStrippedValue();
187 if (failed(v))
188 return v;
189 value = v.value();
190 }
191 return success();
192}
193
194/// A List which contains variadic length of elements with the same type.
195class ListValue : public EvaluatorValue {
196public:
197 ListValue(om::ListType type, SmallVector<EvaluatorValuePtr> elements,
198 Location loc)
200 elements(std::move(elements)) {
202 }
203
204 void setElements(SmallVector<EvaluatorValuePtr> newElements) {
205 elements = std::move(newElements);
207 }
208
209 // Finalize the value.
210 LogicalResult finalizeImpl();
211
212 // Partially evaluated value.
213 ListValue(om::ListType type, Location loc)
215
216 const auto &getElements() const { return elements; }
217
218 /// Return the type of the value, which is a ListType.
219 om::ListType getListType() const { return type; }
220
221 /// Implement LLVM RTTI.
222 static bool classof(const EvaluatorValue *e) {
223 return e->getKind() == Kind::List;
224 }
225
226private:
227 om::ListType type;
228 SmallVector<EvaluatorValuePtr> elements;
229};
230
231/// A composite Object, which has a type and fields.
233public:
234 ObjectValue(om::ClassOp cls, ObjectFields fields, Location loc)
236 fields(std::move(fields)) {
238 }
239
240 // Partially evaluated value.
241 ObjectValue(om::ClassOp cls, Location loc)
243
244 om::ClassOp getClassOp() const { return cls; }
245 const auto &getFields() const { return fields; }
246
248 fields = std::move(newFields);
250 }
251
252 /// Return the type of the value, which is a ClassType.
253 om::ClassType getObjectType() const {
254 auto clsConst = const_cast<ClassOp &>(cls);
255 return ClassType::get(clsConst.getContext(),
256 FlatSymbolRefAttr::get(clsConst.getNameAttr()));
257 }
258
259 Type getType() const { return getObjectType(); }
260
261 /// Implement LLVM RTTI.
262 static bool classof(const EvaluatorValue *e) {
263 return e->getKind() == Kind::Object;
264 }
265
266 /// Get a field of the Object by name.
267 FailureOr<EvaluatorValuePtr> getField(StringAttr field);
268 FailureOr<EvaluatorValuePtr> getField(StringRef field) {
269 return getField(StringAttr::get(getContext(), field));
270 }
271
272 /// Get all the field names of the Object.
273 ArrayAttr getFieldNames();
274
275 // Finalize the evaluator value.
276 LogicalResult finalizeImpl();
277
278private:
279 om::ClassOp cls;
281};
282
283/// A Basepath value.
285public:
286 BasePathValue(MLIRContext *context);
287
288 /// Create a path value representing a basepath.
289 BasePathValue(om::PathAttr path, Location loc);
290
291 om::PathAttr getPath() const;
292
293 /// Set the basepath which this path is relative to.
294 void setBasepath(const BasePathValue &basepath);
295
296 /// Finalize the evaluator value.
297 LogicalResult finalizeImpl() { return success(); }
298
299 /// Implement LLVM RTTI.
300 static bool classof(const EvaluatorValue *e) {
301 return e->getKind() == Kind::BasePath;
302 }
303
304private:
305 om::PathAttr path;
306};
307
308/// A Path value.
309class PathValue : public EvaluatorValue {
310public:
311 /// Create a path value representing a regular path.
312 PathValue(om::TargetKindAttr targetKind, om::PathAttr path, StringAttr module,
313 StringAttr ref, StringAttr field, Location loc);
314
315 static PathValue getEmptyPath(Location loc);
316
317 om::TargetKindAttr getTargetKind() const { return targetKind; }
318
319 om::PathAttr getPath() const { return path; }
320
321 StringAttr getModule() const { return module; }
322
323 StringAttr getRef() const { return ref; }
324
325 StringAttr getField() const { return field; }
326
327 StringAttr getAsString() const;
328
329 void setBasepath(const BasePathValue &basepath);
330
331 // Finalize the evaluator value.
332 LogicalResult finalizeImpl() { return success(); }
333
334 /// Implement LLVM RTTI.
335 static bool classof(const EvaluatorValue *e) {
336 return e->getKind() == Kind::Path;
337 }
338
339private:
340 om::TargetKindAttr targetKind;
341 om::PathAttr path;
342 StringAttr module;
343 StringAttr ref;
344 StringAttr field;
345};
346
347/// An unknown value. This is used by users of the evaluator to mark object
348/// parameters that they do not care to evaluate or about values which it fans
349/// out to. Pratically, a user is expected to set the parameters they care
350/// about to non-unknown values and the ones they don't to unknown. The results
351/// that are computable given this configuration will then be non-unknown.
353 /// Create a value representing unknown information. This value is _always_
354 /// fully evaluated and finalized. There is no further processing required.
355 UnknownValue(MLIRContext *ctx, Location loc)
358 (void)finalize();
359 };
360
361 static bool classof(const EvaluatorValue *e) {
362 return e->getKind() == Kind::Unknown;
363 }
364
365 LogicalResult finalizeImpl() { return success(); }
366};
367
368} // namespace evaluator
369
372
373SmallVector<EvaluatorValuePtr>
375 ArrayRef<Attribute> attributes);
376
377/// An Evaluator, which is constructed with an IR module and can instantiate
378/// Objects. Further refinement is expected.
380public:
381 /// Construct an Evaluator with an IR module.
382 Evaluator(ModuleOp mod);
383
384 /// Instantiate an Object with its class name and actual parameters.
385 FailureOr<evaluator::EvaluatorValuePtr>
386 instantiate(StringAttr className, ArrayRef<EvaluatorValuePtr> actualParams);
387
388 /// Get the Module this Evaluator is built from.
389 mlir::ModuleOp getModule();
390
391 FailureOr<evaluator::EvaluatorValuePtr>
392 getPartiallyEvaluatedValue(Type type, Location loc);
393
395 SmallVectorImpl<std::shared_ptr<evaluator::EvaluatorValue>> *;
396
397 using ObjectKey = std::pair<Value, ActualParameters>;
398
399private:
400 bool isFullyEvaluated(Value value, ActualParameters key) {
401 return isFullyEvaluated({value, key});
402 }
403
405 auto val = objects.lookup(key);
406 return val && val->isFullyEvaluated();
407 }
408
409 FailureOr<EvaluatorValuePtr>
410 getOrCreateValue(Value value, ActualParameters actualParams, Location loc);
411 FailureOr<EvaluatorValuePtr>
412 allocateObjectInstance(StringAttr clasName, ActualParameters actualParams);
413
414 /// Evaluate a Value in a Class body according to the small expression grammar
415 /// described in the rationale document. The actual parameters are the values
416 /// supplied at the current instantiation of the Class being evaluated.
417 FailureOr<EvaluatorValuePtr>
418 evaluateValue(Value value, ActualParameters actualParams, Location loc);
419
420 /// Evaluator dispatch functions for the small expression grammar.
421 FailureOr<EvaluatorValuePtr> evaluateParameter(BlockArgument formalParam,
422 ActualParameters actualParams,
423 Location loc);
424
425 FailureOr<EvaluatorValuePtr>
426 evaluateConstant(ConstantOp op, ActualParameters actualParams, Location loc);
427
428 FailureOr<EvaluatorValuePtr>
429 evaluateIntegerBinaryArithmetic(IntegerBinaryArithmeticOp op,
430 ActualParameters actualParams, Location loc);
431
432 /// Instantiate an Object with its class name and actual parameters.
433 FailureOr<EvaluatorValuePtr>
434 evaluateObjectInstance(StringAttr className, ActualParameters actualParams,
435 Location loc, ObjectKey instanceKey = {});
436 FailureOr<EvaluatorValuePtr>
437 evaluateObjectInstance(ObjectOp op, ActualParameters actualParams);
438 FailureOr<EvaluatorValuePtr>
439 evaluateObjectField(ObjectFieldOp op, ActualParameters actualParams,
440 Location loc);
441 FailureOr<EvaluatorValuePtr> evaluateListCreate(ListCreateOp op,
442 ActualParameters actualParams,
443 Location loc);
444 FailureOr<EvaluatorValuePtr> evaluateListConcat(ListConcatOp op,
445 ActualParameters actualParams,
446 Location loc);
447 FailureOr<evaluator::EvaluatorValuePtr>
448 evaluateBasePathCreate(FrozenBasePathCreateOp op,
449 ActualParameters actualParams, Location loc);
450 FailureOr<evaluator::EvaluatorValuePtr>
451 evaluatePathCreate(FrozenPathCreateOp op, ActualParameters actualParams,
452 Location loc);
453 FailureOr<evaluator::EvaluatorValuePtr>
454 evaluateEmptyPath(FrozenEmptyPathOp op, ActualParameters actualParams,
455 Location loc);
456 FailureOr<evaluator::EvaluatorValuePtr>
457 evaluateUnknownValue(UnknownValueOp op, Location loc);
458
459 FailureOr<ActualParameters>
460 createParametersFromOperands(ValueRange range, ActualParameters actualParams,
461 Location loc);
462
463 /// The symbol table for the IR module the Evaluator was constructed with.
464 /// Used to look up class definitions.
465 SymbolTable symbolTable;
466
467 /// This uniquely stores vectors that represent parameters.
468 SmallVector<
469 std::unique_ptr<SmallVector<std::shared_ptr<evaluator::EvaluatorValue>>>>
471
472 /// A worklist that tracks values which needs to be fully evaluated.
473 std::queue<ObjectKey> worklist;
474
475 /// Evaluator value storage. Return an evaluator value for the given
476 /// instantiation context (a pair of Value and parameters).
477 DenseMap<ObjectKey, std::shared_ptr<evaluator::EvaluatorValue>> objects;
478};
479
480/// Helper to enable printing objects in Diagnostics.
481static inline mlir::Diagnostic &
482operator<<(mlir::Diagnostic &diag,
483 const evaluator::EvaluatorValue &evaluatorValue) {
484 if (auto *attr = llvm::dyn_cast<evaluator::AttributeValue>(&evaluatorValue))
485 diag << attr->getAttr();
486 else if (auto *object =
487 llvm::dyn_cast<evaluator::ObjectValue>(&evaluatorValue))
488 diag << "Object(" << object->getType() << ")";
489 else if (auto *list = llvm::dyn_cast<evaluator::ListValue>(&evaluatorValue))
490 diag << "List(" << list->getType() << ")";
491 else if (llvm::isa<evaluator::BasePathValue>(&evaluatorValue))
492 diag << "BasePath()";
493 else if (llvm::isa<evaluator::PathValue>(&evaluatorValue))
494 diag << "Path()";
495 else if (llvm::isa<evaluator::UnknownValue>(&evaluatorValue))
496 diag << "Unknown()";
497 else
498 assert(false && "unhandled evaluator value");
499 return diag;
500}
501
502/// Helper to enable printing objects in Diagnostics.
503static inline mlir::Diagnostic &
504operator<<(mlir::Diagnostic &diag, const EvaluatorValuePtr &evaluatorValue) {
505 return diag << *evaluatorValue.get();
506}
507
508} // namespace om
509} // namespace circt
510
511#endif // CIRCT_DIALECT_OM_EVALUATOR_EVALUATOR_H
assert(baseType &&"element must be base type")
static std::unique_ptr< Context > context
An Evaluator, which is constructed with an IR module and can instantiate Objects.
Definition Evaluator.h:379
FailureOr< evaluator::EvaluatorValuePtr > evaluateBasePathCreate(FrozenBasePathCreateOp op, ActualParameters actualParams, Location loc)
FailureOr< evaluator::EvaluatorValuePtr > evaluateEmptyPath(FrozenEmptyPathOp op, ActualParameters actualParams, Location loc)
SymbolTable symbolTable
The symbol table for the IR module the Evaluator was constructed with.
Definition Evaluator.h:465
FailureOr< evaluator::EvaluatorValuePtr > getPartiallyEvaluatedValue(Type type, Location loc)
Definition Evaluator.cpp:71
FailureOr< EvaluatorValuePtr > evaluateValue(Value value, ActualParameters actualParams, Location loc)
Evaluate a Value in a Class body according to the small expression grammar described in the rationale...
FailureOr< EvaluatorValuePtr > evaluateConstant(ConstantOp op, ActualParameters actualParams, Location loc)
Evaluator dispatch function for constants.
FailureOr< EvaluatorValuePtr > evaluateIntegerBinaryArithmetic(IntegerBinaryArithmeticOp op, ActualParameters actualParams, Location loc)
mlir::ModuleOp getModule()
Get the Module this Evaluator is built from.
Definition Evaluator.cpp:30
FailureOr< EvaluatorValuePtr > evaluateObjectField(ObjectFieldOp op, ActualParameters actualParams, Location loc)
Evaluator dispatch function for Object fields.
SmallVector< std::unique_ptr< SmallVector< std::shared_ptr< evaluator::EvaluatorValue > > > > actualParametersBuffers
This uniquely stores vectors that represent parameters.
Definition Evaluator.h:470
bool isFullyEvaluated(Value value, ActualParameters key)
Definition Evaluator.h:400
FailureOr< EvaluatorValuePtr > allocateObjectInstance(StringAttr clasName, ActualParameters actualParams)
std::queue< ObjectKey > worklist
A worklist that tracks values which needs to be fully evaluated.
Definition Evaluator.h:473
FailureOr< evaluator::EvaluatorValuePtr > evaluateUnknownValue(UnknownValueOp op, Location loc)
FailureOr< evaluator::EvaluatorValuePtr > instantiate(StringAttr className, ArrayRef< EvaluatorValuePtr > actualParams)
Instantiate an Object with its class name and actual parameters.
FailureOr< EvaluatorValuePtr > getOrCreateValue(Value value, ActualParameters actualParams, Location loc)
Definition Evaluator.cpp:96
SmallVectorImpl< std::shared_ptr< evaluator::EvaluatorValue > > * ActualParameters
Definition Evaluator.h:395
DenseMap< ObjectKey, std::shared_ptr< evaluator::EvaluatorValue > > objects
Evaluator value storage.
Definition Evaluator.h:477
FailureOr< EvaluatorValuePtr > evaluateListCreate(ListCreateOp op, ActualParameters actualParams, Location loc)
Evaluator dispatch function for List creation.
FailureOr< EvaluatorValuePtr > evaluateListConcat(ListConcatOp op, ActualParameters actualParams, Location loc)
Evaluator dispatch function for List concatenation.
std::pair< Value, ActualParameters > ObjectKey
Definition Evaluator.h:397
FailureOr< EvaluatorValuePtr > evaluateParameter(BlockArgument formalParam, ActualParameters actualParams, Location loc)
Evaluator dispatch functions for the small expression grammar.
FailureOr< EvaluatorValuePtr > evaluateObjectInstance(StringAttr className, ActualParameters actualParams, Location loc, ObjectKey instanceKey={})
Instantiate an Object with its class name and actual parameters.
FailureOr< evaluator::EvaluatorValuePtr > evaluatePathCreate(FrozenPathCreateOp op, ActualParameters actualParams, Location loc)
FailureOr< ActualParameters > createParametersFromOperands(ValueRange range, ActualParameters actualParams, Location loc)
Evaluator dispatch function for Object instances.
bool isFullyEvaluated(ObjectKey key)
Definition Evaluator.h:404
Values which can be directly representable by MLIR attributes.
Definition Evaluator.h:134
LogicalResult setAttr(Attribute attr)
friend std::shared_ptr< EvaluatorValue > get(Attribute attr, LocationAttr loc)
static bool classof(const EvaluatorValue *e)
Definition Evaluator.h:141
AttributeValue(PrivateTag, Attribute attr, Location loc)
Definition Evaluator.h:163
friend std::shared_ptr< EvaluatorValue > get(Type type, LocationAttr loc)
AttributeValue(PrivateTag, Type type, Location loc)
Definition Evaluator.h:170
static bool classof(const EvaluatorValue *e)
Implement LLVM RTTI.
Definition Evaluator.h:300
LogicalResult finalizeImpl()
Finalize the evaluator value.
Definition Evaluator.h:297
void setBasepath(const BasePathValue &basepath)
Set the basepath which this path is relative to.
BasePathValue(om::PathAttr path, Location loc)
Create a path value representing a basepath.
Base class for evaluator runtime values.
Definition Evaluator.h:48
EvaluatorValue(MLIRContext *ctx, Kind kind, Location loc)
Definition Evaluator.h:52
MLIRContext * getContext()
Return the associated MLIR context.
Definition Evaluator.h:65
MLIRContext * getContext() const
Definition Evaluator.h:55
A List which contains variadic length of elements with the same type.
Definition Evaluator.h:195
static bool classof(const EvaluatorValue *e)
Implement LLVM RTTI.
Definition Evaluator.h:222
const auto & getElements() const
Definition Evaluator.h:216
ListValue(om::ListType type, Location loc)
Definition Evaluator.h:213
void setElements(SmallVector< EvaluatorValuePtr > newElements)
Definition Evaluator.h:204
SmallVector< EvaluatorValuePtr > elements
Definition Evaluator.h:228
ListValue(om::ListType type, SmallVector< EvaluatorValuePtr > elements, Location loc)
Definition Evaluator.h:197
om::ListType getListType() const
Return the type of the value, which is a ListType.
Definition Evaluator.h:219
A composite Object, which has a type and fields.
Definition Evaluator.h:232
om::ClassType getObjectType() const
Return the type of the value, which is a ClassType.
Definition Evaluator.h:253
FailureOr< EvaluatorValuePtr > getField(StringAttr field)
Get a field of the Object by name.
const auto & getFields() const
Definition Evaluator.h:245
ObjectValue(om::ClassOp cls, ObjectFields fields, Location loc)
Definition Evaluator.h:234
FailureOr< EvaluatorValuePtr > getField(StringRef field)
Definition Evaluator.h:268
ObjectValue(om::ClassOp cls, Location loc)
Definition Evaluator.h:241
ArrayAttr getFieldNames()
Get all the field names of the Object.
static bool classof(const EvaluatorValue *e)
Implement LLVM RTTI.
Definition Evaluator.h:262
void setFields(llvm::SmallDenseMap< StringAttr, EvaluatorValuePtr > newFields)
Definition Evaluator.h:247
om::ClassOp getClassOp() const
Definition Evaluator.h:244
llvm::SmallDenseMap< StringAttr, EvaluatorValuePtr > fields
Definition Evaluator.h:280
StringAttr getModule() const
Definition Evaluator.h:321
StringAttr StringAttr ref
Definition Evaluator.h:343
StringAttr getAsString() const
om::TargetKindAttr getTargetKind() const
Definition Evaluator.h:317
StringAttr getField() const
Definition Evaluator.h:325
om::TargetKindAttr targetKind
Definition Evaluator.h:340
void setBasepath(const BasePathValue &basepath)
om::PathAttr getPath() const
Definition Evaluator.h:319
static bool classof(const EvaluatorValue *e)
Implement LLVM RTTI.
Definition Evaluator.h:335
static PathValue getEmptyPath(Location loc)
StringAttr getRef() const
Definition Evaluator.h:323
Values which can be used as pointers to different values.
Definition Evaluator.h:94
EvaluatorValuePtr getValue() const
Definition Evaluator.h:106
static bool classof(const EvaluatorValue *e)
Definition Evaluator.h:101
ReferenceValue(Type type, Location loc)
Definition Evaluator.h:96
FailureOr< EvaluatorValuePtr > getStrippedValue() const
Definition Evaluator.h:116
void setValue(EvaluatorValuePtr newValue)
Definition Evaluator.h:107
static LogicalResult finalizeEvaluatorValue(EvaluatorValuePtr &value)
Definition Evaluator.h:182
std::shared_ptr< EvaluatorValue > EvaluatorValuePtr
A value of an object in memory.
Definition Evaluator.h:38
evaluator::EvaluatorValuePtr EvaluatorValuePtr
Definition Evaluator.h:371
static mlir::Diagnostic & operator<<(mlir::Diagnostic &diag, const evaluator::EvaluatorValue &evaluatorValue)
Helper to enable printing objects in Diagnostics.
Definition Evaluator.h:482
SmallVector< EvaluatorValuePtr > getEvaluatorValuesFromAttributes(MLIRContext *context, ArrayRef< Attribute > attributes)
Definition Evaluator.cpp:35
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition om.py:1
static bool classof(const EvaluatorValue *e)
Definition Evaluator.h:361
UnknownValue(MLIRContext *ctx, Location loc)
Create a value representing unknown information.
Definition Evaluator.h:355