1 |
|
/* |
2 |
< |
* UAE - The Un*x Amiga Emulator |
2 |
> |
* compiler/gencomp.c - MC680x0 compilation generator |
3 |
|
* |
4 |
< |
* MC68000 compilation generator |
4 |
> |
* Based on work Copyright 1995, 1996 Bernd Schmidt |
5 |
> |
* Changes for UAE-JIT Copyright 2000 Bernd Meyer |
6 |
|
* |
7 |
< |
* Based on work Copyright 1995, 1996 Bernd Schmidt. Changes Copyright 2000 |
8 |
< |
* Bernd Meyer |
7 |
> |
* Adaptation for Basilisk II and improvements, copyright 2000-2004 |
8 |
> |
* Gwenole Beauchesne |
9 |
> |
* |
10 |
> |
* Basilisk II (C) 1997-2004 Christian Bauer |
11 |
> |
* |
12 |
> |
* This program is free software; you can redistribute it and/or modify |
13 |
> |
* it under the terms of the GNU General Public License as published by |
14 |
> |
* the Free Software Foundation; either version 2 of the License, or |
15 |
> |
* (at your option) any later version. |
16 |
> |
* |
17 |
> |
* This program is distributed in the hope that it will be useful, |
18 |
> |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
> |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 |
> |
* GNU General Public License for more details. |
21 |
> |
* |
22 |
> |
* You should have received a copy of the GNU General Public License |
23 |
> |
* along with this program; if not, write to the Free Software |
24 |
> |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 |
|
*/ |
26 |
|
|
10 |
– |
|
27 |
|
#include <stdio.h> |
28 |
|
#include <stdlib.h> |
29 |
|
#include <stdarg.h> |
1100 |
|
"\tint one=scratchie++;\n" |
1101 |
|
"\tif (needed_flags&FLAG_Z) {\n" |
1102 |
|
"\tmov_l_ri(zero,0);\n" |
1103 |
< |
"\tmov_l_ri(one,1);\n" |
1103 |
> |
"\tmov_l_ri(one,-1);\n" |
1104 |
|
"\tmake_flags_live();\n" |
1105 |
|
"\tcmov_l_rr(zero,one,5);\n" |
1106 |
|
"\t}\n"); |
1120 |
|
"\t%s_l(%s,%s);\n",op,dst,src); |
1121 |
|
break; |
1122 |
|
} |
1123 |
+ |
comprintf("\tlive_flags();\n"); |
1124 |
|
comprintf("\tif (needed_flags&FLAG_Z) {\n" |
1125 |
|
"\tcmov_l_rr(zero,one,5);\n" |
1126 |
< |
"\tbsf_l_rr(zero,zero);\n" |
1126 |
> |
"\tset_zero(zero, one);\n" /* No longer need one */ |
1127 |
> |
"\tlive_flags();\n" |
1128 |
|
"\t}\n"); |
1111 |
– |
comprintf("\tlive_flags();\n"); |
1129 |
|
comprintf("\tend_needflags();\n"); |
1130 |
|
duplicate_carry(); |
1131 |
|
comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n"); |
1365 |
|
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0); |
1366 |
|
start_brace(); |
1367 |
|
comprintf("\tint s=scratchie++;\n" |
1368 |
+ |
"\tint tmp=scratchie++;\n" |
1369 |
|
"\tmov_l_rr(s,src);\n"); |
1370 |
|
if (curi->size == sz_byte) |
1371 |
|
comprintf("\tand_l_ri(s,7);\n"); |
1381 |
|
case i_BCLR: op="btr"; break; |
1382 |
|
case i_BSET: op="bts"; break; |
1383 |
|
case i_BTST: op="bt"; need_write=0; break; |
1384 |
+ |
default: abort(); |
1385 |
|
} |
1386 |
|
comprintf("\t%s_l_rr(dst,s);\n" /* Answer now in C */ |
1387 |
< |
"\tsbb_l(s,s);\n" /* s is 0 if bit was 0, |
1388 |
< |
-1 otherwise */ |
1389 |
< |
"\tmake_flags_live();\n" /* Get the flags back */ |
1390 |
< |
"\tdont_care_flags();\n" |
1391 |
< |
"\tstart_needflags();\n" |
1392 |
< |
"\tbsf_l_rr(s,s);\n" |
1393 |
< |
"\tlive_flags();\n" |
1394 |
< |
"\tend_needflags();\n",op); |
1387 |
> |
"\tsbb_l(s,s);\n" /* s is 0 if bit was 0, -1 otherwise */ |
1388 |
> |
"\tmake_flags_live();\n" /* Get the flags back */ |
1389 |
> |
"\tdont_care_flags();\n",op); |
1390 |
> |
if (!noflags) { |
1391 |
> |
comprintf("\tstart_needflags();\n" |
1392 |
> |
"\tset_zero(s,tmp);\n" |
1393 |
> |
"\tlive_flags();\n" |
1394 |
> |
"\tend_needflags();\n"); |
1395 |
> |
} |
1396 |
|
if (need_write) |
1397 |
|
genastore ("dst", curi->dmode, "dstreg", curi->size, "dst"); |
1398 |
|
} |
1621 |
|
gen_update_next_handler(); |
1622 |
|
break; |
1623 |
|
case i_BSR: |
1604 |
– |
if (curi->size==sz_long) |
1605 |
– |
failure; |
1624 |
|
is_const_jump; |
1625 |
|
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0); |
1626 |
|
start_brace(); |