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

Method emit_switch

src/cgenerator.cpp:462–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462void N64Recomp::CGenerator::emit_switch(const Context& recompiler_context, const JumpTable& jtbl, int reg) const {
463 (void)recompiler_context;
464 (void)reg;
465 // TODO generate code to subtract the jump table address from the register's value instead.
466 // Once that's done, the addend temp can be deleted to simplify the generator interface.
467 std::string jump_variable = fmt::format("jr_addend_{:08X}", jtbl.jr_vram);
468
469 fmt::print(output_file, "switch ({} >> 2) {{\n", jump_variable);
470}
471
472void N64Recomp::CGenerator::emit_case(int case_index, const std::string& target_label) const {
473 fmt::print(output_file, "case {}: goto {}; break;\n", case_index, target_label);

Callers 1

process_instructionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected