1 |
+ |
/* |
2 |
+ |
* compiler/compemu.h - Public interface and definitions |
3 |
+ |
* |
4 |
+ |
* Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer |
5 |
+ |
* |
6 |
+ |
* Adaptation for Basilisk II and improvements, copyright 2000-2005 |
7 |
+ |
* Gwenole Beauchesne |
8 |
+ |
* |
9 |
+ |
* Basilisk II (C) 1997-2005 Christian Bauer |
10 |
+ |
* |
11 |
+ |
* This program is free software; you can redistribute it and/or modify |
12 |
+ |
* it under the terms of the GNU General Public License as published by |
13 |
+ |
* the Free Software Foundation; either version 2 of the License, or |
14 |
+ |
* (at your option) any later version. |
15 |
+ |
* |
16 |
+ |
* This program is distributed in the hope that it will be useful, |
17 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
+ |
* GNU General Public License for more details. |
20 |
+ |
* |
21 |
+ |
* You should have received a copy of the GNU General Public License |
22 |
+ |
* along with this program; if not, write to the Free Software |
23 |
+ |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
+ |
*/ |
25 |
+ |
|
26 |
|
#ifndef COMPEMU_H |
27 |
|
#define COMPEMU_H |
28 |
|
|
30 |
|
|
31 |
|
#if USE_JIT |
32 |
|
|
33 |
+ |
#if defined __i386__ || defined __x86_64__ |
34 |
+ |
#include "flags_x86.h" |
35 |
+ |
#else |
36 |
+ |
#error "Unsupported JIT compiler for this architecture" |
37 |
+ |
#endif |
38 |
+ |
|
39 |
|
#if JIT_DEBUG |
40 |
|
/* dump some information (m68k block, x86 block addresses) about the compiler state */ |
41 |
|
extern void compiler_dumpstate(void); |
47 |
|
#define TAGMASK 0x0000ffff |
48 |
|
#define TAGSIZE (TAGMASK+1) |
49 |
|
#define MAXRUN 1024 |
50 |
< |
#define cacheline(x) (((uae_u32)x)&TAGMASK) |
50 |
> |
#define cacheline(x) (((uintptr)x)&TAGMASK) |
51 |
|
|
52 |
|
extern uae_u8* start_pc_p; |
53 |
|
extern uae_u32 start_pc; |
63 |
|
blockinfo_t * bi; |
64 |
|
}; |
65 |
|
|
66 |
+ |
/* Use new spill/reload strategy when calling external functions */ |
67 |
+ |
#define USE_OPTIMIZED_CALLS 0 |
68 |
+ |
#if USE_OPTIMIZED_CALLS |
69 |
+ |
#error implementation in progress |
70 |
+ |
#endif |
71 |
+ |
|
72 |
|
/* (gb) When on, this option can save save up to 30% compilation time |
73 |
|
* when many lazy flushes occur (e.g. apps in MacOS 8.x). |
74 |
|
*/ |
75 |
|
#define USE_SEPARATE_BIA 1 |
76 |
|
|
77 |
|
/* Use chain of checksum_info_t to compute the block checksum */ |
78 |
< |
#define USE_CHECKSUM_INFO 0 |
78 |
> |
#define USE_CHECKSUM_INFO 1 |
79 |
|
|
80 |
|
/* Use code inlining, aka follow-up of constant jumps */ |
81 |
< |
#define USE_INLINING 0 |
81 |
> |
#define USE_INLINING 1 |
82 |
> |
|
83 |
> |
/* Inlining requires the chained checksuming information */ |
84 |
> |
#if USE_INLINING |
85 |
> |
#undef USE_CHECKSUM_INFO |
86 |
> |
#define USE_CHECKSUM_INFO 1 |
87 |
> |
#endif |
88 |
> |
|
89 |
> |
/* Does flush_icache_range() only check for blocks falling in the requested range? */ |
90 |
> |
#define LAZY_FLUSH_ICACHE_RANGE 0 |
91 |
|
|
92 |
|
#define USE_F_ALIAS 1 |
93 |
|
#define USE_OFFSET 1 |
130 |
|
|
131 |
|
#define KILLTHERAT 1 /* Set to 1 to avoid some partial_rat_stalls */ |
132 |
|
|
133 |
< |
/* Whether to preserve registers across calls to JIT compiled routines */ |
134 |
< |
#ifdef X86_ASSEMBLY |
89 |
< |
#define USE_PUSH_POP 0 |
133 |
> |
#if defined(__x86_64__) |
134 |
> |
#define N_REGS 16 /* really only 15, but they are numbered 0-3,5-15 */ |
135 |
|
#else |
91 |
– |
#define USE_PUSH_POP 1 |
92 |
– |
#endif |
93 |
– |
|
136 |
|
#define N_REGS 8 /* really only 7, but they are numbered 0,1,2,3,5,6,7 */ |
137 |
+ |
#endif |
138 |
|
#define N_FREGS 6 /* That leaves us two positions on the stack to play with */ |
139 |
|
|
140 |
|
/* Functions exposed to newcpu, or to what was moved from newcpu.c to |
345 |
|
DECLARE_MIDFUNC(shra_b_ri(RW1 r, IMM i)); |
346 |
|
DECLARE_MIDFUNC(setcc(W1 d, IMM cc)); |
347 |
|
DECLARE_MIDFUNC(setcc_m(IMM d, IMM cc)); |
348 |
+ |
DECLARE_MIDFUNC(cmov_b_rr(RW1 d, R1 s, IMM cc)); |
349 |
+ |
DECLARE_MIDFUNC(cmov_w_rr(RW2 d, R2 s, IMM cc)); |
350 |
|
DECLARE_MIDFUNC(cmov_l_rr(RW4 d, R4 s, IMM cc)); |
351 |
|
DECLARE_MIDFUNC(cmov_l_rm(RW4 d, IMM s, IMM cc)); |
352 |
|
DECLARE_MIDFUNC(bsf_l_rr(W4 d, R4 s)); |
516 |
|
extern void get_n_addr(int address, int dest, int tmp); |
517 |
|
extern void get_n_addr_jmp(int address, int dest, int tmp); |
518 |
|
extern void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp); |
519 |
+ |
/* Set native Z flag only if register is zero */ |
520 |
+ |
extern void set_zero(int r, int tmp); |
521 |
|
extern int kill_rodent(int r); |
522 |
|
extern void sync_m68k_pc(void); |
523 |
|
extern uae_u32 get_const(int r); |
531 |
|
struct blockinfo_t; |
532 |
|
|
533 |
|
typedef struct dep_t { |
534 |
< |
uintptr* jmp_off; |
534 |
> |
uae_u32* jmp_off; |
535 |
|
struct blockinfo_t* target; |
536 |
|
struct blockinfo_t* source; |
537 |
|
struct dep_t** prev_p; |