mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-06-29 21:46:17 +00:00
Implement trap instructions as conditional breaks
This commit is contained in:
parent
989a86b369
commit
a8b247ed03
7 changed files with 92 additions and 46 deletions
|
@ -58,6 +58,7 @@ namespace N64Recomp {
|
|||
virtual void emit_muldiv(InstrId instr_id, int reg1, int reg2) const = 0;
|
||||
virtual void emit_syscall(uint32_t instr_vram) const = 0;
|
||||
virtual void emit_do_break(uint32_t instr_vram) const = 0;
|
||||
virtual void emit_trap(const TrapOp& op, const InstructionContext& ctx, uint32_t instr_vram) const = 0;
|
||||
virtual void emit_pause_self() const = 0;
|
||||
virtual void emit_trigger_event(uint32_t event_index) const = 0;
|
||||
virtual void emit_comment(const std::string& comment) const = 0;
|
||||
|
@ -95,6 +96,7 @@ namespace N64Recomp {
|
|||
void emit_muldiv(InstrId instr_id, int reg1, int reg2) const final;
|
||||
void emit_syscall(uint32_t instr_vram) const final;
|
||||
void emit_do_break(uint32_t instr_vram) const final;
|
||||
void emit_trap(const TrapOp& op, const InstructionContext& ctx, uint32_t instr_vram) const final;
|
||||
void emit_pause_self() const final;
|
||||
void emit_trigger_event(uint32_t event_index) const final;
|
||||
void emit_comment(const std::string& comment) const final;
|
||||
|
|
|
@ -127,6 +127,7 @@ namespace N64Recomp {
|
|||
void emit_muldiv(InstrId instr_id, int reg1, int reg2) const final;
|
||||
void emit_syscall(uint32_t instr_vram) const final;
|
||||
void emit_do_break(uint32_t instr_vram) const final;
|
||||
void emit_trap(const TrapOp& op, const InstructionContext& ctx, uint32_t instr_vram) const final;
|
||||
void emit_pause_self() const final;
|
||||
void emit_trigger_event(uint32_t event_index) const final;
|
||||
void emit_comment(const std::string& comment) const final;
|
||||
|
|
|
@ -204,10 +204,18 @@ namespace N64Recomp {
|
|||
bool likely;
|
||||
};
|
||||
|
||||
struct TrapOp {
|
||||
// The type of binary operation to use for this compare
|
||||
BinaryOpType comparison;
|
||||
// The input operands.
|
||||
BinaryOperands operands;
|
||||
};
|
||||
|
||||
extern const std::unordered_map<InstrId, UnaryOp> unary_ops;
|
||||
extern const std::unordered_map<InstrId, BinaryOp> binary_ops;
|
||||
extern const std::unordered_map<InstrId, ConditionalBranchOp> conditional_branch_ops;
|
||||
extern const std::unordered_map<InstrId, StoreOp> store_ops;
|
||||
extern const std::unordered_map<InstrId, TrapOp> trap_ops;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue