| 1304 | } |
| 1305 | |
| 1306 | void N64Recomp::LiveGenerator::emit_function_start(const std::string& function_name, size_t func_index) const { |
| 1307 | context->function_name = function_name; |
| 1308 | context->func_labels[func_index] = sljit_emit_label(compiler); |
| 1309 | // sljit_emit_op0(compiler, SLJIT_BREAKPOINT); |
| 1310 | sljit_emit_enter(compiler, 0, SLJIT_ARGS2V(P, P), 4 | SLJIT_ENTER_FLOAT(1), 5 | SLJIT_ENTER_FLOAT(0), 0); |
| 1311 | sljit_emit_op2(compiler, SLJIT_SUB, Registers::rdram, 0, Registers::rdram, 0, SLJIT_IMM, rdram_offset); |
| 1312 | |
| 1313 | // Check if this function's entry is hooked and emit the hook call if so. |
| 1314 | auto find_hook_it = inputs.entry_func_hooks.find(func_index); |
| 1315 | if (find_hook_it != inputs.entry_func_hooks.end()) { |
| 1316 | // Load rdram and ctx into R0 and R1. |
| 1317 | sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, Registers::rdram, 0, SLJIT_IMM, rdram_offset); |
| 1318 | sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, Registers::ctx, 0); |
| 1319 | // Load the hook's index into R2. |
| 1320 | sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, find_hook_it->second); |
| 1321 | sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3V(P, P, W), SLJIT_IMM, sljit_sw(inputs.run_hook)); |
| 1322 | } |
| 1323 | } |
| 1324 | |
| 1325 | void N64Recomp::LiveGenerator::emit_function_end() const { |
| 1326 | // Check that all jumps have been paired to a label. |
nothing calls this directly
no outgoing calls
no test coverage detected