gpu_neon: don't include vector_ops.h in the main header
[pcsx_rearmed.git] / deps / lightrec / lightrec-private.h
index 87565a6..4eedef2 100644 (file)
@@ -43,6 +43,8 @@
 #define SET_DEFAULT_ELM(table, value) [0] = NULL
 #endif
 
+#define fallthrough do {} while (0) /* fall-through */
+
 /* Flags for (struct block *)->flags */
 #define BLOCK_NEVER_COMPILE    BIT(0)
 #define BLOCK_SHOULD_RECOMPILE BIT(1)
@@ -67,9 +69,16 @@ struct blockcache;
 struct recompiler;
 struct regcache;
 struct opcode;
-struct tinymm;
 struct reaper;
 
+struct u16x2 {
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+       u16 h, l;
+#else
+       u16 l, h;
+#endif
+};
+
 struct block {
        jit_state_t *_jit;
        struct opcode *opcode_list;
@@ -78,6 +87,7 @@ struct block {
        struct block *next;
        u32 pc;
        u32 hash;
+       u32 precompile_date;
        unsigned int code_size;
        u16 nb_ops;
        u8 flags;
@@ -127,11 +137,9 @@ struct lightrec_state {
        u32 target_cycle;
        u32 exit_flags;
        u32 old_cycle_counter;
-       u32 c_wrapper_arg;
        struct block *dispatcher, *c_wrapper_block;
        void *c_wrappers[C_WRAPPERS_COUNT];
        void *wrappers_eps[C_WRAPPERS_COUNT];
-       struct tinymm *tinymm;
        struct blockcache *block_cache;
        struct recompiler *rec;
        struct lightrec_cstate *cstate;
@@ -152,7 +160,7 @@ struct lightrec_state {
 };
 
 u32 lightrec_rw(struct lightrec_state *state, union code op,
-               u32 addr, u32 data, u16 *flags,
+               u32 addr, u32 data, u32 *flags,
                struct block *block);
 
 void lightrec_free_block(struct lightrec_state *state, struct block *block);
@@ -207,7 +215,7 @@ static inline void ** lut_address(struct lightrec_state *state, u32 offset)
 
 static inline void * lut_read(struct lightrec_state *state, u32 offset)
 {
-       void **lut_entry = lut_address(state, lut_offset(offset));
+       void **lut_entry = lut_address(state, offset);
 
        if (lut_is_32bit(state))
                return (void *)(uintptr_t) *(u32 *) lut_entry;
@@ -229,7 +237,7 @@ static inline u32 get_ds_pc(const struct block *block, u16 offset, s16 imm)
 {
        u16 flags = block->opcode_list[offset].flags;
 
-       offset += !!(OPT_SWITCH_DELAY_SLOTS && (flags & LIGHTREC_NO_DS));
+       offset += op_flag_no_ds(flags);
 
        return block->pc + (offset + imm << 2);
 }
@@ -238,7 +246,7 @@ static inline u32 get_branch_pc(const struct block *block, u16 offset, s16 imm)
 {
        u16 flags = block->opcode_list[offset].flags;
 
-       offset -= !!(OPT_SWITCH_DELAY_SLOTS && (flags & LIGHTREC_NO_DS));
+       offset -= op_flag_no_ds(flags);
 
        return block->pc + (offset + imm << 2);
 }
@@ -253,7 +261,6 @@ void lightrec_free_cstate(struct lightrec_cstate *cstate);
 
 union code lightrec_read_opcode(struct lightrec_state *state, u32 pc);
 
-struct block * lightrec_get_block(struct lightrec_state *state, u32 pc);
 int lightrec_compile_block(struct lightrec_cstate *cstate, struct block *block);
 void lightrec_free_opcode_list(struct lightrec_state *state, struct block *block);
 
@@ -269,4 +276,9 @@ static inline u8 get_mult_div_hi(union code c)
        return (OPT_FLAG_MULT_DIV && c.r.imm) ? c.r.imm : REG_HI;
 }
 
+static inline s16 s16_max(s16 a, s16 b)
+{
+       return a > b ? a : b;
+}
+
 #endif /* __LIGHTREC_PRIVATE_H__ */