mirror of
https://github.com/open-goal/jak-project
synced 2026-07-08 22:45:00 -04:00
[decompiler] Jak 2 modifications, new all-types code (#1553)
* temp * look at old game types * clean up
This commit is contained in:
@@ -1842,4 +1842,44 @@ RegisterAccess StackSpillLoadOp::get_set_destination() const {
|
||||
throw std::runtime_error("StackSpillLoadOp cannot be treated as a set! operation");
|
||||
}
|
||||
|
||||
bool is_op_2(AtomicOp* op,
|
||||
MatchParam<SimpleExpression::Kind> kind,
|
||||
MatchParam<Register> dst,
|
||||
MatchParam<Register> src0,
|
||||
Register* dst_out,
|
||||
Register* src0_out) {
|
||||
// should be a set reg to int math 2 ir
|
||||
auto set = dynamic_cast<SetVarOp*>(op);
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// destination should be a register
|
||||
auto dest = set->dst();
|
||||
if (dst != dest.reg()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto math = set->src();
|
||||
if (kind != math.kind()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto arg = math.get_arg(0);
|
||||
|
||||
if (!arg.is_var() || src0 != arg.var().reg()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// it's a match!
|
||||
if (dst_out) {
|
||||
*dst_out = dest.reg();
|
||||
}
|
||||
|
||||
if (src0_out) {
|
||||
*src0_out = arg.var().reg();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace decompiler
|
||||
|
||||
Reference in New Issue
Block a user