Firestar99 opened PR #14024 from Firestar99:rc_for_type_by_ref to bytecodealliance:main:
This PR changes
trait MachInst:- fn rc_for_type(ty: Type) -> CodegenResult<(&'static [RegClass], &'static [Type])>; + fn rc_for_type(ty: &Type) -> CodegenResult<(&[RegClass], &[Type])>;This change is trivial to support from all call sites, and allows implementors to:
- I8 => Ok((&[RegClass::Int], &[I8])), - I16 => Ok((&[RegClass::Int], &[I16])), - I32 => Ok((&[RegClass::Int], &[I32])), - I64 => Ok((&[RegClass::Int], &[I64])), - F32 => Ok((&[RegClass::Float], &[F32])), - F64 => Ok((&[RegClass::Float], &[F64])), + I8 | I16 | I32 | I64 => Ok((&[RegClass::Int], core::slice::from_ref(ty))), + F32 | F64 => Ok((&[RegClass::Float], core::slice::from_ref(ty))),Not sure how overall valuable this patch is. This function has just been annoying to implement for SSA-style IRs, where
RegClassdoesn't matter and it's just returning whatever type was passed.
Firestar99 requested wasmtime-compiler-s390x-reviewers for a review on PR #14024.
Firestar99 requested fitzgen for a review on PR #14024.
Firestar99 requested wasmtime-compiler-reviewers for a review on PR #14024.
fitzgen commented on PR #14024:
This function has just been annoying to implement for SSA-style IRs, where
RegClassdoesn't matter and it's just returning whatever type was passed.Can you clarify what you are doing here? Are you adding an SSA-style IR as a new backend to Cranelift?
github-actions[bot] added the label cranelift on PR #14024.
github-actions[bot] added the label cranelift:area:machinst on PR #14024.
github-actions[bot] added the label cranelift:area:aarch64 on PR #14024.
github-actions[bot] added the label cranelift:area:x64 on PR #14024.
fitzgen commented on PR #14024:
@Firestar99 friendly ping on the question above
:thumbs_up: fitzgen submitted PR review:
LGTM, thanks!
fitzgen added PR #14024 Make rc_for_type() pass Type arg by reference instead of value to the merge queue.
:check: fitzgen merged PR #14024.
fitzgen removed PR #14024 Make rc_for_type() pass Type arg by reference instead of value from the merge queue.
Last updated: Aug 30 2026 at 09:07 UTC