[decompiler] gkernel offline test (#321)

* working on pointer math

* bug fixes

* gkernel passing with no anon functions

* update tests
This commit is contained in:
water111
2021-03-14 16:11:42 -04:00
committed by GitHub
parent 814480f9e5
commit e93d97dd07
30 changed files with 2576 additions and 278 deletions
+10 -1
View File
@@ -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;