9 #include "../psxcommon.h"
11 #define REGUSE_NONE 0x0000
12 #define REGUSE_UNKNOWN 0x0001
15 #define REGUSE_SPECIAL 0x0002
16 #define REGUSE_REGIMM 0x0004
17 #define REGUSE_COP0 0x0006
18 #define REGUSE_COP2 0x0008
19 #define REGUSE_BASIC 0x000a
20 #define REGUSE_SUBMASK 0x000e /* sub function mask */
22 #define REGUSE_ACC 0x0010 /* accumulator */
23 #define REGUSE_LOGIC 0x0020 /* logic operations */
24 #define REGUSE_MULT 0x0030 /* multiplier */
25 #define REGUSE_JUMP 0x0040 /* jump to dest */
26 #define REGUSE_JUMPR 0x0050 /* jump to reg */
27 #define REGUSE_BRANCH 0x0060 /* branch */
28 #define REGUSE_MEM_R 0x0070 /* read from memory */
29 #define REGUSE_MEM_W 0x0080 /* write to memory */
30 #define REGUSE_MEM 0x0090 /* read and write to memory */
31 #define REGUSE_SYS 0x00a0 /* syscall */
32 #define REGUSE_GTE 0x00b0 /* gte operation */
33 #define REGUSE_SUB 0x00f0 /* sub usage */
34 #define REGUSE_TYPEM 0x00f0 /* type mask */
37 #define REGUSE_RS_R 0x0100
38 #define REGUSE_RS_W 0x0200
39 #define REGUSE_RS (REGUSE_RS_R | REGUSE_RS_W)
40 #define REGUSE_RT_R 0x0400
41 #define REGUSE_RT_W 0x0800
42 #define REGUSE_RT (REGUSE_RT_R | REGUSE_RT_W)
43 #define REGUSE_RD_R 0x1000
44 #define REGUSE_RD_W 0x2000
45 #define REGUSE_RD (REGUSE_RD_R | REGUSE_RD_W)
47 #define REGUSE_R31_W 0x4000 /* writes to link register (r31) */
48 #define REGUSE_PC 0x8000 /* reads pc */
50 #define REGUSE_LO_R 0x10000
51 #define REGUSE_LO_W 0x20000
52 #define REGUSE_LO (REGUSE_LO_R | REGUSE_LO_W)
53 #define REGUSE_HI_R 0x40000
54 #define REGUSE_HI_W 0x80000
55 #define REGUSE_HI (REGUSE_HI_R | REGUSE_HI_W)
57 #define REGUSE_COP0_RD_R 0x100000
58 #define REGUSE_COP0_RD_W 0x200000
59 #define REGUSE_COP0_RD (REGUSE_COP0_RD_R | REGUSE_COP0_RD_W)
60 #define REGUSE_COP0_STATUS 0x400000
61 #define REGUSE_EXCEPTION 0x800000
63 #define REGUSE_COP2_RT_R 0x1000000
64 #define REGUSE_COP2_RT_W 0x2000000
65 #define REGUSE_COP2_RT (REGUSE_COP2_RT_R | REGUSE_COP2_RT_W)
66 #define REGUSE_COP2_RD_R 0x4000000
67 #define REGUSE_COP2_RD_W 0x8000000
68 #define REGUSE_COP2_RD (REGUSE_COP2_RD_R | REGUSE_COP2_RD_W)
71 // specific register use
73 #define REGUSE_WRITE 2
76 int useOfPsxReg(u32 code, int use, int psxreg) __attribute__ ((__pure__));;
77 int nextPsxRegUse(u32 pc, int psxreg) __attribute__ ((__pure__));;
78 int isPsxRegUsed(u32 pc, int psxreg) __attribute__ ((__pure__));;