Cranelift: Remove the stack_{load,store} instructions#13580
Open
fitzgen wants to merge 1 commit into
Open
Conversation
These get immediately legalized to `stack_addr` and `load` or `store`, so frontends should just emit that pair directly. For convenience and backwards compat, we add `InstBuilder::stack_load` and `InstBuilder::stack_store` methods that emit the pair as a single operation. Unfortunately, these methods have to take an additional pointer-type parameter that the old version didn't have to take because the rewrite didn't happen until legalization time, so these new methods are not 100% backwards compatible. This also necessitated passing in a `TargetFrontendConfig` to `FuncBuilder::finalize`, which resulted in a bit of churn, but is fully mechanical.
alexcrichton
reviewed
Jun 5, 2026
Member
alexcrichton
left a comment
There was a problem hiding this comment.
Would it be possible to avoid changing finalize by looking at the stack slot's size field and choosing an appropriate type based on that?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These get immediately legalized to
stack_addrandloadorstore, so frontends should just emit that pair directly. For convenience and backwards compat, we addInstBuilder::stack_loadandInstBuilder::stack_storemethods that emit the pair as a single operation. Unfortunately, these methods have to take an additional pointer-type parameter that the old version didn't have to take because the rewrite didn't happen until legalization time, so these new methods are not 100% backwards compatible. This also necessitated passing in aTargetFrontendConfigtoFuncBuilder::finalize, which resulted in a bit of churn, but is fully mechanical.