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

IR should manage (some) global memory. #4351

Open
otrho opened this issue Mar 27, 2023 · 0 comments
Open

IR should manage (some) global memory. #4351

otrho opened this issue Mar 27, 2023 · 0 comments
Labels
compiler: ir IRgen and sway-ir including optimization passes enhancement New feature or request

Comments

@otrho
Copy link
Contributor

otrho commented Mar 27, 2023

Currently all const memory is placed in the 'data section' similarly to ELF binaries and the .rodata segment. This is constructed and managed entirely by the ASMgen.

The constdemotion pass introduced in #4336 will explicitly place initialised constant values onto the stack so as to provide a pointer to those values as opposed to referring to them by value. They are in turn stored in the data section but still copied from there onto the stack before being used.

If the IR maintained a global memory region to store such values, rather than the stack, then they could more easily be added to the data section in ASMgen and easily avoid being copied to the stack.

A global region could be used and explicitly managed for configurable constants too.

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 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant