-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Yul: Introduces ASTNodeRegistry #15823
base: develop
Are you sure you want to change the base?
Conversation
d252184
to
cd00616
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except the minor comments, it seems OK to me.
cd00616
to
2b9295d
Compare
@clonker, BTW, one thing that I found confusing was referring to things related to type |
2b9295d
to
bf80a01
Compare
You are right and this is what I was referring to on Monday :) I have made things self-consistent now as in everything is "id" and there is no more mention of "name". Change on the larger scope (as in changing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
But my review is rather superficial, I don't have enough knowledge about the design and how this is gonna be used.
Someone else should also have a look at this as well :)
This PR supersedes PR #15242.
Depends on PR #15821.It introduces
yul::ASTNodeRegistryBuilder
andyul::ASTNodeRegistry
. Most important bits of the API:I have not yet included the
NodeIdDispenser
, this can be done in a separate PR.The
ASTNodeRegistry
lives (immutably) in theAST
and can be used to query labels for particular nodes in the AST. But potentially this could store more metadata than just string labels.A
ASTNodeRegistry
can be created by using theASTNodeRegistryBuilder
- which would be the preferred way when importing or parsing (see PR #15833):solidity/libyul/AsmJsonImporter.cpp
Lines 82 to 87 in c2cea37
solidity/libyul/AsmJsonImporter.cpp
Lines 56 to 60 in c2cea37
Or, during/after optimization, from the
NodeIdDispenser
based on the root block, discarding everything that is not part of the current AST, and the dialect to check for collisions with reserved identifiers:solidity/libyul/optimiser/Suite.cpp
Line 200 in c2cea37
solidity/libyul/AST.cpp
Lines 110 to 114 in c2cea37