| 64 | }; |
| 65 | |
| 66 | class CGenerator final : Generator { |
| 67 | public: |
| 68 | CGenerator(std::ostream& output_file) : output_file(output_file) {}; |
| 69 | void process_binary_op(const BinaryOp& op, const InstructionContext& ctx) const final; |
| 70 | void process_unary_op(const UnaryOp& op, const InstructionContext& ctx) const final; |
| 71 | void process_store_op(const StoreOp& op, const InstructionContext& ctx) const final; |
| 72 | void emit_function_start(const std::string& function_name, size_t func_index) const final; |
| 73 | void emit_function_end() const final; |
| 74 | void emit_function_call_lookup(uint32_t addr) const final; |
| 75 | void emit_function_call_by_register(int reg) const final; |
| 76 | void emit_function_call_reference_symbol(const Context& context, uint16_t section_index, size_t symbol_index, uint32_t target_section_offset) const final; |
| 77 | void emit_function_call(const Context& context, size_t function_index) const final; |
| 78 | void emit_named_function_call(const std::string& function_name) const final; |
| 79 | void emit_goto(const std::string& target) const final; |
| 80 | void emit_label(const std::string& label_name) const final; |
| 81 | void emit_jtbl_addend_declaration(const JumpTable& jtbl, int reg) const final; |
| 82 | void emit_branch_condition(const ConditionalBranchOp& op, const InstructionContext& ctx) const final; |
| 83 | void emit_branch_close() const final; |
| 84 | void emit_switch(const Context& recompiler_context, const JumpTable& jtbl, int reg) const final; |
| 85 | void emit_case(int case_index, const std::string& target_label) const final; |
| 86 | void emit_switch_error(uint32_t instr_vram, uint32_t jtbl_vram) const final; |
| 87 | void emit_switch_close() const final; |
| 88 | void emit_return(const Context& context, size_t func_index) const final; |
| 89 | void emit_check_fr(int fpr) const final; |
| 90 | void emit_check_nan(int fpr, bool is_double) const final; |
| 91 | void emit_cop0_status_read(int reg) const final; |
| 92 | void emit_cop0_status_write(int reg) const final; |
| 93 | void emit_cop1_cs_read(int reg) const final; |
| 94 | void emit_cop1_cs_write(int reg) const final; |
| 95 | void emit_muldiv(InstrId instr_id, int reg1, int reg2) const final; |
| 96 | void emit_syscall(uint32_t instr_vram) const final; |
| 97 | void emit_do_break(uint32_t instr_vram) const final; |
| 98 | void emit_pause_self() const final; |
| 99 | void emit_trigger_event(uint32_t event_index) const final; |
| 100 | void emit_comment(const std::string& comment) const final; |
| 101 | private: |
| 102 | void get_operand_string(Operand operand, UnaryOpType operation, const InstructionContext& context, std::string& operand_string) const; |
| 103 | void get_binary_expr_string(BinaryOpType type, const BinaryOperands& operands, const InstructionContext& ctx, const std::string& output, std::string& expr_string) const; |
| 104 | void get_notation(BinaryOpType op_type, std::string& func_string, std::string& infix_string) const; |
| 105 | std::ostream& output_file; |
| 106 | }; |
| 107 | } |
| 108 | |
| 109 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected