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

Method load_relocated_address

LiveRecomp/live_generator.cpp:879–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877}
878
879void N64Recomp::LiveGenerator::load_relocated_address(const InstructionContext& ctx, int reg) const {
880 // Get the pointer to the section address.
881 int32_t* section_addr_ptr = (ctx.reloc_tag_as_reference ? inputs.reference_section_addresses : inputs.local_section_addresses) + ctx.reloc_section_index;
882
883 // Load the section's address into the target register.
884 sljit_emit_op1(compiler, SLJIT_MOV_S32, reg, 0, SLJIT_MEM0(), sljit_sw(section_addr_ptr));
885
886 // Don't emit the add if the offset is zero (small optimization).
887 if (ctx.reloc_target_section_offset != 0) {
888 // Add the reloc section offset to the section's address and put the result in R0.
889 sljit_emit_op2(compiler, SLJIT_ADD, reg, 0, reg, 0, SLJIT_IMM, ctx.reloc_target_section_offset);
890 }
891}
892
893void N64Recomp::LiveGenerator::process_unary_op(const UnaryOp& op, const InstructionContext& ctx) const {
894 // Skip instructions that output to $zero

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected