f2b1f30f73c4e88e227a7e32fd0b8f95b33597ba
[pcsx_rearmed.git] / deps / lightrec / optimizer.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * Copyright (C) 2014-2021 Paul Cercueil <paul@crapouillou.net>
4  */
5
6 #ifndef __OPTIMIZER_H__
7 #define __OPTIMIZER_H__
8
9 #include "disassembler.h"
10
11 struct block;
12 struct opcode;
13
14 __cnst _Bool opcode_reads_register(union code op, u8 reg);
15 __cnst _Bool opcode_writes_register(union code op, u8 reg);
16 __cnst u64 opcode_write_mask(union code op);
17 __cnst _Bool has_delay_slot(union code op);
18 _Bool is_delay_slot(const struct opcode *list, unsigned int offset);
19 __cnst _Bool opcode_is_mfc(union code op);
20 __cnst _Bool opcode_is_load(union code op);
21 __cnst _Bool opcode_is_io(union code op);
22 __cnst _Bool is_unconditional_jump(union code c);
23 __cnst _Bool is_syscall(union code c);
24
25 _Bool should_emulate(const struct opcode *op);
26
27 int lightrec_optimize(struct lightrec_state *state, struct block *block);
28
29 #endif /* __OPTIMIZER_H__ */