These can't be part of the Renamer impl due to borrowck rules.
(
header: &mut ModuleHeader,
types_global_values: &mut Vec<Instruction>,
ty: Word,
)
| 396 | |
| 397 | // These can't be part of the Renamer impl due to borrowck rules. |
| 398 | fn undef_for( |
| 399 | header: &mut ModuleHeader, |
| 400 | types_global_values: &mut Vec<Instruction>, |
| 401 | ty: Word, |
| 402 | ) -> Word { |
| 403 | // TODO: This is horribly slow, fix this |
| 404 | let existing = types_global_values |
| 405 | .iter() |
| 406 | .find(|inst| inst.class.opcode == Op::Undef && inst.result_type.unwrap() == ty); |
| 407 | if let Some(existing) = existing { |
| 408 | return existing.result_id.unwrap(); |
| 409 | } |
| 410 | let inst_id = id(header); |
| 411 | types_global_values.push(Instruction::new(Op::Undef, Some(ty), Some(inst_id), vec![])); |
| 412 | inst_id |
| 413 | } |
| 414 | fn top_stack_or_undef( |
| 415 | header: &mut ModuleHeader, |
| 416 | types_global_values: &mut Vec<Instruction>, |
no test coverage detected