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

Method process_store_op

src/cgenerator.cpp:585–660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585void N64Recomp::CGenerator::process_store_op(const StoreOp& op, const InstructionContext& ctx) const {
586 // Thread local variables to prevent allocations when possible.
587 // TODO these thread locals probably don't actually help right now, so figure out a better way to prevent allocations.
588 thread_local std::string base_str{};
589 thread_local std::string imm_str{};
590 thread_local std::string value_input{};
591 get_operand_string(Operand::Base, UnaryOpType::None, ctx, base_str);
592 get_operand_string(Operand::ImmS16, UnaryOpType::None, ctx, imm_str);
593 get_operand_string(op.value_input, UnaryOpType::None, ctx, value_input);
594
595 enum class StoreSyntax {
596 Func,
597 FuncWithRdram,
598 Assignment,
599 };
600
601 StoreSyntax syntax;
602 std::string func_text;
603
604 switch (op.type) {
605 case StoreOpType::SD:
606 func_text = "SD";
607 syntax = StoreSyntax::Func;
608 break;
609 case StoreOpType::SDL:
610 func_text = "do_sdl";
611 syntax = StoreSyntax::FuncWithRdram;
612 break;
613 case StoreOpType::SDR:
614 func_text = "do_sdr";
615 syntax = StoreSyntax::FuncWithRdram;
616 break;
617 case StoreOpType::SW:
618 func_text = "MEM_W";
619 syntax = StoreSyntax::Assignment;
620 break;
621 case StoreOpType::SWL:
622 func_text = "do_swl";
623 syntax = StoreSyntax::FuncWithRdram;
624 break;
625 case StoreOpType::SWR:
626 func_text = "do_swr";
627 syntax = StoreSyntax::FuncWithRdram;
628 break;
629 case StoreOpType::SH:
630 func_text = "MEM_H";
631 syntax = StoreSyntax::Assignment;
632 break;
633 case StoreOpType::SB:
634 func_text = "MEM_B";
635 syntax = StoreSyntax::Assignment;
636 break;
637 case StoreOpType::SDC1:
638 func_text = "SD";
639 syntax = StoreSyntax::Func;
640 break;
641 case StoreOpType::SWC1:
642 func_text = "MEM_W";

Callers 1

process_instructionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected