mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-08 21:17:59 +00:00
Update ppc750cl (subi{,s,c} mnemonics, capstone-style CR bits)
This commit is contained in:
@@ -38,7 +38,7 @@ pub struct ObjSection {
|
||||
pub match_percent: f32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum ObjInsArg {
|
||||
PpcArg(ppc750cl::Argument),
|
||||
MipsArg(String),
|
||||
@@ -48,39 +48,6 @@ pub enum ObjInsArg {
|
||||
BranchOffset(i32),
|
||||
}
|
||||
|
||||
// TODO derive PartialEq on ppc750cl::Argument so this isn't necessary
|
||||
impl PartialEq for ObjInsArg {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ObjInsArg::PpcArg(a), ObjInsArg::PpcArg(b)) => {
|
||||
use ppc750cl::Argument;
|
||||
match (a, b) {
|
||||
(Argument::GPR(a), Argument::GPR(b)) => a == b,
|
||||
(Argument::FPR(a), Argument::FPR(b)) => a == b,
|
||||
(Argument::SR(a), Argument::SR(b)) => a == b,
|
||||
(Argument::SPR(a), Argument::SPR(b)) => a == b,
|
||||
(Argument::CRField(a), Argument::CRField(b)) => a == b,
|
||||
(Argument::CRBit(a), Argument::CRBit(b)) => a == b,
|
||||
(Argument::GQR(a), Argument::GQR(b)) => a == b,
|
||||
(Argument::Uimm(a), Argument::Uimm(b)) => a == b,
|
||||
(Argument::Simm(a), Argument::Simm(b)) => a == b,
|
||||
(Argument::Offset(a), Argument::Offset(b)) => a == b,
|
||||
(Argument::BranchDest(a), Argument::BranchDest(b)) => a == b,
|
||||
(Argument::Bit(a), Argument::Bit(b)) => a == b,
|
||||
(Argument::OpaqueU(a), Argument::OpaqueU(b)) => a == b,
|
||||
(_, _) => false,
|
||||
}
|
||||
}
|
||||
(ObjInsArg::MipsArg(a), ObjInsArg::MipsArg(b)) => a == b,
|
||||
(ObjInsArg::MipsArgWithBase(a), ObjInsArg::MipsArgWithBase(b)) => a == b,
|
||||
(ObjInsArg::Reloc, ObjInsArg::Reloc) => true,
|
||||
(ObjInsArg::RelocWithBase, ObjInsArg::RelocWithBase) => true,
|
||||
(ObjInsArg::BranchOffset(a), ObjInsArg::BranchOffset(b)) => a == b,
|
||||
(_, _) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ObjInsArgDiff {
|
||||
/// Incrementing index for coloring
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use anyhow::Result;
|
||||
use ppc750cl::{disasm_iter, Argument, Ins, SimplifiedIns};
|
||||
use ppc750cl::{disasm_iter, Argument, SimplifiedIns};
|
||||
|
||||
use crate::obj::{ObjIns, ObjInsArg, ObjReloc, ObjRelocKind};
|
||||
|
||||
@@ -89,18 +89,8 @@ pub fn process_code(
|
||||
op: ins.op as u8,
|
||||
branch_dest: None,
|
||||
line,
|
||||
orig: Some(format!("{}", basic_form(ins))),
|
||||
orig: Some(format!("{}", SimplifiedIns::basic_form(ins))),
|
||||
});
|
||||
}
|
||||
Ok((ops, insts))
|
||||
}
|
||||
|
||||
// TODO make public in ppc750cl
|
||||
fn basic_form(ins: Ins) -> SimplifiedIns {
|
||||
SimplifiedIns {
|
||||
mnemonic: ins.op.mnemonic(),
|
||||
suffix: ins.suffix(),
|
||||
args: ins.fields().iter().flat_map(|field| field.argument()).collect(),
|
||||
ins,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user