MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / emit_function_call_by_register

Method emit_function_call_by_register

LiveRecomp/live_generator.cpp:1386–1402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1384}
1385
1386void N64Recomp::LiveGenerator::emit_function_call_by_register(int reg) const {
1387 // Load the register's value into the first argument.
1388 sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_MEM1(Registers::ctx), get_gpr_context_offset(reg));
1389
1390 // Call get_function.
1391 sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS1(P, 32), SLJIT_IMM, sljit_sw(inputs.get_function));
1392
1393 // Copy the return value into R3 so that it can be used for icall
1394 sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R3, 0, SLJIT_RETURN_REG, 0);
1395
1396 // Load rdram and ctx into R0 and R1.
1397 sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, Registers::rdram, 0, SLJIT_IMM, rdram_offset);
1398 sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, Registers::ctx, 0);
1399
1400 // Call the function.
1401 sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2V(P, P), SLJIT_R3, 0);
1402}
1403
1404void N64Recomp::LiveGenerator::emit_function_call_reference_symbol(const Context&, uint16_t section_index, size_t symbol_index, uint32_t target_section_offset) const {
1405 (void)symbol_index;

Callers

nothing calls this directly

Calls 1

get_gpr_context_offsetFunction · 0.85

Tested by

no test coverage detected