| 88 | std::vector<size_t> original_section_indices; |
| 89 | }; |
| 90 | class LiveGenerator final : public Generator { |
| 91 | public: |
| 92 | LiveGenerator(size_t num_funcs, const LiveGeneratorInputs& inputs); |
| 93 | ~LiveGenerator(); |
| 94 | // Prevent moving or copying. |
| 95 | LiveGenerator(const LiveGenerator& rhs) = delete; |
| 96 | LiveGenerator(LiveGenerator&& rhs) = delete; |
| 97 | LiveGenerator& operator=(const LiveGenerator& rhs) = delete; |
| 98 | LiveGenerator& operator=(LiveGenerator&& rhs) = delete; |
| 99 | |
| 100 | LiveGeneratorOutput finish(); |
| 101 | void process_binary_op(const BinaryOp& op, const InstructionContext& ctx) const final; |
| 102 | void process_unary_op(const UnaryOp& op, const InstructionContext& ctx) const final; |
| 103 | void process_store_op(const StoreOp& op, const InstructionContext& ctx) const final; |
| 104 | void emit_function_start(const std::string& function_name, size_t func_index) const final; |
| 105 | void emit_function_end() const final; |
| 106 | void emit_function_call_lookup(uint32_t addr) const final; |
| 107 | void emit_function_call_by_register(int reg) const final; |
| 108 | void emit_function_call_reference_symbol(const Context& context, uint16_t section_index, size_t symbol_index, uint32_t target_section_offset) const final; |
| 109 | void emit_function_call(const Context& context, size_t function_index) const final; |
| 110 | void emit_named_function_call(const std::string& function_name) const final; |
| 111 | void emit_goto(const std::string& target) const final; |
| 112 | void emit_label(const std::string& label_name) const final; |
| 113 | void emit_jtbl_addend_declaration(const JumpTable& jtbl, int reg) const final; |
| 114 | void emit_branch_condition(const ConditionalBranchOp& op, const InstructionContext& ctx) const final; |
| 115 | void emit_branch_close() const final; |
| 116 | void emit_switch(const Context& recompiler_context, const JumpTable& jtbl, int reg) const final; |
| 117 | void emit_case(int case_index, const std::string& target_label) const final; |
| 118 | void emit_switch_error(uint32_t instr_vram, uint32_t jtbl_vram) const final; |
| 119 | void emit_switch_close() const final; |
| 120 | void emit_return(const Context& context, size_t func_index) const final; |
| 121 | void emit_check_fr(int fpr) const final; |
| 122 | void emit_check_nan(int fpr, bool is_double) const final; |
| 123 | void emit_cop0_status_read(int reg) const final; |
| 124 | void emit_cop0_status_write(int reg) const final; |
| 125 | void emit_cop1_cs_read(int reg) const final; |
| 126 | void emit_cop1_cs_write(int reg) const final; |
| 127 | void emit_muldiv(InstrId instr_id, int reg1, int reg2) const final; |
| 128 | void emit_syscall(uint32_t instr_vram) const final; |
| 129 | void emit_do_break(uint32_t instr_vram) const final; |
| 130 | void emit_pause_self() const final; |
| 131 | void emit_trigger_event(uint32_t event_index) const final; |
| 132 | void emit_comment(const std::string& comment) const final; |
| 133 | private: |
| 134 | void get_operand_string(Operand operand, UnaryOpType operation, const InstructionContext& context, std::string& operand_string) const; |
| 135 | void get_binary_expr_string(BinaryOpType type, const BinaryOperands& operands, const InstructionContext& ctx, const std::string& output, std::string& expr_string) const; |
| 136 | void get_notation(BinaryOpType op_type, std::string& func_string, std::string& infix_string) const; |
| 137 | // Loads the relocated address specified by the instruction context into the target register. |
| 138 | void load_relocated_address(const InstructionContext& ctx, int reg) const; |
| 139 | sljit_compiler* compiler; |
| 140 | LiveGeneratorInputs inputs; |
| 141 | mutable std::unique_ptr<LiveGeneratorContext> context; |
| 142 | mutable bool errored; |
| 143 | }; |
| 144 | |
| 145 | void live_recompiler_init(); |
| 146 | bool recompile_function_live(LiveGenerator& generator, const Context& context, size_t function_index, std::ostream& output_file, std::span<std::vector<uint32_t>> static_funcs_out, bool tag_reference_relocs); |
nothing calls this directly
no outgoing calls
no test coverage detected