mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 06:53:45 -04:00
[decompiler] gkernel offline test (#321)
* working on pointer math * bug fixes * gkernel passing with no anon functions * update tests
This commit is contained in:
@@ -232,7 +232,7 @@ FormElement* FormStack::pop_back(FormPool& pool) {
|
||||
namespace {
|
||||
bool is_op_in_place(SetVarElement* elt,
|
||||
FixedOperatorKind op,
|
||||
const Env&,
|
||||
const Env& env,
|
||||
RegisterAccess* base_out,
|
||||
Form** val_out) {
|
||||
auto matcher = Matcher::op(GenericOpMatcher::fixed(op), {Matcher::any_reg(0), Matcher::any(1)});
|
||||
@@ -240,6 +240,7 @@ bool is_op_in_place(SetVarElement* elt,
|
||||
if (result.matched) {
|
||||
auto first = result.maps.regs.at(0);
|
||||
assert(first.has_value());
|
||||
|
||||
if (first->reg() != elt->dst().reg()) {
|
||||
return false;
|
||||
}
|
||||
@@ -248,6 +249,14 @@ bool is_op_in_place(SetVarElement* elt,
|
||||
return false;
|
||||
}
|
||||
|
||||
auto src_var = env.get_variable_name(*first);
|
||||
auto dst_var = env.get_variable_name(elt->dst());
|
||||
if (src_var != dst_var) {
|
||||
// something like daddu a1-1, a1-0, v0 isn't safe to turn into an in-place, but will pass
|
||||
// the previous two checks.
|
||||
return false;
|
||||
}
|
||||
|
||||
*val_out = result.maps.forms.at(1);
|
||||
*base_out = first.value();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user