wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

cranelift: ISLE wrapper for constructing constants

Open Gonzalosilvalde opened this issue 7 months ago • 1 comments
trafficstars

Description:

This pull request addresses issue #6038 by adding an ISLE wrapper for constructing constants. The goal is to allow mid-end optimization rules to generate constants generically without needing to know whether to use iconst, vconst, f32const, f64const, etc.

Changes:

  • Added a helper function ty_vec in cranelift/codegen/src/isle_prelude.rs
  • Defined an extractor ty_vec in `cranelift/codegen/src/prelude.isle
  • Introduced a new rule in cranelift/codegen/src/prelude_opt.isle for constructing constant nodes

Additional Notes:

  • It compiles without any problem and passes the cranelift test.

Gonzalosilvalde avatar Apr 05 '25 23:04 Gonzalosilvalde

@Gonzalosilvalde thanks for the PR!

In order to ensure this is tested and works for our lowerings, would you mind switching over at least a few existing uses of iconst/etc to use this instead? Looking at the issue(s) that spawned this might help to find cases to demonstrate it as well.

cfallin avatar Apr 07 '25 18:04 cfallin

Hi @Gonzalosilvalde , I noticed this PR has been quiet for a while.

Would you mind if I pick this up and continue the remaining testing work in a separate PR to help move it forward?

efJerryYang avatar Oct 07 '25 21:10 efJerryYang

Hi @efJerryYang , Yeah, continue what remains without any problem

Gonzalosilvalde avatar Oct 08 '25 07:10 Gonzalosilvalde