[Decompiler] WIP Expression Stacking (#178)

* wip

* fix the stupid if thing

* update

* fix

* fix some ordering issues
This commit is contained in:
water111
2021-01-02 18:24:45 -05:00
committed by GitHub
parent feead303aa
commit 7af6dce1b2
14 changed files with 693 additions and 140 deletions
@@ -9,6 +9,7 @@ bool expressionize_begin(IR_Begin* begin, LinkedObjectFile& file) {
for (auto& op : begin->forms) {
op->expression_stack(stack, file);
}
// printf("%s\n", stack.print(file).c_str());
begin->forms = stack.get_result();
return true;
}
@@ -16,6 +17,7 @@ bool expressionize_begin(IR_Begin* begin, LinkedObjectFile& file) {
bool Function::build_expression(LinkedObjectFile& file) {
if (!ir) {
printf("build_expression on %s failed due to no IR.\n", guessed_name.to_string().c_str());
return false;
}
@@ -41,9 +43,11 @@ bool Function::build_expression(LinkedObjectFile& file) {
// turn each begin into an expression
for (auto b : all_begins) {
// printf("BEFORE:\n%s\n", b->print(file).c_str());
if (!expressionize_begin(b, file)) {
return false;
}
// printf("AFTER:\n%s\n", b->print(file).c_str());
}
} catch (std::exception& e) {
printf("build_expression failed on %s due to %s\n", guessed_name.to_string().c_str(), e.what());