-
Notifications
You must be signed in to change notification settings - Fork 745
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
DebugLocationPropagation: pass debuglocation from parent node to chil… #6500
Conversation
This makes sense to me to add, I agree it looks useful for compilers. Before I look at the code in detail, though, @tlively didn't you have plans to add something like this, to copy debug info from parents to (unmarked) children? Maybe for the new parser somehow? If so perhaps code could be shared here. |
OK, Thank you! I will move existing code out to a pass. And then we can use this pass in wasm-opt options and wat-parser. |
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.
Thanks, I have a better undstanding of how this works now.
Thanks, I think this PR can be merged. |
Oops, I had forgotten to hit the approve button. Thanks for working on this! |
This PR creates a pass to propagate debug location from parent node to child nodes which has no debug location with pre-order traversal. This is useful for compilers that use Binaryen API to generate WebAssembly modules.
It behaves like
wasm-opt
read text format file: children are tagged with the debug info of the parent, if they have no annotation of their own.For compilers that use Binaryen API to generate WebAssembly modules, it is a bit redundant to add debugInfo for each expression, Especially when the compiler wrap expressions.
With this pass, compilers just need to add debugInfo for the parent node, which is more convenient.
For example:
Without this pass, if the compiler only adds debugInfo for the wrapped expression
drop
, thecall
expression has no corresponding source code mapping in DevTools debugging, which is obviously not user-friendly.