1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 * Copyright (C) 2014-2021 Paul Cercueil <paul@crapouillou.net>
6 #ifndef __OPTIMIZER_H__
7 #define __OPTIMIZER_H__
9 #include "disassembler.h"
14 _Bool opcode_reads_register(union code op, u8 reg);
15 _Bool opcode_writes_register(union code op, u8 reg);
16 _Bool has_delay_slot(union code op);
17 _Bool is_delay_slot(const struct opcode *list, unsigned int offset);
18 _Bool load_in_delay_slot(union code op);
19 _Bool opcode_is_io(union code op);
20 _Bool is_unconditional_jump(union code c);
21 _Bool is_syscall(union code c);
23 _Bool should_emulate(const struct opcode *op);
25 int lightrec_optimize(struct lightrec_state *state, struct block *block);
27 #endif /* __OPTIMIZER_H__ */