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

Smaller IR changes. #828

Merged
merged 4 commits into from
Feb 23, 2022
Merged

Smaller IR changes. #828

merged 4 commits into from
Feb 23, 2022

Conversation

otrho
Copy link
Contributor

@otrho otrho commented Feb 22, 2022

  • Introduce IrError, which at the moment is pretty small and simple, will grow in time.
  • IR API returns Result<T, IrError> now.
  • Scrap the module name, which was never actually needed. Hence a lot of script script { ... } in the tests.
  • Move the aggregate symbol name management out of the IR library back into sway-core. The IR doesn't have named fields for structs or enums but for convenience I originally put the symbol table needed during compilation into the IR context. It's only needed by sway-core/src/optimize.rs so that's where it now lives.

Closes #647.

I put it there initially without thinking, and then just used the name
'script' for scripts, etc.  This just removes it altogether; touches a
lot of the test files.
The IR doesn't care about struct field names nor enum variant names.
They need to be tracked by IRgen though, so instead of managing it in
the IR Context it can be all done in IRgen core.
@otrho otrho added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged compiler: ir IRgen and sway-ir including optimization passes labels Feb 22, 2022
@mohammadfawaz
Copy link
Contributor

These are not meant to be user-facing errors right? I'm assuming these are strictly syntax errors for the IR language that can be triggered if someone writes bad IR by hand or introduce a transform pass that outputs bad IR.

@otrho
Copy link
Contributor Author

otrho commented Feb 23, 2022

These are not meant to be user-facing errors right?

Correct. Hard to tell the user that 'phi instructions must have unique labels' and expect them to fix it. 🙂

@otrho otrho merged commit 89ce7fb into master Feb 23, 2022
@otrho otrho deleted the otrho/647_misc_ir branch February 23, 2022 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: ir IRgen and sway-ir including optimization passes compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fix the result values for IR.
3 participants