Skip to content

Commit

Permalink
[OM] Use Object Location in partially evaluated ObjectValue.
Browse files Browse the repository at this point in the history
When we create partially evaluated ObjectValues, we should use the
Object's Location, rather than the location of the field being
evaluated.
  • Loading branch information
mikeurbach committed Jun 21, 2024
1 parent ff6ebe2 commit 76d376d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion integration_test/Bindings/Python/dialects/om.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
for (name, field) in obj:
# location from om.class.field @child, %0 : !om.class.type<@Child>
# CHECK: name: child, field: <circt.dialects.om.Object object
# CHECK-SAME: loc: loc("-":31:7)
# CHECK-SAME: loc: loc("-":30:12)
# location from om.class.field @field, %param : !om.integer
# CHECK: name: field, field: 42
# CHECK-SAME: loc: loc("-":27:7)
Expand Down
9 changes: 6 additions & 3 deletions lib/Dialect/OM/Evaluator/Evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ FailureOr<evaluator::EvaluatorValuePtr> circt::om::Evaluator::getOrCreateValue(
evaluator::PathValue::getEmptyPath(loc));
return success(result);
})
.Case<ListCreateOp, TupleCreateOp, MapCreateOp, ObjectFieldOp,
ObjectOp>([&](auto op) {
return getPartiallyEvaluatedValue(op.getType(), loc);
.Case<ListCreateOp, TupleCreateOp, MapCreateOp, ObjectFieldOp>(
[&](auto op) {
return getPartiallyEvaluatedValue(op.getType(), loc);
})
.Case<ObjectOp>([&](auto op) {
return getPartiallyEvaluatedValue(op.getType(), op.getLoc());
})
.Default([&](Operation *op) {
auto error = op->emitError("unable to evaluate value");
Expand Down

0 comments on commit 76d376d

Please sign in to comment.