[decompiler] rewrite set lets as just sets (#1858)

Rewrites specific kinds of lets where the return value of the `set!`
itself is meant to be used to just be `set!`s. Implemented at the let
rewrite level. Seems to work for Jak 2 so far.

Fixes #1854 .
This commit is contained in:
ManDude
2022-09-07 23:28:01 +01:00
committed by GitHub
parent 97c12ebaf4
commit cfb6abb24d
70 changed files with 444 additions and 961 deletions
+5 -1
View File
@@ -73,11 +73,12 @@ struct LetRewriteStats {
int attack_info = 0;
int vector_dot = 0;
int rand_float_gen = 0;
int set_let = 0;
int total() const {
return dotimes + countdown + abs + abs2 + unused + ja + case_no_else + case_with_else +
set_vector + set_vector2 + send_event + font_context_meth + proc_new + attack_info +
vector_dot + rand_float_gen;
vector_dot + rand_float_gen + set_let;
}
std::string print() const {
@@ -99,6 +100,7 @@ struct LetRewriteStats {
out += fmt::format(" attack_info: {}\n", attack_info);
out += fmt::format(" vector_dot: {}\n", vector_dot);
out += fmt::format(" rand_float_gen: {}\n", rand_float_gen);
out += fmt::format(" set_let: {}\n", set_let);
return out;
}
@@ -120,6 +122,7 @@ struct LetRewriteStats {
result.attack_info = attack_info + other.attack_info;
result.vector_dot = vector_dot + other.vector_dot;
result.rand_float_gen = rand_float_gen + other.rand_float_gen;
result.set_let = rand_float_gen + other.set_let;
return result;
}
@@ -140,6 +143,7 @@ struct LetRewriteStats {
attack_info += other.attack_info;
vector_dot += other.vector_dot;
rand_float_gen += other.rand_float_gen;
set_let += other.set_let;
return *this;
}
};