Skip to content

Add support for global constants to constant folder #1180

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zeitgeist87
Copy link
Contributor

Global constants like enums are represented in the AST as identifiers. These identifiers can be looked up in the AST reference map. If the entry in the reference map has a value associated with it, we can treat it as a constant and attempt to turn it into a literal.

This reduces the size of the AST and unlocks more optimization opportunities.

@TristonianJones
Copy link
Collaborator

/gcbrun

@zeitgeist87 zeitgeist87 force-pushed the add_identifier_support_for_constant_folding branch 3 times, most recently from 85b2629 to cc30e3b Compare May 21, 2025 07:47
Global constants like enums are represented in the AST as identifiers. These
identifiers can be looked up in the AST reference map. If there is an entry
in the reference map, we can try to fold it as a constant and to turn it into
a literal.

This reduces the size of the AST and unlocks more optimization
opportunities.
@zeitgeist87 zeitgeist87 force-pushed the add_identifier_support_for_constant_folding branch from cc30e3b to fd56eca Compare May 22, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants