mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 06:54:31 -04:00
decomp - vector.gc - Decompile vector.gc (#289)
* temp: commit what i have so far decomp: Fix nonempty_intersection impl for MSVC Debugging use-case docs: Add info on getting ASan builds running on Visual Studio w/o exceptions * decomp: initial rlet implementation * decomp: cleanup pass of vector-rewrite stage * decomp: Commit in-progress vector.gc, shortcomings are TODO commented * decomp: More cleanup, rename from being `vector` instr specific Fundamentally, this process can be used for re-writing ANY inline-asm instruction * decomp: Support 4th arg ACC instructions * decomp: Final pass of vector.gc before implementing last instructions * decomp: Better warnings when hitting unimplemented instructs * compiler: Implement inverse-sqrt and mov.vf * decomp: Final manual pass over vector.gc, documented gaps * decomp: Finish decompiling what currently is possible in vector.gc * decomp: Fix Variable -> RegisterAccess conflict * decomp: codacy lint * Address review feedback * Address feedback part 2 * Resolve build failures
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "decompiler/analysis/cfg_builder.h"
|
||||
#include "decompiler/analysis/final_output.h"
|
||||
#include "decompiler/analysis/expression_build.h"
|
||||
#include "decompiler/analysis/inline_asm_rewrite.h"
|
||||
#include "common/goos/PrettyPrinter.h"
|
||||
#include "decompiler/IR2/Form.h"
|
||||
|
||||
@@ -46,7 +47,8 @@ void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir) {
|
||||
ir2_store_current_forms();
|
||||
lg::info("Expression building...");
|
||||
ir2_build_expressions();
|
||||
|
||||
lg::info("Re-writing inline asm instructions...");
|
||||
ir2_rewrite_inline_asm_instructions();
|
||||
if (get_config().insert_lets) {
|
||||
lg::info("Inserting lets...");
|
||||
ir2_insert_lets();
|
||||
@@ -444,6 +446,28 @@ void ObjectFileDB::ir2_insert_lets() {
|
||||
combined_stats.vars_in_lets, combined_stats.total_vars, timer.getMs());
|
||||
}
|
||||
|
||||
void ObjectFileDB::ir2_rewrite_inline_asm_instructions() {
|
||||
Timer timer;
|
||||
int total = 0;
|
||||
int attempted = 0;
|
||||
int successful = 0;
|
||||
for_each_function_def_order([&](Function& func, int segment_id, ObjectFileData& data) {
|
||||
(void)segment_id;
|
||||
(void)data;
|
||||
total++;
|
||||
if (func.ir2.top_form && func.ir2.env.has_type_analysis()) {
|
||||
attempted++;
|
||||
if (rewrite_inline_asm_instructions(func.ir2.top_form, *func.ir2.form_pool, func, dts)) {
|
||||
successful++;
|
||||
func.ir2.print_debug_forms = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
lg::info("{}/{}/{} rewrote inline-asm instructions in {:.2f} ms\n", successful, attempted, total,
|
||||
timer.getMs());
|
||||
}
|
||||
|
||||
void ObjectFileDB::ir2_write_results(const std::string& output_dir) {
|
||||
Timer timer;
|
||||
lg::info("Writing IR2 results to file...");
|
||||
|
||||
Reference in New Issue
Block a user