Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lower mChckObj magic with MIR pass #1304

Merged
merged 3 commits into from
May 10, 2024

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented May 10, 2024

Summary

Lower the mChckObj magic with a MIR pass instead of as part of C code
generation, shrinking down cgen.

Details

  • the lowering is integrated into rtchecks.lowerChecks
  • it's a straightforward MIR port of how cgen handled the mChckObj
    magic
  • so that the syntax stays correct after lowering, mirgennow wraps
    the mChckObj call in a scope

The implementation is a straightforward port of the `cgen` logic.
Without it, the later expansion of the call into multiple statements
would result in a syntax error, since an `mnkIf` tree must only contain
a single statement.
@zerbina zerbina added refactor Implementation refactor compiler/backend Related to backend system of the compiler labels May 10, 2024
@zerbina zerbina added this to the C backend rework milestone May 10, 2024
@saem
Copy link
Collaborator

saem commented May 10, 2024

/merge

Copy link

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


@chore-runner chore-runner bot added this pull request to the merge queue May 10, 2024
Merged via the queue into nim-works:devel with commit b63f078 May 10, 2024
31 checks passed
@zerbina zerbina deleted the mir-lower-obj-checks branch May 12, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/backend Related to backend system of the compiler refactor Implementation refactor
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants