Add a is_wasm_parameter method to the wasm FuncEnvironment. (#1329)

This provides a more flexible way to allow embedding to tell
cranelift-wasm which function parameters are hidden, and which should be
translated as wasm user variables.

This replaces https://github.com/bytecodealliance/cranelift/pull/1086.
This commit is contained in:
Dan Gohman
2020-01-10 04:40:25 -08:00
committed by GitHub
parent 43f1e05156
commit d765677fcc
3 changed files with 16 additions and 4 deletions

View File

@@ -138,6 +138,10 @@ pub trait TargetEnvironment {
/// IR. The function environment provides information about the WebAssembly module as well as the
/// runtime environment.
pub trait FuncEnvironment: TargetEnvironment {
/// Is the given parameter of the given function a wasm-level parameter, as opposed to a hidden
/// parameter added for use by the implementation?
fn is_wasm_parameter(&self, func: &ir::Function, index: usize) -> bool;
/// Should the code be structured to use a single `fallthrough_return` instruction at the end
/// of the function body, rather than `return` instructions as needed? This is used by VMs
/// to append custom epilogues.