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 string/float case statements with MIR pass #1360

Merged

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jun 26, 2024

Summary

Use an MIR pass to lower string and float case statements into if
chains, replacing the C code generator logic.

Details

  • add the lowerCase pass to mirpasses
  • it's currently only enabled for the C target
  • the lowering is a straightforward MIR port of the code generation
    previously implemented by cgen for string/float case statements
  • the cgen handling for string and float case statements is
    removed

zerbina added 2 commits June 26, 2024 21:50
The pass turns `float` and `string` case statements into a chain of
`if` statements. For `string`s, the same hash-table optimization as
implemented by `cgen` is used.
They're fully lowered-away by the MIR pass now.
@zerbina zerbina added refactor Implementation refactor compiler/backend Related to backend system of the compiler labels Jun 26, 2024
@zerbina zerbina added this to the MIR phase milestone Jun 26, 2024
@zerbina
Copy link
Collaborator Author

zerbina commented Jun 27, 2024

/merge

Copy link

Merge requested by: @zerbina

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


Notes for Reviewers

@chore-runner chore-runner bot enabled auto-merge June 27, 2024 19:43
@chore-runner chore-runner bot added this pull request to the merge queue Jun 27, 2024
Merged via the queue into nim-works:devel with commit 0ae0cd5 Jun 27, 2024
31 checks passed
@zerbina zerbina deleted the lower-float-string-case-statements branch June 27, 2024 23:53
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