Partially Implement Decompiler Type Analysis (#90)

* implement basic framework for decompiler type analysis

* before type system changes

* add some decompiler stuff to the type system

* try algorithm on a few functions
This commit is contained in:
water111
2020-10-18 15:44:19 -04:00
committed by GitHub
parent 3e798cd3aa
commit fc1a8f37c6
19 changed files with 1064 additions and 36 deletions
+7 -1
View File
@@ -516,8 +516,14 @@ std::shared_ptr<IR> try_daddu(Instruction& instr, int idx) {
}
std::shared_ptr<IR> try_dsubu(Instruction& instr, int idx) {
if (is_gpr_3(instr, InstructionKind::DSUBU, {}, {}, {}) &&
if (is_gpr_3(instr, InstructionKind::DSUBU, {}, make_gpr(Reg::R0), {}) &&
!instr.get_src(0).is_reg(make_gpr(Reg::S7)) && !instr.get_src(1).is_reg(make_gpr(Reg::S7))) {
return make_set(
IR_Set::REG_64, make_reg(instr.get_dst(0).get_reg(), idx),
std::make_shared<IR_IntMath1>(IR_IntMath1::NEG, make_reg(instr.get_src(1).get_reg(), idx)));
} else if (is_gpr_3(instr, InstructionKind::DSUBU, {}, {}, {}) &&
!instr.get_src(0).is_reg(make_gpr(Reg::S7)) &&
!instr.get_src(1).is_reg(make_gpr(Reg::S7))) {
return make_set(
IR_Set::REG_64, make_reg(instr.get_dst(0).get_reg(), idx),
std::make_shared<IR_IntMath2>(IR_IntMath2::SUB, make_reg(instr.get_src(0).get_reg(), idx),