rename layout -> return_layout

This commit is contained in:
Folkert 2021-09-07 20:55:05 +02:00
parent 5e411bdda3
commit c888baccff

View file

@ -265,12 +265,12 @@ impl<'a> WasmBackend<'a> {
&mut self, &mut self,
lowlevel: &LowLevel, lowlevel: &LowLevel,
args: &'a [Symbol], args: &'a [Symbol],
layout: &Layout<'a>, return_layout: &Layout<'a>,
) -> Result<(), String> { ) -> Result<(), String> {
for arg in args { for arg in args {
self.load_from_symbol(arg)?; self.load_from_symbol(arg)?;
} }
let wasm_layout = WasmLayout::new(layout)?; let wasm_layout = WasmLayout::new(return_layout)?;
self.build_instructions_lowlevel(lowlevel, wasm_layout.value_type)?; self.build_instructions_lowlevel(lowlevel, wasm_layout.value_type)?;
Ok(()) Ok(())
} }
@ -278,7 +278,7 @@ impl<'a> WasmBackend<'a> {
fn build_instructions_lowlevel( fn build_instructions_lowlevel(
&mut self, &mut self,
lowlevel: &LowLevel, lowlevel: &LowLevel,
value_type: ValueType, return_value_type: ValueType,
) -> Result<(), String> { ) -> Result<(), String> {
// TODO: Find a way to organise all the lowlevel ops and layouts! There's lots! // TODO: Find a way to organise all the lowlevel ops and layouts! There's lots!
// //
@ -287,7 +287,7 @@ impl<'a> WasmBackend<'a> {
// so simple arrays of instructions won't work. But there are common patterns. // so simple arrays of instructions won't work. But there are common patterns.
let instructions: &[Instruction] = match lowlevel { let instructions: &[Instruction] = match lowlevel {
// Wasm type might not be enough, may need to sign-extend i8 etc. Maybe in load_from_symbol? // Wasm type might not be enough, may need to sign-extend i8 etc. Maybe in load_from_symbol?
LowLevel::NumAdd => match value_type { LowLevel::NumAdd => match return_value_type {
ValueType::I32 => &[I32Add], ValueType::I32 => &[I32Add],
ValueType::I64 => &[I64Add], ValueType::I64 => &[I64Add],
ValueType::F32 => &[F32Add], ValueType::F32 => &[F32Add],