Add statics and missing #includes for prototypes.
[qemu/mini2440.git] / target-m68k / op-hacks.h
blob7bf345c2c93092fc8c8ad1b1dee20f04142e15ad
1 /* Various hacks to make code written for a dynamic code generator work
2 with regular QEMU. */
4 static int free_qreg;
6 #define QMODE_I32 1
7 #define QMODE_F32 1
8 #define QMODE_F64 2
10 static inline int gen_new_qreg(int mode)
12 int qreg;
14 qreg = free_qreg;
15 free_qreg += mode;
16 if (free_qreg > MAX_QREGS) {
17 fprintf(stderr, "qreg overflow\n");
18 abort();
20 return qreg + TARGET_NUM_QREGS;
23 static inline int gen_im32(uint32_t i)
25 int qreg = gen_new_qreg(QMODE_I32);
26 gen_op_mov32_im(qreg, i);
27 return qreg;
30 static inline void gen_op_ldf32_raw(int dest, int addr)
32 gen_op_ld32_raw(dest, addr);
35 static inline void gen_op_stf32_raw(int addr, int dest)
37 gen_op_st32_raw(addr, dest);
40 #if !defined(CONFIG_USER_ONLY)
41 static inline void gen_op_ldf32_user(int dest, int addr)
43 gen_op_ld32_user(dest, addr);
46 static inline void gen_op_stf32_user(int addr, int dest)
48 gen_op_st32_user(addr, dest);
51 static inline void gen_op_ldf32_kernel(int dest, int addr)
53 gen_op_ld32_kernel(dest, addr);
56 static inline void gen_op_stf32_kernel(int addr, int dest)
58 gen_op_st32_kernel(addr, dest);
60 #endif
62 static inline void gen_op_pack_32_f32(int dest, int src)
64 gen_op_mov32(dest, src);
67 static inline void gen_op_pack_f32_32(int dest, int src)
69 gen_op_mov32(dest, src);
72 static inline void gen_op_flags_set(void)
74 /* Dummy op. */
77 static inline void gen_op_shl_im_cc(int val, int shift)
79 gen_op_shl_cc(val, gen_im32(shift));
82 static inline void gen_op_shr_im_cc(int val, int shift)
84 gen_op_shr_cc(val, gen_im32(shift));
87 static inline void gen_op_sar_im_cc(int val, int shift)
89 gen_op_sar_cc(val, gen_im32(shift));
92 #ifdef USE_DIRECT_JUMP
93 #define TBPARAM(x)
94 #else
95 #define TBPARAM(x) (long)(x)
96 #endif
98 static inline void gen_op_goto_tb(int dummy, int n, long tb)
100 if (n == 0) {
101 gen_op_goto_tb0(TBPARAM(tb));
102 } else {
103 gen_op_goto_tb1(TBPARAM(tb));
107 static inline void gen_op_jmp_z32(int val, int label)
109 gen_op_set_T0_z32(val);
110 gen_op_jmp_T0(label);
113 static inline void gen_op_jmp_nz32(int val, int label)
115 gen_op_set_T0_nz32(val);
116 gen_op_jmp_T0(label);
119 static inline void gen_op_jmp_s32(int val, int label)
121 gen_op_set_T0_s32(val);
122 gen_op_jmp_T0(label);
125 static inline void gen_op_jmp_ns32(int val, int label)
127 gen_op_set_T0_ns32(val);
128 gen_op_jmp_T0(label);