mirror of
https://github.com/open-goal/jak-project
synced 2026-06-02 18:19:07 -04:00
[decompiler] clean up vector detection and add vector float product detection (#638)
* change * recognize vector float product and update tests
This commit is contained in:
@@ -336,6 +336,23 @@ FormElement* fix_up_abs_2(LetElement* in, const Env& env, FormPool& pool) {
|
||||
return in;
|
||||
}
|
||||
|
||||
FormElement* rewrite_empty_let(LetElement* in, const Env&, FormPool&) {
|
||||
if (in->entries().size() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!in->body()->elts().empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto reg = in->entries().at(0).dest.reg();
|
||||
if (reg.get_kind() == Reg::GPR && !reg.allowed_local_gpr()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return in->entries().at(0).src->try_as_single_element();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Attempt to rewrite a let as another form. If it cannot be rewritten, this will return nullptr.
|
||||
*/
|
||||
@@ -360,6 +377,11 @@ FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool) {
|
||||
return as_abs_2;
|
||||
}
|
||||
|
||||
auto as_unused = rewrite_empty_let(in, env, pool);
|
||||
if (as_unused) {
|
||||
return as_unused;
|
||||
}
|
||||
|
||||
// nothing matched.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user