Skip to content

Conversation

@Scheremo
Copy link
Contributor

Adds heap allocation support for class objects.

  • New op: moore.class.new

    • Allocates a new instance of a class symbol (!moore.class.object<@C>).
    • Implements MemoryEffectsOpInterface (reports Allocate).
    • Verifies that the referenced class symbol exists and is a valid ClassDeclOp.
  • Importer:

    • ImportVerilog/Expressions.cpp now lowers new expressions to moore.class.new.
    • Emits an error if a constructor call is present (not yet supported).
  • Tests:

    • Added testModule3 in classes.sv to verify new lowering and expected IR.

@Scheremo Scheremo changed the title [Moore] Implement new operator [Moore] [2/4] Implement new operator Oct 24, 2025
@Scheremo Scheremo marked this pull request as ready for review October 24, 2025 08:45
@Scheremo Scheremo force-pushed the pr-moore-classnew branch 7 times, most recently from e1b804f to 76c4149 Compare October 28, 2025 16:19
Adds heap allocation support for class objects.

- **New op:** `moore.class.new`
  - Allocates a new instance of a class symbol (`!moore.class.object<@C>`).
  - Implements `MemoryEffectsOpInterface` (reports `Allocate`).
  - Verifies that the referenced class symbol exists and is a valid `ClassDeclOp`.

- **Importer:**
  - `ImportVerilog/Expressions.cpp` now lowers `new` expressions to `moore.class.new`.
  - Emits an error if a constructor call is present (not yet supported).

- **Tests:**
  - Added `testModule3` in `classes.sv` to verify `new` lowering and expected IR.
Copy link
Contributor

@TaoBi22 TaoBi22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@Scheremo Scheremo merged commit f78599b into llvm:main Oct 28, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants