diff --git a/.gitignore b/.gitignore index 13749d1..014e033 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ *.elf *.z64 -# Output C files -test/funcs +# Local working data +tests # Linux build output build/ @@ -42,12 +42,6 @@ bld/ # Visual Studio 2015/2017 cache/options directory .vs/ -# Libraries (binaries that aren't in the repo) -test/Lib - -# RT64 (since it's not public yet) -test/RT64 - # Runtime files imgui.ini rt64.log diff --git a/LiveRecomp/live_generator.cpp b/LiveRecomp/live_generator.cpp index 141e5ad..130a645 100644 --- a/LiveRecomp/live_generator.cpp +++ b/LiveRecomp/live_generator.cpp @@ -48,8 +48,8 @@ struct N64Recomp::LiveGeneratorContext { sljit_jump* cur_branch_jump; }; -N64Recomp::LiveGenerator::LiveGenerator(size_t num_funcs, const LiveGeneratorInputs& inputs) : compiler(compiler), inputs(inputs) { - compiler = sljit_create_compiler(NULL); +N64Recomp::LiveGenerator::LiveGenerator(size_t num_funcs, const LiveGeneratorInputs& inputs) : inputs(inputs) { + compiler = sljit_create_compiler(nullptr); context = std::make_unique(); context->func_labels.resize(num_funcs); } @@ -1026,7 +1026,7 @@ void N64Recomp::LiveGenerator::emit_muldiv(InstrId instr_id, int reg1, int reg2) sljit_set_label(jump_skip_division, after_division); // Move the numerator into hi. - sljit_emit_op1(compiler, SLJIT_MOV, Registers::hi, 0, SLJIT_R0, 0); + sljit_emit_op1(compiler, save_opcode, Registers::hi, 0, SLJIT_R0, 0); if (is_signed) { // Calculate the negative signum of the numerator and place it in lo. @@ -1037,7 +1037,7 @@ void N64Recomp::LiveGenerator::emit_muldiv(InstrId instr_id, int reg1, int reg2) } else { // Move -1 into lo. - sljit_emit_op1(compiler, SLJIT_MOV, Registers::lo, 0, SLJIT_IMM, -1); + sljit_emit_op1(compiler, SLJIT_MOV, Registers::lo, 0, SLJIT_IMM, sljit_sw(-1)); } // Emit a label and set it as the target of the jump after the divison. diff --git a/LiveRecomp/live_recompiler_test.cpp b/LiveRecomp/live_recompiler_test.cpp index 89b2ff3..900e92d 100644 --- a/LiveRecomp/live_recompiler_test.cpp +++ b/LiveRecomp/live_recompiler_test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "sljitLir.h" #include "recompiler/live_recompiler.h" @@ -274,7 +275,7 @@ int main(int argc, const char** argv) { switch (stats.error) { case TestError::Success: printf(" Success\n"); - printf(" Generated %llu bytes in %llu microseconds and ran in %llu microseconds\n", + printf(" Generated %" PRIu64 " bytes in %" PRIu64 " microseconds and ran in %" PRIu64 " microseconds\n", stats.code_size, stats.codegen_microseconds, stats.execution_microseconds); passed_count++; break; diff --git a/src/cgenerator.cpp b/src/cgenerator.cpp index c5c0ee1..5d6a6bc 100644 --- a/src/cgenerator.cpp +++ b/src/cgenerator.cpp @@ -490,6 +490,9 @@ void N64Recomp::CGenerator::emit_muldiv(InstrId instr_id, int reg1, int reg2) co case InstrId::cpu_ddivu: fmt::print(output_file, "DDIVU(U64({}), U64({}), &lo, &hi);\n", gpr_to_string(reg1), gpr_to_string(reg2)); break; + default: + assert(false); + break; } }