(
&mut self,
cpu: &mut Cpu,
code: &BlockTable,
block: usize,
)
| 92 | } |
| 93 | |
| 94 | pub fn get_loads( |
| 95 | &mut self, |
| 96 | cpu: &mut Cpu, |
| 97 | code: &BlockTable, |
| 98 | block: usize, |
| 99 | ) -> Result<Vec<(u64, LoadMetadata)>, Error> { |
| 100 | self.compute_load_usage(cpu, code, block)?; |
| 101 | |
| 102 | let mut output = vec![]; |
| 103 | let pcode = &code.blocks[block].pcode; |
| 104 | |
| 105 | let mut current_pc = 0; |
| 106 | for (idx, stmt) in pcode.instructions.iter().enumerate() { |
| 107 | if stmt.op == pcode::Op::InstructionMarker { |
| 108 | current_pc = stmt.inputs.first().as_u64(); |
| 109 | } |
| 110 | |
| 111 | if let Some(metadata) = self.state.loads.values().find(|x| x.offset == idx) { |
| 112 | if metadata.required_bits() < stmt.output.size * 8 { |
| 113 | output.push((current_pc, metadata.clone())); |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | Ok(output) |
| 119 | } |
| 120 | |
| 121 | /// Applies resize operations to all loads where upper bits are unused. Note: this approach is |
| 122 | /// unable to remove unused low bits from the operation, to allow the starting address to |
no test coverage detected