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-2004 |
7 |
+ |
* Gwenole Beauchesne |
8 |
+ |
* |
9 |
+ |
* Basilisk II (C) 1997-2004 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 |
|
|
41 |
|
#define TAGMASK 0x0000ffff |
42 |
|
#define TAGSIZE (TAGMASK+1) |
43 |
|
#define MAXRUN 1024 |
44 |
< |
#define cacheline(x) (((uae_u32)x)&TAGMASK) |
44 |
> |
#define cacheline(x) (((uintptr)x)&TAGMASK) |
45 |
|
|
46 |
|
extern uae_u8* start_pc_p; |
47 |
|
extern uae_u32 start_pc; |
57 |
|
blockinfo_t * bi; |
58 |
|
}; |
59 |
|
|
60 |
+ |
/* Use new spill/reload strategy when calling external functions */ |
61 |
+ |
#define USE_OPTIMIZED_CALLS 0 |
62 |
+ |
#if USE_OPTIMIZED_CALLS |
63 |
+ |
#error implementation in progress |
64 |
+ |
#endif |
65 |
+ |
|
66 |
|
/* (gb) When on, this option can save save up to 30% compilation time |
67 |
|
* when many lazy flushes occur (e.g. apps in MacOS 8.x). |
68 |
|
*/ |
69 |
|
#define USE_SEPARATE_BIA 1 |
70 |
|
|
71 |
|
/* Use chain of checksum_info_t to compute the block checksum */ |
72 |
< |
#define USE_CHECKSUM_INFO 0 |
72 |
> |
#define USE_CHECKSUM_INFO 1 |
73 |
> |
|
74 |
> |
/* Use code inlining, aka follow-up of constant jumps */ |
75 |
> |
#define USE_INLINING 1 |
76 |
> |
|
77 |
> |
/* Inlining requires the chained checksuming information */ |
78 |
> |
#if USE_INLINING |
79 |
> |
#undef USE_CHECKSUM_INFO |
80 |
> |
#define USE_CHECKSUM_INFO 1 |
81 |
> |
#endif |
82 |
> |
|
83 |
> |
/* Does flush_icache_range() only check for blocks falling in the requested range? */ |
84 |
> |
#define LAZY_FLUSH_ICACHE_RANGE 0 |
85 |
|
|
86 |
|
#define USE_F_ALIAS 1 |
87 |
|
#define USE_OFFSET 1 |
125 |
|
#define KILLTHERAT 1 /* Set to 1 to avoid some partial_rat_stalls */ |
126 |
|
|
127 |
|
/* Whether to preserve registers across calls to JIT compiled routines */ |
128 |
< |
#ifdef X86_ASSEMBLY |
128 |
> |
#if defined(X86_ASSEMBLY) || defined(X86_64_ASSEMBLY) |
129 |
|
#define USE_PUSH_POP 0 |
130 |
|
#else |
131 |
|
#define USE_PUSH_POP 1 |
132 |
|
#endif |
133 |
|
|
134 |
+ |
#if defined(__x86_64__) |
135 |
+ |
#define N_REGS 16 /* really only 15, but they are numbered 0-3,5-15 */ |
136 |
+ |
#else |
137 |
|
#define N_REGS 8 /* really only 7, but they are numbered 0,1,2,3,5,6,7 */ |
138 |
+ |
#endif |
139 |
|
#define N_FREGS 6 /* That leaves us two positions on the stack to play with */ |
140 |
|
|
141 |
|
/* Functions exposed to newcpu, or to what was moved from newcpu.c to |
515 |
|
extern void get_n_addr(int address, int dest, int tmp); |
516 |
|
extern void get_n_addr_jmp(int address, int dest, int tmp); |
517 |
|
extern void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp); |
518 |
+ |
/* Set native Z flag only if register is zero */ |
519 |
+ |
extern void set_zero(int r, int tmp); |
520 |
|
extern int kill_rodent(int r); |
521 |
|
extern void sync_m68k_pc(void); |
522 |
|
extern uae_u32 get_const(int r); |
530 |
|
struct blockinfo_t; |
531 |
|
|
532 |
|
typedef struct dep_t { |
533 |
< |
uintptr* jmp_off; |
533 |
> |
uae_u32* jmp_off; |
534 |
|
struct blockinfo_t* target; |
535 |
|
struct blockinfo_t* source; |
536 |
|
struct dep_t** prev_p; |
540 |
|
typedef struct checksum_info_t { |
541 |
|
uae_u8 *start_p; |
542 |
|
uae_u32 length; |
494 |
– |
uae_u32 c1; |
495 |
– |
uae_u32 c2; |
543 |
|
struct checksum_info_t *next; |
544 |
|
} checksum_info; |
545 |
|
|
557 |
|
|
558 |
|
uae_u8* pc_p; |
559 |
|
|
560 |
+ |
uae_u32 c1; |
561 |
+ |
uae_u32 c2; |
562 |
|
#if USE_CHECKSUM_INFO |
563 |
|
checksum_info *csi; |
515 |
– |
# define CSI_TYPE checksum_info |
516 |
– |
# define CSI_START_P(csi) (csi)->start_p |
517 |
– |
# define CSI_LENGTH(csi) (csi)->length |
564 |
|
#else |
519 |
– |
uae_u32 c1; |
520 |
– |
uae_u32 c2; |
565 |
|
uae_u32 len; |
566 |
|
uae_u32 min_pcp; |
523 |
– |
# define CSI_TYPE blockinfo |
524 |
– |
# define CSI_START_P(csi) (csi)->min_pcp |
525 |
– |
# define CSI_LENGTH(csi) (csi)->len |
567 |
|
#endif |
568 |
|
|
569 |
|
struct blockinfo_t* next_same_cl; |