Remove the relocation we're keeping track of in a particular register when an instruction reuses that register to hold some other value, unrelated to pool relocation addresses.
(ins: powerpc::Ins, gpr_pool_relocs: &mut BTreeMap<u8, Relocation>)
| 807 | // Remove the relocation we're keeping track of in a particular register when an instruction reuses |
| 808 | // that register to hold some other value, unrelated to pool relocation addresses. |
| 809 | fn clear_overwritten_gprs(ins: powerpc::Ins, gpr_pool_relocs: &mut BTreeMap<u8, Relocation>) { |
| 810 | use powerpc::{Argument, Arguments, Opcode}; |
| 811 | let mut def_args = Arguments::default(); |
| 812 | ins.parse_defs(&mut def_args); |
| 813 | for arg in def_args { |
| 814 | if let Argument::GPR(gpr) = arg { |
| 815 | if ins.op == Opcode::Lmw { |
| 816 | // `lmw` overwrites all registers from rd to r31. |
| 817 | // powerpc only returns rd itself, so we manually clear the rest of them. |
| 818 | for reg in gpr.0..31 { |
| 819 | gpr_pool_relocs.remove(®); |
| 820 | } |
| 821 | break; |
| 822 | } |
| 823 | gpr_pool_relocs.remove(&gpr.0); |
| 824 | } |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | // We create a fake relocation for an instruction, vaguely simulating what the actual relocation |
| 829 | // might have looked like if it wasn't pooled. This is so minimal changes are needed to display |
no test coverage detected