PhantomInTheWire opened PR #11040 from PhantomInTheWire:feature/add-clif-func-names to bytecodealliance:main:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->Related Issues
Fixes: #10733
Explanation
This PR addresses issue #10733 by adding the function name as a comment to the beginning of each Cranelift IR file generated by the
--emit-clifflag.Previously, the files generated by
--emit-clifcontained only the raw Cranelift IR, making it difficult to identify which function the IR belonged to without cross-referencing with other tools likewasmtime explore. This change improves the usability of the--emit-clifoutput by clearly labeling each function's IR.Input Needed
I'm unsure of where to place tests for this.
PhantomInTheWire requested fitzgen for a review on PR #11040.
PhantomInTheWire requested wasmtime-compiler-reviewers for a review on PR #11040.
PhantomInTheWire updated PR #11040.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
This would work too, right?
";; Intermediate Representation of function <{symbol}>:\n",This avoids truncating a function name like
wasm[0]::function[1]::my_library::SomeType::get(as would be used if the names section containsmy_library::SomeType::getas name) to the pretty much uselessget.
fitzgen submitted PR review:
Nothing to add over what @bjorn3 pointed out.
PhantomInTheWire submitted PR review.
PhantomInTheWire created PR review comment:
would using something like this function work better?
fn remove_first_two_segments(s: &str) -> Option<String> { let mut parts = s.split("::").skip(2); let rest: Vec<&str> = parts.collect(); if rest.is_empty() { None } else { Some(format!("::{}", rest.join("::"))) } }also wasmtime explore uses "Intermediate Representation of function <get>:" to should i figure out a way where it gives my_library::SomeType::get too?
PhantomInTheWire edited PR review comment.
PhantomInTheWire updated PR #11040.
PhantomInTheWire requested bjorn3 for a review on PR #11040.
PhantomInTheWire requested fitzgen for a review on PR #11040.
PhantomInTheWire updated PR #11040.
fitzgen submitted PR review:
Thanks!
fitzgen merged PR #11040.
Last updated: Dec 06 2025 at 07:03 UTC