Skip to content

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
@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit 66a441f into google:master Jun 20, 2025
2 checks passed
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