Skip to content

Conversation

Gonzalosilvalde
Copy link
Contributor

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 Gonzalosilvalde requested a review from a team as a code owner April 5, 2025 23:43
@Gonzalosilvalde Gonzalosilvalde requested review from abrown and removed request for a team April 5, 2025 23:43
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Apr 6, 2025
@cfallin
Copy link
Member

cfallin commented Apr 7, 2025

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants