sh2 drc, add detection for in-memory polling

This commit is contained in:
kub 2019-05-02 23:16:55 +02:00
parent 213b7f42c1
commit 397ccdc6cf
9 changed files with 224 additions and 113 deletions

View file

@ -636,9 +636,13 @@ static inline void emith_pool_adjust(int pool_index, int move_offs)
#define EMITH_SJMP3_MID(cond) EMITH_NOTHING1(cond)
#define EMITH_SJMP3_END()
#define emith_move_r_r_c(cond, d, s) \
EOP_MOV_REG(cond,0,d,s,A_AM1_LSL,0)
#define emith_move_r_r(d, s) \
EOP_MOV_REG_SIMPLE(d, s)
emith_move_r_r_c(A_COND_AL, d, s)
#define emith_move_r_r_ptr_c(cond, d, s) \
emith_move_r_r_c(cond, d, s)
#define emith_move_r_r_ptr(d, s) \
emith_move_r_r(d, s)
@ -1116,11 +1120,16 @@ static inline void emith_pool_adjust(int pool_index, int move_offs)
#define emith_ret_to_ctx(offs) \
emith_ctx_write(LR, offs)
#define emith_push_ret() \
EOP_STMFD_SP(M1(LR))
/* pushes r12 for eabi alignment */
#define emith_push_ret(r) do { \
int r_ = (r >= 0 ? r : 12); \
EOP_STMFD_SP(M2(r_,LR)); \
} while (0)
#define emith_pop_and_ret() \
EOP_LDMFD_SP(M1(PC))
#define emith_pop_and_ret(r) do { \
int r_ = (r >= 0 ? r : 12); \
EOP_LDMFD_SP(M2(r_,PC)); \
} while (0)
#define host_instructions_updated(base, end) \
cache_flush_d_inval_i(base, end)

View file

@ -381,21 +381,12 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
emith_arith_r_imm(4, r, ~(imm))
// fake conditionals (using SJMP instead)
#define emith_move_r_imm_c(cond, r, imm) do { \
(void)(cond); \
emith_move_r_imm(r, imm); \
} while (0)
#define emith_add_r_imm_c(cond, r, imm) do { \
(void)(cond); \
emith_add_r_imm(r, imm); \
} while (0)
#define emith_sub_r_imm_c(cond, r, imm) do { \
(void)(cond); \
emith_sub_r_imm(r, imm); \
} while (0)
#define emith_move_r_imm_c(cond, r, imm) \
emith_move_r_imm(r, imm);
#define emith_add_r_imm_c(cond, r, imm) \
emith_add_r_imm(r, imm);
#define emith_sub_r_imm_c(cond, r, imm) \
emith_sub_r_imm(r, imm);
#define emith_or_r_imm_c(cond, r, imm) \
emith_or_r_imm(r, imm)
#define emith_eor_r_imm_c(cond, r, imm) \
@ -404,6 +395,8 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
emith_bic_r_imm(r, imm)
#define emith_tst_r_imm_c(cond, r, imm) \
emith_tst_r_imm(r, imm)
#define emith_move_r_r_ptr_c(cond, d, s) \
emith_move_r_r_ptr(d, s)
#define emith_ror_c(cond, d, s, cnt) \
emith_ror(d, s, cnt)
#define emith_and_r_r_c(cond, d, s) \
@ -819,12 +812,16 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
EMIT(offs, u32); \
} while (0)
#define emith_push_ret() \
emith_push(xSI); /* to align */
#define emith_push_ret(r) do { \
int r_ = (r >= 0 ? r : xSI); \
emith_push(r_); /* always push to align */ \
} while (0)
#define emith_pop_and_ret() \
emith_pop(xSI); \
emith_ret()
#define emith_pop_and_ret(r) do { \
int r_ = (r >= 0 ? r : xSI); \
emith_pop(r_); \
emith_ret(); \
} while (0)
#define EMITH_JMP_START(cond) { \
u8 *cond_ptr; \