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

@@ -201,6 +201,10 @@ impl<'dummy_environment> TargetEnvironment for DummyFuncEnvironment<'dummy_envir
}
impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environment> {
fn is_wasm_parameter(&self, func: &ir::Function, index: usize) -> bool {
func.signature.params[index].purpose == ir::ArgumentPurpose::Normal
}
fn return_mode(&self) -> ReturnMode {
self.return_mode
}