(function: &oomir::Function)
| 14 | _ => 1, |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | fn constant_load_stack_floor(constant: &oomir::Constant) -> u16 { |
| 19 | use oomir::Constant; |
| 20 | match constant { |
| 21 | Constant::Unit => 0, |
| 22 | Constant::I64(_) | Constant::U64(_) | Constant::F64(_) => 2, |
| 23 | Constant::Array(_, elements) => elements |
| 24 | .iter() |
| 25 | .map(|element| 3 + constant_load_stack_floor(element)) |
| 26 | .max() |
| 27 | .unwrap_or(1), |
| 28 | Constant::Slice(element_type, elements) => { |
| 29 | let backing = Constant::Array(element_type.clone(), elements.clone()); |
| 30 | (2 + constant_load_stack_floor(&backing)).max(4) |
| 31 | } |
no test coverage detected