nim-works / phy

compiler and vm experiments
MIT License
3 stars 2 forks source link

source2il: remove `Asgn` lowering #43

Closed zerbina closed 1 month ago

zerbina commented 1 month ago

Summary

Simplify source2il by removing the in-place assignment lowering for complex types.

Details

Assignments for complex types are supported in the L10, so the lowering is no longer necessary.

The special-casing of complex types is removed for assignments. In addition, wrapping an lvalue expression in a Copy operation is now handled at where the expression is embedded (via the new genUse) instead of where it's produced.


Notes For Reviewers

zerbina commented 1 month ago

Removing the Addr operations from the L10 output also improves the quality of the final bytecode, since taking the address of a local unconditionally disables the SSA form for it, which prevented some optimizations.

It's not yet possible to create code eligible for such optimization with the source language, so there's no effective difference at the moment.